diff options
Diffstat (limited to 'libhwc2.1/pixel-display.cpp')
-rw-r--r-- | libhwc2.1/pixel-display.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/libhwc2.1/pixel-display.cpp b/libhwc2.1/pixel-display.cpp index fec7309..366945a 100644 --- a/libhwc2.1/pixel-display.cpp +++ b/libhwc2.1/pixel-display.cpp @@ -201,17 +201,36 @@ ndk::ScopedAStatus Display::setRefreshRateThrottle(int delayMs, int *_aidl_retur bool Display::runMediator(const RoiRect &roi, const Weight &weight, const HistogramPos &pos, std::vector<char16_t> *histogrambuffer) { - if (mMediator.setRoiWeightThreshold(roi, weight, pos) != HistogramErrorCode::NONE) { - ALOGE("histogram error, SET_ROI_WEIGHT_THRESHOLD ERROR\n"); - return false; + bool isConfigChanged; + histogram::HistogramMediator::HistogramConfig pendingConfig(roi, weight, pos); + + { + std::unique_lock<std::mutex> lk(mMediator.mConfigMutex); + isConfigChanged = mMediator.mConfig != pendingConfig; + + if (isConfigChanged && + mMediator.setRoiWeightThreshold(roi, weight, pos) != HistogramErrorCode::NONE) { + ALOGE("histogram error, SET_ROI_WEIGHT_THRESHOLD ERROR\n"); + return false; + } + + mMediator.mConfig = pendingConfig; } + if (!mMediator.histRequested() && mMediator.requestHist() == HistogramErrorCode::ENABLE_HIST_ERROR) { ALOGE("histogram error, ENABLE_HIST ERROR\n"); } - if (mMediator.getFrameCount() != mMediator.getSampleFrameCounter()) { - mDisplay->mDevice->onRefresh(mDisplay->mDisplayId); // DRM not busy & sampled frame changed + + /* + * DPU driver maintains always-on histogram engine state with up to date histogram data. + * Therefore we don't have explicitly to trigger onRefresh in case histogram configuration + * does not change. + */ + if (isConfigChanged) { + mDisplay->mDevice->onRefresh(mDisplay->mDisplayId); } + if (mMediator.collectRoiLuma(histogrambuffer) != HistogramErrorCode::NONE) { ALOGE("histogram error, COLLECT_ROI_LUMA ERROR\n"); return false; |