summaryrefslogtreecommitdiff
path: root/libhwc2.1/histogram_mediator.cpp
diff options
context:
space:
mode:
authorOleg Matcovschi <omatcovschi@google.com>2023-05-25 10:36:34 -0700
committerOleg Matcovschi <omatcovschi@google.com>2023-05-26 05:56:45 +0000
commit97e8efb6765b2af5308e858f05519b9764bab799 (patch)
tree17cc5779351b3bac40005f111b601a1b91609a8b /libhwc2.1/histogram_mediator.cpp
parent8c9370f42fc9414b9e1307140e3a0cce16d03c5c (diff)
libhwc2.1: histogram: fix race condition
Fix potential race condition when data is received before setHistrogramControl() returns and mHistReq_pending is set to true. TODO: Implement timeout for requestHist(). Bug: 261376040 Bug: 277948998 Change-Id: Idd8b191508af19f1ce9bdd63d7fdf6a39fe0bd6e Merged-In: Idd8b191508af19f1ce9bdd63d7fdf6a39fe0bd6e Signed-off-by: Oleg Matcovschi <omatcovschi@google.com>
Diffstat (limited to 'libhwc2.1/histogram_mediator.cpp')
-rw-r--r--libhwc2.1/histogram_mediator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libhwc2.1/histogram_mediator.cpp b/libhwc2.1/histogram_mediator.cpp
index a09f579..d1fba54 100644
--- a/libhwc2.1/histogram_mediator.cpp
+++ b/libhwc2.1/histogram_mediator.cpp
@@ -56,12 +56,12 @@ histogram::HistogramErrorCode histogram::HistogramMediator::requestHist() {
ExynosDisplayDrmInterface *moduleDisplayInterface =
static_cast<ExynosDisplayDrmInterface *>(mDisplay->mDisplayInterface.get());
- if (moduleDisplayInterface->setHistogramControl(
- hidl_histogram_control_t::HISTOGRAM_CONTROL_REQUEST) != NO_ERROR) {
- return histogram::HistogramErrorCode::ENABLE_HIST_ERROR;
- }
{
std::unique_lock<std::mutex> lk(mIDLHistogram->mDataCollectingMutex);
+ if (moduleDisplayInterface->setHistogramControl(
+ hidl_histogram_control_t::HISTOGRAM_CONTROL_REQUEST) != NO_ERROR) {
+ return histogram::HistogramErrorCode::ENABLE_HIST_ERROR;
+ }
mIDLHistogram->mHistReq_pending = true;
}
return histogram::HistogramErrorCode::NONE;