summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-07 00:22:09 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-07 00:22:09 +0000
commit12fb6fba570634dc51ca31cbdc39a3ce389246c9 (patch)
tree022af22e02febe37e0a6f7e0a9905aed6bb5f3e5
parentbeeee661c649719ba4f7a24aea0ac7bc3e1c2f7f (diff)
parent48a8ee8241cfc8b3f8c9a8b963e0916912d0bc73 (diff)
downloadgs101-android13-qpr2-release.tar.gz
Change-Id: I1052b54b025e149a5464df6098e319538056f16a
-rw-r--r--include/histogram/HistogramInfo.h17
-rw-r--r--libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp6
-rw-r--r--libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h14
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 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);