diff options
author | John Chang <cweichun@google.com> | 2023-12-13 23:05:32 +0000 |
---|---|---|
committer | John Chang <cweichun@google.com> | 2023-12-14 15:40:55 +0000 |
commit | 84abcc58b38123440f850d254625983d19b3f057 (patch) | |
tree | 236386922e299269c1278c69128f2d32b09abc33 | |
parent | 8f0a2bf3005f9e042d36fb4cbcbea031b7182da6 (diff) | |
download | common-84abcc58b38123440f850d254625983d19b3f057.tar.gz |
libhwc2.1:vrrController: ensure notifyExpectedPresent is directed to VRR
Invoke the notifyExpectedPresent function and ensure that the call is
directed to the VRR (Variable Refresh Rate) controller
Bug: 316209922
Test: confirm that the VRR controller successfully receives each
notifyExpectedPresent call
Change-Id: I7f41d607a55a4cca74964637e603f1045581410a
-rw-r--r-- | hwc3/ComposerClient.cpp | 9 | ||||
-rw-r--r-- | hwc3/impl/HalImpl.cpp | 11 | ||||
-rw-r--r-- | libhwc2.1/libdevice/ExynosDisplay.h | 5 | ||||
-rw-r--r-- | libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp | 7 | ||||
-rw-r--r-- | libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h | 2 |
5 files changed, 29 insertions, 5 deletions
diff --git a/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp index dcba5b7..104bac6 100644 --- a/hwc3/ComposerClient.cpp +++ b/hwc3/ComposerClient.cpp @@ -84,9 +84,12 @@ ndk::ScopedAStatus ComposerClient::getDisplayConfigurations( return TO_BINDER_STATUS(err); } -ndk::ScopedAStatus ComposerClient::notifyExpectedPresent(int64_t, const ClockMonotonicTimestamp&, - int32_t) { - return TO_BINDER_STATUS(HWC2_ERROR_UNSUPPORTED); +ndk::ScopedAStatus ComposerClient::notifyExpectedPresent( + int64_t display, const ClockMonotonicTimestamp& expectedPresentTime, + int32_t frameIntervalNs) { + DEBUG_DISPLAY_FUNC(display); + auto err = mHal->notifyExpectedPresent(display, expectedPresentTime, frameIntervalNs); + return TO_BINDER_STATUS(err); } ndk::ScopedAStatus ComposerClient::destroyLayer(int64_t display, int64_t layer) { diff --git a/hwc3/impl/HalImpl.cpp b/hwc3/impl/HalImpl.cpp index 259b779..37e7d9f 100644 --- a/hwc3/impl/HalImpl.cpp +++ b/hwc3/impl/HalImpl.cpp @@ -431,8 +431,15 @@ int32_t HalImpl::getDisplayConfigurations(int64_t display, int32_t, return HWC2_ERROR_NONE; } -int32_t HalImpl::notifyExpectedPresent(int64_t, const ClockMonotonicTimestamp&, int32_t) { - return HWC2_ERROR_UNSUPPORTED; +int32_t HalImpl::notifyExpectedPresent(int64_t display, + const ClockMonotonicTimestamp& expectedPresentTime, + int32_t frameIntervalNs) { + ExynosDisplay* halDisplay; + RET_IF_ERR(getHalDisplay(display, halDisplay)); + + RET_IF_ERR( + halDisplay->notifyExpectedPresent(expectedPresentTime.timestampNanos, frameIntervalNs)); + return HWC2_ERROR_NONE; } int32_t HalImpl::getDisplayConnectionType(int64_t display, DisplayConnectionType* outType) { diff --git a/libhwc2.1/libdevice/ExynosDisplay.h b/libhwc2.1/libdevice/ExynosDisplay.h index cdb62d6..b329f11 100644 --- a/libhwc2.1/libdevice/ExynosDisplay.h +++ b/libhwc2.1/libdevice/ExynosDisplay.h @@ -1322,6 +1322,11 @@ class ExynosDisplay { displaycolor::DisplayType getDcDisplayType() const; + virtual int32_t notifyExpectedPresent(int64_t __unused timestamp, + int32_t __unused frameIntervalNs) { + return HWC2_ERROR_UNSUPPORTED; + }; + protected: virtual bool getHDRException(ExynosLayer *layer); virtual int32_t getActiveConfigInternal(hwc2_config_t* outConfig); diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp index d15c4fe..d440ac2 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp @@ -708,6 +708,13 @@ void ExynosPrimaryDisplay::onVsync(int64_t timestamp) { } } +int32_t ExynosPrimaryDisplay::notifyExpectedPresent(int64_t timestamp, int32_t frameIntervalNs) { + if (mVariableRefreshRateController) { + mVariableRefreshRateController->notifyExpectedPresent(timestamp, frameIntervalNs); + } + return NO_ERROR; +} + int32_t ExynosPrimaryDisplay::setLhbmDisplayConfigLocked(uint32_t peakRate) { auto hwConfig = mDisplayInterface->getActiveModeId(); auto config = getConfigId(peakRate, mDisplayConfigs[hwConfig].width, diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h index 2d5b657..f3b412d 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h @@ -80,6 +80,8 @@ class ExynosPrimaryDisplay : public ExynosDisplay { virtual void onVsync(int64_t timestamp) override; + int32_t notifyExpectedPresent(int64_t timestamp, int32_t frameIntervalNs) override; + protected: /* setPowerMode(int32_t mode) * Descriptor: HWC2_FUNCTION_SET_POWER_MODE |