diff options
author | Xin Li <delphij@google.com> | 2023-01-11 22:47:13 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2023-01-11 22:47:13 -0800 |
commit | d37e8e4366098e5804cb367fa54b158f754d736a (patch) | |
tree | 022af22e02febe37e0a6f7e0a9905aed6bb5f3e5 | |
parent | f9b71089bc51b68916b58cf231991c563a11bef8 (diff) | |
parent | 607411a94314ce6a62d5e6dc371590a4d40dd950 (diff) | |
download | gs101-temp_273316506_tm-qpr2.tar.gz |
Merge tm-qpr-dev-plus-aosp-without-vendor@9467136temp_273316506_tm-qpr2
Bug: 264720040
Merged-In: I08e60dfc787b046d922ba1abc17745695b5034a7
Change-Id: Ia6bb1af9fd1c9a3594135a141c7744c0bcfe3717
4 files changed, 23 insertions, 15 deletions
diff --git a/include/histogram/HistogramInfo.h b/include/histogram/HistogramInfo.h index 532136b..34eada3 100644 --- a/include/histogram/HistogramInfo.h +++ b/include/histogram/HistogramInfo.h @@ -18,12 +18,16 @@ #define HISTOGRAMINFO_H_ #include <aidl/com/google/hardware/pixel/display/HistogramPos.h> #include <drm/samsung_drm.h> + +#include <mutex> + using HistogramPos = ::aidl::com::google::hardware::pixel::display::HistogramPos; class HistogramInfo { public: enum class HistogramType { HISTOGRAM_SAMPLING = 0, HISTOGRAM_HIDL, HISTOGRAM_TYPE_NUM }; void setHistogramROI(uint16_t x, uint16_t y, uint16_t h, uint16_t v) { + std::unique_lock<std::mutex> lk(mSetHistInfoMutex); mHistogramROI.start_x = x; mHistogramROI.start_y = y; mHistogramROI.hsize = h; @@ -32,14 +36,22 @@ public: const struct histogram_roi& getHistogramROI() { return mHistogramROI; } void setHistogramWeights(uint16_t r, uint16_t g, uint16_t b) { + std::unique_lock<std::mutex> lk(mSetHistInfoMutex); mHistogramWeights.weight_r = r; mHistogramWeights.weight_g = g; mHistogramWeights.weight_b = b; }; const struct histogram_weights& getHistogramWeights() { return mHistogramWeights; } - void setHistogramThreshold(uint32_t t) { mHistogramThreshold = t; } - uint32_t getHistogramThreshold() { return mHistogramThreshold; } + void setHistogramThreshold(uint32_t t) { + std::unique_lock<std::mutex> lk(mSetHistInfoMutex); + mHistogramThreshold = t; + } + + uint32_t getHistogramThreshold() { + std::unique_lock<std::mutex> lk(mSetHistInfoMutex); + return mHistogramThreshold; + } HistogramType getHistogramType() { return mHistogramType; } @@ -47,6 +59,7 @@ public: virtual ~HistogramInfo() {} virtual void setHistogramPos(HistogramPos pos) = 0; virtual void callbackHistogram(char16_t* bin) = 0; + std::mutex mSetHistInfoMutex; private: HistogramType mHistogramType = HistogramType::HISTOGRAM_TYPE_NUM; diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp index 2969eea..71807d9 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp @@ -797,6 +797,7 @@ const std::string ExynosDisplayDrmInterfaceModule::GetPanelInfo(const std::strin int32_t ExynosDisplayDrmInterfaceModule::createHistoRoiBlob(uint32_t &blobId) { struct histogram_roi histo_roi; + std::unique_lock<std::mutex> lk((mHistogramInfo->mSetHistInfoMutex)); histo_roi.start_x = mHistogramInfo->getHistogramROI().start_x; histo_roi.start_y = mHistogramInfo->getHistogramROI().start_y; histo_roi.hsize = mHistogramInfo->getHistogramROI().hsize; @@ -814,6 +815,7 @@ int32_t ExynosDisplayDrmInterfaceModule::createHistoRoiBlob(uint32_t &blobId) { int32_t ExynosDisplayDrmInterfaceModule::createHistoWeightsBlob(uint32_t &blobId) { struct histogram_weights histo_weights; + std::unique_lock<std::mutex> lk((mHistogramInfo->mSetHistInfoMutex)); histo_weights.weight_r = mHistogramInfo->getHistogramWeights().weight_r; histo_weights.weight_g = mHistogramInfo->getHistogramWeights().weight_g; histo_weights.weight_b = mHistogramInfo->getHistogramWeights().weight_b; @@ -864,7 +866,7 @@ int32_t ExynosDisplayDrmInterfaceModule::setDisplayHistoBlob( int32_t ExynosDisplayDrmInterfaceModule::setDisplayHistogramSetting( ExynosDisplayDrmInterface::DrmModeAtomicReq &drmReq) { - if ((mHistogramInfoRegistered == false) || (isPrimary() == false)) return NO_ERROR; + if ((isHistogramInfoRegistered() == false) || (isPrimary() == false)) return NO_ERROR; int ret = NO_ERROR; @@ -894,7 +896,7 @@ int32_t ExynosDisplayDrmInterfaceModule::setDisplayHistogramSetting( } int32_t ExynosDisplayDrmInterfaceModule::setHistogramControl(hidl_histogram_control_t control) { - if ((mHistogramInfoRegistered == false) || (isPrimary() == false)) return NO_ERROR; + if ((isHistogramInfoRegistered() == false) || (isPrimary() == false)) return NO_ERROR; int ret = NO_ERROR; uint32_t crtc_id = mDrmCrtc->id(); diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h index f783c5f..b730879 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h @@ -78,17 +78,10 @@ class ExynosDisplayDrmInterfaceModule : public ExynosDisplayDrmInterface { virtual int32_t setDisplayHistogramSetting( ExynosDisplayDrmInterface::DrmModeAtomicReq &drmReq); - virtual void registerHistogramInfo(IDLHistogram *info) { - if (info) - mHistogramInfo.reset(info); - else - mHistogramInfo.reset(); - - if (mHistogramInfo.get()) - mHistogramInfoRegistered = true; - else - mHistogramInfoRegistered = false; + virtual void registerHistogramInfo(const std::shared_ptr<IDLHistogram> &info) { + mHistogramInfo = info; } + bool isHistogramInfoRegistered() { return mHistogramInfo != nullptr; } int32_t setHistogramControl(hidl_histogram_control_t enabled); virtual int32_t setHistogramData(void *bin); @@ -185,7 +178,6 @@ class ExynosDisplayDrmInterfaceModule : public ExynosDisplayDrmInterface { HistoBlobs mOldHistoBlobs; std::shared_ptr<IDLHistogram> mHistogramInfo; - bool mHistogramInfoRegistered = false; private: const std::string GetPanelInfo(const std::string &sysfs_rel, char delim); diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp index 90b8c33..5aee49d 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp @@ -996,6 +996,7 @@ int32_t ExynosPrimaryDisplayModule::setAtcMode(std::string mode_name) { ALOGE("Fail to set atc enable = %d", enable); return -EPERM; } + mPendingAtcOff = false; } mCurrentAtcModeName = enable ? mode_name : "NULL"; |