19 #ifndef MIR_GRAPHICS_ANDROID_HWC_COMMON_DEVICE_H_
20 #define MIR_GRAPHICS_ANDROID_HWC_COMMON_DEVICE_H_
23 #include <hardware/hwcomposer.h>
26 #include <condition_variable>
35 class HWCVsyncCoordinator;
36 class HWCCommonDevice;
40 HWCCommonDevice*
self;
43 class HWCCommonDevice :
public HWCDevice
46 virtual ~HWCCommonDevice() noexcept;
50 unsigned int number_of_framebuffers_available() const;
52 virtual geometry::Size display_size() const = 0;
53 virtual
void set_next_frontbuffer(std::shared_ptr<Buffer> const& buffer) = 0;
54 virtual
void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0;
60 HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,
61 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);
63 std::shared_ptr<hwc_composer_device_1> const hwc_device;
64 std::shared_ptr<HWCVsyncCoordinator> const coordinator;
66 std::unique_lock<std::mutex> lock_unblanked();
69 int turn_screen_on() const noexcept(
true);
70 int turn_screen_off() const noexcept(true);
72 HWCCallbacks callbacks;
74 std::mutex blanked_mutex;
75 std::condition_variable blanked_cond;