diff options
author | Tao Bao <tbao@google.com> | 2018-11-01 19:53:30 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-11-01 19:53:30 +0100 |
commit | 082adef0e04b720c732e0edbc6f483136266e13e (patch) | |
tree | dc0e8b221eeb6154bdc661a68fa2b331ade0ac28 /minui/graphics_adf.h | |
parent | Merge "Refactor the code to check the metadata" (diff) | |
parent | Merge changes I69ce001a,I14514017,I8e67cda7 (diff) | |
download | android_bootable_recovery-082adef0e04b720c732e0edbc6f483136266e13e.tar android_bootable_recovery-082adef0e04b720c732e0edbc6f483136266e13e.tar.gz android_bootable_recovery-082adef0e04b720c732e0edbc6f483136266e13e.tar.bz2 android_bootable_recovery-082adef0e04b720c732e0edbc6f483136266e13e.tar.lz android_bootable_recovery-082adef0e04b720c732e0edbc6f483136266e13e.tar.xz android_bootable_recovery-082adef0e04b720c732e0edbc6f483136266e13e.tar.zst android_bootable_recovery-082adef0e04b720c732e0edbc6f483136266e13e.zip |
Diffstat (limited to 'minui/graphics_adf.h')
-rw-r--r-- | minui/graphics_adf.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/minui/graphics_adf.h b/minui/graphics_adf.h index 099d32962..bf9842878 100644 --- a/minui/graphics_adf.h +++ b/minui/graphics_adf.h @@ -17,6 +17,9 @@ #pragma once #include <stdint.h> +#include <sys/types.h> + +#include <memory> #include <adf/adf.h> @@ -25,6 +28,11 @@ class GRSurfaceAdf : public GRSurface { public: + ~GRSurfaceAdf() override; + + static std::unique_ptr<GRSurfaceAdf> Create(int intf_fd, const drm_mode_modeinfo* mode, + __u32 format, int* err); + uint8_t* data() override { return mmapped_buffer_; } @@ -32,34 +40,36 @@ class GRSurfaceAdf : public GRSurface { private: friend class MinuiBackendAdf; - int fence_fd; - int fd; - __u32 offset; - __u32 pitch; + GRSurfaceAdf(int width, int height, int row_bytes, int pixel_bytes, __u32 offset, __u32 pitch, + int fd) + : GRSurface(width, height, row_bytes, pixel_bytes), offset(offset), pitch(pitch), fd(fd) {} + + const __u32 offset; + const __u32 pitch; + int fd; + int fence_fd{ -1 }; uint8_t* mmapped_buffer_{ nullptr }; }; class MinuiBackendAdf : public MinuiBackend { public: + MinuiBackendAdf(); + ~MinuiBackendAdf() override; GRSurface* Init() override; GRSurface* Flip() override; void Blank(bool) override; - ~MinuiBackendAdf() override; - MinuiBackendAdf(); private: - int SurfaceInit(const drm_mode_modeinfo* mode, GRSurfaceAdf* surf); int InterfaceInit(); int DeviceInit(adf_device* dev); - void SurfaceDestroy(GRSurfaceAdf* surf); void Sync(GRSurfaceAdf* surf); int intf_fd; adf_id_t eng_id; __u32 format; adf_device dev; - unsigned int current_surface; - unsigned int n_surfaces; - GRSurfaceAdf surfaces[2]; + size_t current_surface; + size_t n_surfaces; + std::unique_ptr<GRSurfaceAdf> surfaces[2]; }; |