drm_hwcomposer: Fix RegisterCallback() function
- Fixes segfault during client switch.
- Allows to run VTS on Android-11.
VTS Results:
============================================
arm64-v8a VtsHalGraphicsComposerV2_1TargetTest: [53 tests / 42808 msec]
armeabi-v7a VtsHalGraphicsComposerV2_1TargetTest: [53 tests / 33353 msec]
=============== Summary ===============
2/2 modules completed
Total Tests : 106
PASSED : 106
FAILED : 0
============================================
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/drm/VSyncWorker.h b/drm/VSyncWorker.h
index 0121a6c..7454b51 100644
--- a/drm/VSyncWorker.h
+++ b/drm/VSyncWorker.h
@@ -19,6 +19,7 @@
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
+#include <hardware/hwcomposer2.h>
#include <stdint.h>
#include <map>
@@ -42,6 +43,8 @@
int Init(DrmDevice *drm, int display);
void RegisterCallback(std::shared_ptr<VsyncCallback> callback);
+ void RegisterClientCallback(hwc2_callback_data_t data,
+ hwc2_function_pointer_t hook);
void VSyncControl(bool enabled);
@@ -62,6 +65,9 @@
int display_;
std::atomic_bool enabled_;
int64_t last_timestamp_;
+
+ hwc2_callback_data_t vsync_callback_data_ = NULL;
+ HWC2_PFN_VSYNC vsync_callback_hook_ = NULL;
};
} // namespace android