summaryrefslogtreecommitdiffstats
path: root/minui/graphics_adf.h
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-10-31 08:12:11 +0100
committerTao Bao <tbao@google.com>2018-11-01 04:28:29 +0100
commit1b18cf56e21d038fcb03d09a13c90545cb1b6501 (patch)
tree9daf79cd952a37b8edaeeed78123e93753a2b970 /minui/graphics_adf.h
parentminui: Refactor GRSurfaceFbdev. (diff)
downloadandroid_bootable_recovery-1b18cf56e21d038fcb03d09a13c90545cb1b6501.tar
android_bootable_recovery-1b18cf56e21d038fcb03d09a13c90545cb1b6501.tar.gz
android_bootable_recovery-1b18cf56e21d038fcb03d09a13c90545cb1b6501.tar.bz2
android_bootable_recovery-1b18cf56e21d038fcb03d09a13c90545cb1b6501.tar.lz
android_bootable_recovery-1b18cf56e21d038fcb03d09a13c90545cb1b6501.tar.xz
android_bootable_recovery-1b18cf56e21d038fcb03d09a13c90545cb1b6501.tar.zst
android_bootable_recovery-1b18cf56e21d038fcb03d09a13c90545cb1b6501.zip
Diffstat (limited to 'minui/graphics_adf.h')
-rw-r--r--minui/graphics_adf.h32
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];
};