diff options
author | susi_su <susisu@google.com> | 2022-06-28 16:46:27 +0800 |
---|---|---|
committer | susi_su <susisu@google.com> | 2022-07-06 17:14:29 +0800 |
commit | 93bc42db617bd0cdf9fbf18c18e85c26b62f991a (patch) | |
tree | 176d9b4808edcf6b2939a9e1a1a6f93559486982 /libhwc2.1/histogram_mediator.cpp | |
parent | c4be0ab248ce940539117da3f9ec24a4a3c135cc (diff) |
libhwc2.1: resolving histogram_request_ioctl error log
When screen in idle, DRM driver would not respond
and the DRM request would not be satisfied.
Later on, when another histogram client calls,
DRM driver will complain histogram already registered error log.
Skip the request call if the previous one is there.
Bug: 236907095
Test: local test and verified without error log
Change-Id: I285204a499077e56ff929aac8f56eaeefaaa8588
Diffstat (limited to 'libhwc2.1/histogram_mediator.cpp')
-rw-r--r-- | libhwc2.1/histogram_mediator.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libhwc2.1/histogram_mediator.cpp b/libhwc2.1/histogram_mediator.cpp index 8f39812..0ce310d 100644 --- a/libhwc2.1/histogram_mediator.cpp +++ b/libhwc2.1/histogram_mediator.cpp @@ -58,7 +58,10 @@ histogram::HistogramErrorCode histogram::HistogramMediator::requestHist() { hidl_histogram_control_t::HISTOGRAM_CONTROL_REQUEST) != NO_ERROR) { return histogram::HistogramErrorCode::ENABLE_HIST_ERROR; } - mIDLHistogram.mHistData_available = false; + { + std::unique_lock<std::mutex> lk(mIDLHistogram.mDataCollectingMutex); + mIDLHistogram.mHistReq_pending = true; + } return histogram::HistogramErrorCode::NONE; } @@ -66,17 +69,18 @@ histogram::HistogramErrorCode histogram::HistogramMediator::cancelHistRequest() ExynosDisplayDrmInterface *moduleDisplayInterface = static_cast<ExynosDisplayDrmInterface *>(mDisplay->mDisplayInterface.get()); - if ((moduleDisplayInterface->setHistogramControl( - hidl_histogram_control_t::HISTOGRAM_CONTROL_CANCEL) != NO_ERROR)) { + if (moduleDisplayInterface->setHistogramControl( + hidl_histogram_control_t::HISTOGRAM_CONTROL_CANCEL) != NO_ERROR) { return histogram::HistogramErrorCode::DISABLE_HIST_ERROR; } return histogram::HistogramErrorCode::NONE; } void histogram::HistogramMediator::HistogramReceiver::callbackHistogram(char16_t *bin) { - if (mHistData_available == false) { // data buffer available + std::unique_lock<std::mutex> lk(mDataCollectingMutex); + if (mHistReq_pending == true) { std::memcpy(mHistData, bin, HISTOGRAM_BINS_SIZE * sizeof(char16_t)); - mHistData_available = true; + mHistReq_pending = false; } mHistData_cv.notify_all(); } @@ -101,13 +105,12 @@ histogram::HistogramErrorCode histogram::HistogramMediator::setRoiWeightThreshol histogram::HistogramErrorCode histogram::HistogramMediator::collectRoiLuma( std::vector<char16_t> *buf) { - std::mutex mDataCollectingMutex; // for data collecting operations - std::unique_lock<std::mutex> lk(mDataCollectingMutex); + std::unique_lock<std::mutex> lk(mIDLHistogram.mDataCollectingMutex); mIDLHistogram.mHistData_cv.wait_for(lk, std::chrono::milliseconds(50), [this]() { - return (!isDisplayPowerOff() && mIDLHistogram.mHistData_available); + return (!isDisplayPowerOff() && !mIDLHistogram.mHistReq_pending); }); - if (mIDLHistogram.mHistData_available == true) setSampleFrameCounter(getFrameCount()); + if (mIDLHistogram.mHistReq_pending == false) setSampleFrameCounter(getFrameCount()); buf->assign(mIDLHistogram.mHistData, mIDLHistogram.mHistData + HISTOGRAM_BINS_SIZE); return histogram::HistogramErrorCode::NONE; |