From 12ecb0dc80ad3db105e46247a75b52832ee6dc8c Mon Sep 17 00:00:00 2001 From: Gopikrishnaiah Anandan Date: Tue, 16 Jan 2018 15:37:15 -0800 Subject: [PATCH] sdm: Fix refresh seqeunce for QDCM solid fill color Calibration tool issues binder call to display solid fill color onto screen for calibration. Acquire scope lock to ensure that there is no race condition between binder thread and display thread w.r.t solid fill color. Block the solid fill binder call with a delay to ensure that solid fill color is displayed. Change-Id: Ic0ee320e24dc662213531362b124ff7bbfdf4309 --- sdm/libs/hwc2/hwc_session.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp index 02e2129e..81c9154c 100644 --- a/sdm/libs/hwc2/hwc_session.cpp +++ b/sdm/libs/hwc2/hwc_session.cpp @@ -72,6 +72,7 @@ namespace sdm { static HWCUEvent g_hwc_uevent_; Locker HWCSession::locker_[HWC_NUM_DISPLAY_TYPES]; +static const int kSolidFillDelay = 100 * 1000; void HWCUEvent::UEventThread(HWCUEvent *hwc_uevent) { const char *uevent_thread_name = "HWC_UeventThread"; @@ -1530,14 +1531,22 @@ android::status_t HWCSession::QdcmCMDHandler(const android::Parcel *input_parcel ret = color_mgr_->EnableQDCMMode(false, hwc_display_[HWC_DISPLAY_PRIMARY]); break; case kApplySolidFill: - ret = color_mgr_->SetSolidFill(pending_action.params, + { + SCOPE_LOCK(locker_[HWC_DISPLAY_PRIMARY]); + ret = color_mgr_->SetSolidFill(pending_action.params, true, hwc_display_[HWC_DISPLAY_PRIMARY]); + } Refresh(HWC_DISPLAY_PRIMARY); + usleep(kSolidFillDelay); break; case kDisableSolidFill: - ret = color_mgr_->SetSolidFill(pending_action.params, + { + SCOPE_LOCK(locker_[HWC_DISPLAY_PRIMARY]); + ret = color_mgr_->SetSolidFill(pending_action.params, false, hwc_display_[HWC_DISPLAY_PRIMARY]); + } Refresh(HWC_DISPLAY_PRIMARY); + usleep(kSolidFillDelay); break; case kSetPanelBrightness: brightness_value = reinterpret_cast(resp_payload.payload);