diff options
author | Roman Stratiienko <roman.o.stratiienko@globallogic.com> | 2021-09-29 13:01:39 +0300 |
---|---|---|
committer | Roman Stratiienko <roman.o.stratiienko@globallogic.com> | 2021-09-29 13:01:39 +0300 |
commit | 11ef8c5f6792a128d8419a037ff00b3987d565f1 (patch) | |
tree | 82708d55d1968df91baa995beef2304364abc4c2 | |
parent | 863a3c207e73001ab5f4ee84c71d21c8fcb8086c (diff) | |
download | drm_hwcomposer-11ef8c5f6792a128d8419a037ff00b3987d565f1.tar.gz |
drm_hwcomposer: Add support for VSYNC_2_4 callback
Increase composer@2.4 implemented API coverage.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
-rw-r--r-- | DrmHwcTwo.cpp | 21 | ||||
-rw-r--r-- | DrmHwcTwo.h | 3 |
2 files changed, 21 insertions, 3 deletions
diff --git a/DrmHwcTwo.cpp b/DrmHwcTwo.cpp index b7e20f0..10177e9 100644 --- a/DrmHwcTwo.cpp +++ b/DrmHwcTwo.cpp @@ -202,6 +202,12 @@ HWC2::Error DrmHwcTwo::RegisterCallback(int32_t descriptor, vsync_callback_ = std::make_pair(HWC2_PFN_VSYNC(function), data); break; } +#if PLATFORM_SDK_VERSION > 29 + case HWC2::Callback::Vsync_2_4: { + vsync_2_4_callback_ = std::make_pair(HWC2_PFN_VSYNC_2_4(function), data); + break; + } +#endif default: break; } @@ -279,10 +285,19 @@ HWC2::Error DrmHwcTwo::HwcDisplay::Init(std::vector<DrmPlane *> *planes) { } ret = vsync_worker_.Init(drm_, display, [this](int64_t timestamp) { - /* vsync callback */ const std::lock_guard<std::mutex> lock(hwc2_->callback_lock_); - if (hwc2_->vsync_callback_.first != nullptr && - hwc2_->vsync_callback_.second != nullptr) { + /* vsync callback */ +#if PLATFORM_SDK_VERSION > 29 + if (hwc2_->vsync_2_4_callback_.first != nullptr && + hwc2_->vsync_2_4_callback_.second != nullptr) { + hwc2_vsync_period_t period_ns{}; + GetDisplayVsyncPeriod(&period_ns); + hwc2_->vsync_2_4_callback_.first(hwc2_->vsync_2_4_callback_.second, + handle_, timestamp, period_ns); + } else +#endif + if (hwc2_->vsync_callback_.first != nullptr && + hwc2_->vsync_callback_.second != nullptr) { hwc2_->vsync_callback_.first(hwc2_->vsync_callback_.second, handle_, timestamp); } diff --git a/DrmHwcTwo.h b/DrmHwcTwo.h index 16c4dac..19355cd 100644 --- a/DrmHwcTwo.h +++ b/DrmHwcTwo.h @@ -44,6 +44,9 @@ class DrmHwcTwo : public hwc2_device_t { std::pair<HWC2_PFN_HOTPLUG, hwc2_callback_data_t> hotplug_callback_{}; std::pair<HWC2_PFN_VSYNC, hwc2_callback_data_t> vsync_callback_{}; +#if PLATFORM_SDK_VERSION > 29 + std::pair<HWC2_PFN_VSYNC_2_4, hwc2_callback_data_t> vsync_2_4_callback_{}; +#endif std::pair<HWC2_PFN_REFRESH, hwc2_callback_data_t> refresh_callback_{}; std::mutex callback_lock_; |