diff options
author | Susi Su <susisu@google.com> | 2022-12-06 07:53:48 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-12-06 07:53:48 +0000 |
commit | f04ac94966104804e75520d681da5e83713ed504 (patch) | |
tree | 01f4429fac0e7ffb7b0cfa9d9234534ef18fbdcb | |
parent | 87a0dae88e8b7b5041be88771be86458732e19f5 (diff) | |
parent | df63dd053b45653025501a002feae4adf4eb3f37 (diff) | |
download | gs101-f04ac94966104804e75520d681da5e83713ed504.tar.gz |
Merge "libhw2.1: change mIDLHistogram to shared_ptr" into tm-qpr-dev am: 48a8ee8241 am: df63dd053b
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/google/graphics/gs101/+/19465161
Change-Id: I340c835df23d72c683a9e9b95bdda5be71c75d34
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | include/histogram/HistogramInfo.h | 17 | ||||
-rw-r--r-- | libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp | 6 | ||||
-rw-r--r-- | libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h | 14 |
3 files changed, 22 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 2411e17..e2b751a 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp @@ -483,6 +483,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; @@ -500,6 +501,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; @@ -550,7 +552,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; @@ -580,7 +582,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 1a7afb5..70e963b 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h @@ -53,17 +53,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); @@ -160,7 +153,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); |