From 1b420e9bde4bb7150a2a664aab97e37a607da16f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 28 Jun 2023 08:53:39 +0000 Subject: libhwc2.1: OperationRateManager: save target operation rate Save target operation rate instead of writing to the sysfs node since we will change it via atomic commit path. Bug: 284094183 Bug: 289042122 Test: change operation rate via brightness/config/power mode Change-Id: I106de21ec0bb4094542aefc7b7109ab4dd9f304c --- .../libmaindisplay/ExynosPrimaryDisplayModule.cpp | 47 ++++++++-------------- .../libmaindisplay/ExynosPrimaryDisplayModule.h | 7 ++-- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp index 6917f16..36d3f93 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp @@ -55,35 +55,23 @@ int32_t ExynosPrimaryDisplayModule::validateWinConfigData() return ExynosDisplay::validateWinConfigData(); } -int32_t ExynosPrimaryDisplayModule::OperationRateManager::getOperationRate() { - std::string op_rate_str; - - ATRACE_CALL(); +int32_t ExynosPrimaryDisplayModule::OperationRateManager::getTargetOperationRate() { if (mDisplayPowerMode == HWC2_POWER_MODE_DOZE || mDisplayPowerMode == HWC2_POWER_MODE_DOZE_SUSPEND) { return LP_OP_RATE; + } else { + return mDisplayTargetOperationRate; } - - if (readLineFromFile(mSysfsPath, op_rate_str, '\n') != OK) { - OP_MANAGER_LOGE("failed to read %s", mSysfsPath.c_str()); - return 0; - } - return !op_rate_str.empty() ? std::atoi(op_rate_str.c_str()) : 0; } -int32_t ExynosPrimaryDisplayModule::OperationRateManager::setOperationRate(const int32_t rate) { - if (!mDisplayActiveOperationRate || mDisplayActiveOperationRate == rate) return NO_ERROR; +int32_t ExynosPrimaryDisplayModule::OperationRateManager::setTargetOperationRate( + const int32_t rate) { + if (mDisplayTargetOperationRate == rate) return NO_ERROR; - ATRACE_CALL(); - int32_t ret = writeIntToFile(mSysfsPath.c_str(), rate); - if (ret == NO_ERROR) { - mDisplayActiveOperationRate = rate; - OP_MANAGER_LOGI("succeed to write operation rate %d", rate); - } else { - OP_MANAGER_LOGE("failed to write operation rate %d", rate); - } + OP_MANAGER_LOGI("set target operation rate %d", rate); + mDisplayTargetOperationRate = rate; - return ret; + return NO_ERROR; } ExynosPrimaryDisplayModule::OperationRateManager::OperationRateManager( @@ -99,8 +87,7 @@ ExynosPrimaryDisplayModule::OperationRateManager::OperationRateManager( mDisplayPowerMode(HWC2_POWER_MODE_ON), mDisplayLowBatteryModeEnabled(false) { mDisplayNsMinDbv = property_get_int32("vendor.primarydisplay.op.ns_min_dbv", 0); - mDisplayActiveOperationRate = mDisplayHsOperationRate; - mSysfsPath = mDisplay->getPanelSysfsPath(DisplayType::DISPLAY_PRIMARY) + "op_hz"; + mDisplayTargetOperationRate = mDisplayHsOperationRate; OP_MANAGER_LOGI("Op Rate: NS=%d HS=%d NsMinDbv=%d", mDisplayNsOperationRate, mDisplayHsOperationRate, mDisplayNsMinDbv); } @@ -182,8 +169,8 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::updateOperationRateLoc if (mDisplayPowerMode == HWC2_POWER_MODE_DOZE || mDisplayPowerMode == HWC2_POWER_MODE_DOZE_SUSPEND) { - mDisplayActiveOperationRate = LP_OP_RATE; - desiredOpRate = mDisplayActiveOperationRate; + mDisplayTargetOperationRate = LP_OP_RATE; + desiredOpRate = mDisplayTargetOperationRate; effectiveOpRate = desiredOpRate; } else if (mDisplayPowerMode != HWC2_POWER_MODE_ON) { return ret; @@ -196,7 +183,7 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::updateOperationRateLoc effectiveOpRate = mDisplayHsOperationRate; } else if (cond == DispOpCondition::PANEL_SET_POWER) { if (mDisplayPowerMode == HWC2_POWER_MODE_ON) { - mDisplayActiveOperationRate = getOperationRate(); + mDisplayTargetOperationRate = getTargetOperationRate(); } effectiveOpRate = desiredOpRate; } else if (cond == DispOpCondition::SET_DBV) { @@ -206,7 +193,7 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::updateOperationRateLoc effectiveOpRate = desiredOpRate; } mDisplayLastDbv = dbv; - if (effectiveOpRate > LP_OP_RATE && (effectiveOpRate != mDisplayActiveOperationRate)) { + if (effectiveOpRate > LP_OP_RATE && (effectiveOpRate != mDisplayTargetOperationRate)) { OP_MANAGER_LOGD("brightness delta=%d", delta); } else { return ret; @@ -217,11 +204,11 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::updateOperationRateLoc OP_MANAGER_LOGI("rate switching is disabled, skip NS op rate update"); return ret; } else if (effectiveOpRate > LP_OP_RATE) { - ret = setOperationRate(effectiveOpRate); + ret = setTargetOperationRate(effectiveOpRate); } - OP_MANAGER_LOGI("Op@%d(desired:%d) | Refresh@%d(peak:%d), Battery:%s, DBV:%d(NsMin:%d)", - mDisplayActiveOperationRate, desiredOpRate, curRefreshRate, + OP_MANAGER_LOGI("Target@%d(desired:%d) | Refresh@%d(peak:%d), Battery:%s, DBV:%d(NsMin:%d)", + mDisplayTargetOperationRate, desiredOpRate, curRefreshRate, mDisplayPeakRefreshRate, mDisplayLowBatteryModeEnabled ? "Low" : "OK", mDisplayLastDbv, mDisplayNsMinDbv); return ret; diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h index b084b6c..9dc0673 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h @@ -43,7 +43,7 @@ class ExynosPrimaryDisplayModule : public gs201::ExynosPrimaryDisplayModule { int32_t onConfig(hwc2_config_t cfg) override; int32_t onBrightness(uint32_t dbv) override; int32_t onPowerMode(int32_t mode) override; - int32_t getOperationRate() override; + int32_t getTargetOperationRate() override; private: enum class DispOpCondition : uint32_t { @@ -54,12 +54,12 @@ class ExynosPrimaryDisplayModule : public gs201::ExynosPrimaryDisplayModule { }; int32_t updateOperationRateLocked(const DispOpCondition cond); - int32_t setOperationRate(const int32_t rate); + int32_t setTargetOperationRate(const int32_t rate); ExynosPrimaryDisplay* mDisplay; int32_t mDisplayHsOperationRate; int32_t mDisplayNsOperationRate; - int32_t mDisplayActiveOperationRate; + int32_t mDisplayTargetOperationRate; int32_t mDisplayNsMinDbv; int32_t mDisplayPeakRefreshRate; int32_t mDisplayRefreshRate; @@ -68,7 +68,6 @@ class ExynosPrimaryDisplayModule : public gs201::ExynosPrimaryDisplayModule { std::optional mDisplayPowerMode; bool mDisplayLowBatteryModeEnabled; Mutex mLock; - std::string mSysfsPath; static constexpr uint32_t BRIGHTNESS_DELTA_THRESHOLD = 10; static constexpr uint32_t LP_OP_RATE = 30; -- cgit v1.2.3 From fe4eba4783907fd17e4d38f7f34f50f8e8869616 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 28 Jun 2023 08:53:39 +0000 Subject: libhwc2.1: OperationRateManager: save target operation rate Save target operation rate instead of writing to the sysfs node since we will change it via atomic commit path. Bug: 284094183 Bug: 289042122 Test: change operation rate via brightness/config/power mode Change-Id: I106de21ec0bb4094542aefc7b7109ab4dd9f304c Merged-In: I106de21ec0bb4094542aefc7b7109ab4dd9f304c --- .../libmaindisplay/ExynosPrimaryDisplayModule.cpp | 47 ++++++++-------------- .../libmaindisplay/ExynosPrimaryDisplayModule.h | 7 ++-- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp index 6917f16..36d3f93 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp @@ -55,35 +55,23 @@ int32_t ExynosPrimaryDisplayModule::validateWinConfigData() return ExynosDisplay::validateWinConfigData(); } -int32_t ExynosPrimaryDisplayModule::OperationRateManager::getOperationRate() { - std::string op_rate_str; - - ATRACE_CALL(); +int32_t ExynosPrimaryDisplayModule::OperationRateManager::getTargetOperationRate() { if (mDisplayPowerMode == HWC2_POWER_MODE_DOZE || mDisplayPowerMode == HWC2_POWER_MODE_DOZE_SUSPEND) { return LP_OP_RATE; + } else { + return mDisplayTargetOperationRate; } - - if (readLineFromFile(mSysfsPath, op_rate_str, '\n') != OK) { - OP_MANAGER_LOGE("failed to read %s", mSysfsPath.c_str()); - return 0; - } - return !op_rate_str.empty() ? std::atoi(op_rate_str.c_str()) : 0; } -int32_t ExynosPrimaryDisplayModule::OperationRateManager::setOperationRate(const int32_t rate) { - if (!mDisplayActiveOperationRate || mDisplayActiveOperationRate == rate) return NO_ERROR; +int32_t ExynosPrimaryDisplayModule::OperationRateManager::setTargetOperationRate( + const int32_t rate) { + if (mDisplayTargetOperationRate == rate) return NO_ERROR; - ATRACE_CALL(); - int32_t ret = writeIntToFile(mSysfsPath.c_str(), rate); - if (ret == NO_ERROR) { - mDisplayActiveOperationRate = rate; - OP_MANAGER_LOGI("succeed to write operation rate %d", rate); - } else { - OP_MANAGER_LOGE("failed to write operation rate %d", rate); - } + OP_MANAGER_LOGI("set target operation rate %d", rate); + mDisplayTargetOperationRate = rate; - return ret; + return NO_ERROR; } ExynosPrimaryDisplayModule::OperationRateManager::OperationRateManager( @@ -99,8 +87,7 @@ ExynosPrimaryDisplayModule::OperationRateManager::OperationRateManager( mDisplayPowerMode(HWC2_POWER_MODE_ON), mDisplayLowBatteryModeEnabled(false) { mDisplayNsMinDbv = property_get_int32("vendor.primarydisplay.op.ns_min_dbv", 0); - mDisplayActiveOperationRate = mDisplayHsOperationRate; - mSysfsPath = mDisplay->getPanelSysfsPath(DisplayType::DISPLAY_PRIMARY) + "op_hz"; + mDisplayTargetOperationRate = mDisplayHsOperationRate; OP_MANAGER_LOGI("Op Rate: NS=%d HS=%d NsMinDbv=%d", mDisplayNsOperationRate, mDisplayHsOperationRate, mDisplayNsMinDbv); } @@ -182,8 +169,8 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::updateOperationRateLoc if (mDisplayPowerMode == HWC2_POWER_MODE_DOZE || mDisplayPowerMode == HWC2_POWER_MODE_DOZE_SUSPEND) { - mDisplayActiveOperationRate = LP_OP_RATE; - desiredOpRate = mDisplayActiveOperationRate; + mDisplayTargetOperationRate = LP_OP_RATE; + desiredOpRate = mDisplayTargetOperationRate; effectiveOpRate = desiredOpRate; } else if (mDisplayPowerMode != HWC2_POWER_MODE_ON) { return ret; @@ -196,7 +183,7 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::updateOperationRateLoc effectiveOpRate = mDisplayHsOperationRate; } else if (cond == DispOpCondition::PANEL_SET_POWER) { if (mDisplayPowerMode == HWC2_POWER_MODE_ON) { - mDisplayActiveOperationRate = getOperationRate(); + mDisplayTargetOperationRate = getTargetOperationRate(); } effectiveOpRate = desiredOpRate; } else if (cond == DispOpCondition::SET_DBV) { @@ -206,7 +193,7 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::updateOperationRateLoc effectiveOpRate = desiredOpRate; } mDisplayLastDbv = dbv; - if (effectiveOpRate > LP_OP_RATE && (effectiveOpRate != mDisplayActiveOperationRate)) { + if (effectiveOpRate > LP_OP_RATE && (effectiveOpRate != mDisplayTargetOperationRate)) { OP_MANAGER_LOGD("brightness delta=%d", delta); } else { return ret; @@ -217,11 +204,11 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::updateOperationRateLoc OP_MANAGER_LOGI("rate switching is disabled, skip NS op rate update"); return ret; } else if (effectiveOpRate > LP_OP_RATE) { - ret = setOperationRate(effectiveOpRate); + ret = setTargetOperationRate(effectiveOpRate); } - OP_MANAGER_LOGI("Op@%d(desired:%d) | Refresh@%d(peak:%d), Battery:%s, DBV:%d(NsMin:%d)", - mDisplayActiveOperationRate, desiredOpRate, curRefreshRate, + OP_MANAGER_LOGI("Target@%d(desired:%d) | Refresh@%d(peak:%d), Battery:%s, DBV:%d(NsMin:%d)", + mDisplayTargetOperationRate, desiredOpRate, curRefreshRate, mDisplayPeakRefreshRate, mDisplayLowBatteryModeEnabled ? "Low" : "OK", mDisplayLastDbv, mDisplayNsMinDbv); return ret; diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h index b084b6c..9dc0673 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h @@ -43,7 +43,7 @@ class ExynosPrimaryDisplayModule : public gs201::ExynosPrimaryDisplayModule { int32_t onConfig(hwc2_config_t cfg) override; int32_t onBrightness(uint32_t dbv) override; int32_t onPowerMode(int32_t mode) override; - int32_t getOperationRate() override; + int32_t getTargetOperationRate() override; private: enum class DispOpCondition : uint32_t { @@ -54,12 +54,12 @@ class ExynosPrimaryDisplayModule : public gs201::ExynosPrimaryDisplayModule { }; int32_t updateOperationRateLocked(const DispOpCondition cond); - int32_t setOperationRate(const int32_t rate); + int32_t setTargetOperationRate(const int32_t rate); ExynosPrimaryDisplay* mDisplay; int32_t mDisplayHsOperationRate; int32_t mDisplayNsOperationRate; - int32_t mDisplayActiveOperationRate; + int32_t mDisplayTargetOperationRate; int32_t mDisplayNsMinDbv; int32_t mDisplayPeakRefreshRate; int32_t mDisplayRefreshRate; @@ -68,7 +68,6 @@ class ExynosPrimaryDisplayModule : public gs201::ExynosPrimaryDisplayModule { std::optional mDisplayPowerMode; bool mDisplayLowBatteryModeEnabled; Mutex mLock; - std::string mSysfsPath; static constexpr uint32_t BRIGHTNESS_DELTA_THRESHOLD = 10; static constexpr uint32_t LP_OP_RATE = 30; -- cgit v1.2.3 From b21fac0c042ab14b33dde8b44a7d8102efb65db6 Mon Sep 17 00:00:00 2001 From: Chiung-fu Chen Date: Thu, 3 Aug 2023 14:46:19 +0000 Subject: Add chiungfu@ to OWNERS Bug: 294345293 Test: none Change-Id: Ib9d63275997bba7d985cfa91cc44fed44ca82404 --- OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/OWNERS b/OWNERS index f5af57b..d625f89 100644 --- a/OWNERS +++ b/OWNERS @@ -1,3 +1,4 @@ +chiungfu@google.com longling@google.com midaschieh@google.com salidoa@google.com -- cgit v1.2.3 From 573d3753c867db7d06cc6df42fcdd4678c2baa36 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Wed, 31 May 2023 08:52:15 +0000 Subject: libhwc2.1: Add HistogramController class Bug: 255986866 Bug: 227384721 Test: use aidl_hist_client to test multi channel histogram Change-Id: If9372091533d882edcb9dbb7fd94801f64dc4c74 Signed-off-by: Leo Chen --- libhwc2.1/Android.mk | 3 +- libhwc2.1/libdevice/HistogramController.cpp | 56 +++++++++++++++++++++++++++++ libhwc2.1/libdevice/HistogramController.h | 30 ++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 libhwc2.1/libdevice/HistogramController.cpp create mode 100644 libhwc2.1/libdevice/HistogramController.h diff --git a/libhwc2.1/Android.mk b/libhwc2.1/Android.mk index a6b6fba..c704838 100644 --- a/libhwc2.1/Android.mk +++ b/libhwc2.1/Android.mk @@ -28,7 +28,8 @@ LOCAL_SRC_FILES += \ ../../gs201/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp \ ../../zuma/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp \ ../../zuma/libhwc2.1/libcolormanager/DisplayColorModule.cpp \ - ../../zuma/libhwc2.1/libdevice/ExynosDeviceModule.cpp + ../../zuma/libhwc2.1/libdevice/ExynosDeviceModule.cpp \ + ../../zuma/libhwc2.1/libdevice/HistogramController.cpp LOCAL_CFLAGS += -DDISPLAY_COLOR_LIB=\"libdisplaycolor.so\" diff --git a/libhwc2.1/libdevice/HistogramController.cpp b/libhwc2.1/libdevice/HistogramController.cpp new file mode 100644 index 0000000..30b0d5d --- /dev/null +++ b/libhwc2.1/libdevice/HistogramController.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HistogramController.h" + +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) +int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo &channel, + std::shared_ptr &configPtr, + size_t &length) const { + configPtr = std::make_shared(); + struct histogram_channel_config *channelConfig = + (struct histogram_channel_config *)configPtr.get(); + + if (channelConfig == nullptr) { + ALOGE("%s: histogram failed to allocate histogram_channel_config", __func__); + return NO_MEMORY; + } + + channelConfig->roi.start_x = channel.workingConfig.roi.left; + channelConfig->roi.start_y = channel.workingConfig.roi.top; + channelConfig->roi.hsize = channel.workingConfig.roi.right - channel.workingConfig.roi.left; + channelConfig->roi.vsize = channel.workingConfig.roi.bottom - channel.workingConfig.roi.top; + channelConfig->weights.weight_r = channel.workingConfig.weights.weightR; + channelConfig->weights.weight_g = channel.workingConfig.weights.weightG; + channelConfig->weights.weight_b = channel.workingConfig.weights.weightB; + channelConfig->pos = (channel.workingConfig.samplePos == HistogramSamplePos::POST_POSTPROC) + ? POST_DQE + : PRE_DQE; + channelConfig->threshold = channel.threshold; + length = sizeof(struct histogram_channel_config); + + return NO_ERROR; +} + +int HistogramController::parseDrmEvent(void *event, uint8_t &channelId, char16_t *&buffer) const { + struct exynos_drm_histogram_channel_event *histogram_channel_event = + (struct exynos_drm_histogram_channel_event *)event; + channelId = histogram_channel_event->hist_id; + buffer = (char16_t *)&histogram_channel_event->bins; + return NO_ERROR; +} +#endif diff --git a/libhwc2.1/libdevice/HistogramController.h b/libhwc2.1/libdevice/HistogramController.h new file mode 100644 index 0000000..0cfee0e --- /dev/null +++ b/libhwc2.1/libdevice/HistogramController.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HistogramDevice.h" + +class HistogramController : public HistogramDevice { +public: + HistogramController(ExynosDisplay *display) : HistogramDevice(display, 4, {3}) {} +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) + virtual int createHistogramDrmConfigLocked(const ChannelInfo &channel, + std::shared_ptr &configPtr, + size_t &length) const override + REQUIRES(channel.channelInfoMutex); + virtual int parseDrmEvent(void *event, uint8_t &channelId, char16_t *&buffer) const override; +#endif +}; -- cgit v1.2.3 From 2ccf04c16d30086931e02220fd24ed38f341c181 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Tue, 15 Aug 2023 06:26:06 +0000 Subject: libhwc2.1: libdisplayinterface: override sendHistogramChannelIoctl If control is REQUEST, call histogram_channel_request_ioctl which creates the drm event to request the histogram data. If control is CANCEL, call histogram_channel_cancel_ioctl which frees the drm event to cancel the histogram data request. Bug: 255986866 Bug: 227384721 Test: use aidl_hist_client to test multi channel histogram Change-Id: I2d87aa7e92128ac0430ae12ad3a913fc4db960b4 Signed-off-by: Leo Chen --- .../ExynosDisplayDrmInterfaceModule.cpp | 23 ++++++++++++++++++++++ .../ExynosDisplayDrmInterfaceModule.h | 12 ++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp index 1973006..83fc581 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp @@ -51,3 +51,26 @@ ExynosPrimaryDisplayDrmInterfaceModule::ExynosPrimaryDisplayDrmInterfaceModule(E std::memcpy(mMonitorDescription.data(), panelModel.c_str(), mMonitorDescription.size()); } + +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) +int32_t ExynosPrimaryDisplayDrmInterfaceModule::sendHistogramChannelIoctl(HistogramChannelIoctl_t control, uint8_t channelId) const { + struct exynos_drm_histogram_channel_request histogramRequest; + + histogramRequest.crtc_id = mDrmCrtc->id(); + histogramRequest.hist_id = channelId; + + if (control == HistogramChannelIoctl_t::REQUEST) { + ATRACE_NAME(String8::format("requestIoctl #%u", channelId).string()); + return mDrmDevice->CallVendorIoctl(DRM_IOCTL_EXYNOS_HISTOGRAM_CHANNEL_REQUEST, + (void *)&histogramRequest); + } else if (control == HistogramChannelIoctl_t::CANCEL) { + ATRACE_NAME(String8::format("cancelIoctl #%u", channelId).string()); + return mDrmDevice->CallVendorIoctl(DRM_IOCTL_EXYNOS_HISTOGRAM_CHANNEL_CANCEL, + (void *)&histogramRequest); + } else { + ALOGE("%s: unknown control %d", __func__, (int)control); + return BAD_VALUE; + } +} +#endif diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h index 45783b1..f654d4b 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h @@ -23,10 +23,16 @@ namespace zuma { - class ExynosPrimaryDisplayDrmInterfaceModule : public gs201::ExynosPrimaryDisplayDrmInterfaceModule { +class ExynosPrimaryDisplayDrmInterfaceModule + : public gs201::ExynosPrimaryDisplayDrmInterfaceModule { public: - ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay); - }; + ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay); +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) + virtual int32_t sendHistogramChannelIoctl(HistogramChannelIoctl_t control, + uint8_t channelId) const override; +#endif +}; using ExynosExternalDisplayDrmInterfaceModule = gs201::ExynosExternalDisplayDrmInterfaceModule; -- cgit v1.2.3 From 237752a978a1b06a880ae01e323bfa2aef6c188a Mon Sep 17 00:00:00 2001 From: Safayat Ullah Date: Fri, 7 Jul 2023 10:41:33 +0000 Subject: libhwc2.1: enter ns mode after boot when smooth display off If smooth display is disabled, after reboot device will enter NS mode without a suspend-resume first if For first boot: vendor.primarydisplay.op.peak_refresh_rate=60 For later boot: persist.vendor.primarydisplay.op.peak_refresh_rate=60 Bug: 290162920 Test: The following scenarios 1. Set smooth display on/off and reboot 2. After turn on and off smooth display, device will enter ns after suspend-resume 3. Factory reset Change-Id: I7154bbdd47c1a773c2a5ddbf7395ebc875226562 Signed-off-by: Safayat Ullah --- .../libmaindisplay/ExynosPrimaryDisplayModule.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp index 36d3f93..fc2ac33 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp @@ -96,8 +96,14 @@ ExynosPrimaryDisplayModule::OperationRateManager::~OperationRateManager() {} int32_t ExynosPrimaryDisplayModule::OperationRateManager::onPeakRefreshRate(uint32_t rate) { Mutex::Autolock lock(mLock); + char rateStr[PROP_VALUE_MAX]; + std::sprintf(rateStr, "%d", rate); + OP_MANAGER_LOGD("rate=%d", rate); mDisplayPeakRefreshRate = rate; + if (property_set("persist.vendor.primarydisplay.op.peak_refresh_rate", rateStr) < 0) { + OP_MANAGER_LOGE("failed to set property persist.primarydisplay.op.peak_refresh_rate"); + } return 0; } @@ -121,6 +127,29 @@ int32_t ExynosPrimaryDisplayModule::OperationRateManager::onBrightness(uint32_t if (dbv == 0 || mDisplayLastDbv == dbv) return 0; OP_MANAGER_LOGD("dbv=%d", dbv); mDisplayDbv = dbv; + + /* + Update peak_refresh_rate from persist/vendor prop after a brightness change. + 1. Otherwise there will be NS-HS-NS switch during the onPowerMode. + 2. When constructor is called, persist property is not ready yet and returns 0. + */ + if (!mDisplayPeakRefreshRate) { + char rateStr[PROP_VALUE_MAX]; + int32_t vendorPeakRefreshRate = 0, persistPeakRefreshRate = 0; + if (property_get("persist.vendor.primarydisplay.op.peak_refresh_rate", rateStr, "0") >= 0 && + atoi(rateStr) > 0) { + persistPeakRefreshRate = atoi(rateStr); + mDisplayPeakRefreshRate = persistPeakRefreshRate; + } else { + vendorPeakRefreshRate = + property_get_int32("vendor.primarydisplay.op.peak_refresh_rate", 0); + mDisplayPeakRefreshRate = vendorPeakRefreshRate; + } + + OP_MANAGER_LOGD("peak_refresh_rate=%d[vendor: %d|persist %d]", mDisplayPeakRefreshRate, + vendorPeakRefreshRate, persistPeakRefreshRate); + } + return updateOperationRateLocked(DispOpCondition::SET_DBV); } -- cgit v1.2.3 From afbc2293eb633e0dbfac32d8e4ef712fc6aa94b8 Mon Sep 17 00:00:00 2001 From: Wiwit Rifa'i Date: Tue, 29 Aug 2023 15:11:12 +0800 Subject: libhwc2.1: don't construct string if debug log is disabled In ExynosResourceManagerModule::otfMppReordering, we still construct the debug string even though it's not used because the debug log is disabled by default. So, we should only construct the debug string if the debug log is enabled. Bug: 295892886 Test: trigger assignResource using hwc-tester & check simpleperf Test: adb shell vndservice call Exynos.HWCService 105 i32 16777216 Change-Id: Id319a2e8ac0a762f0da924597bf6b5763b839655 --- libhwc2.1/libresource/ExynosResourceManagerModule.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp index afb5efd..c2befbd 100644 --- a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp +++ b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp @@ -574,13 +574,15 @@ int32_t ExynosResourceManagerModule::otfMppReordering(ExynosDisplay *display, std::sort(otfMPPs.begin(), otfMPPs.end(), orderPolicy); - String8 after; - for (uint32_t i = 0; i < otfMPPs.size(); i++) { - ExynosMPPModule *mpp = (ExynosMPPModule *)otfMPPs[i]; - after.appendFormat("%s) ->", mpp->mName.string()); - } + if (hwcCheckDebugMessages(eDebugLoadBalancing)) { + String8 after; + for (uint32_t i = 0; i < otfMPPs.size(); i++) { + ExynosMPPModule *mpp = (ExynosMPPModule *)otfMPPs[i]; + after.appendFormat("(%s) -> ", mpp->mName.string()); + } - HDEBUGLOGD(eDebugLoadBalancing, "%s %p, %s", __func__, src.bufferHandle, after.string()); + ALOGD("%s %p, %s", __func__, src.bufferHandle, after.string()); + } return 0; } -- cgit v1.2.3 From ba7ce88f554c4e45bb18079f6ecb8820f7c14fff Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 15 Sep 2023 19:17:18 +0000 Subject: Use String8/16 c_str Bug: 295394788 Test: m libexynosdisplay Change-Id: I83f24914c9db7cab6d00256dd1b849c8cd077b4a Merged-In: I83f24914c9db7cab6d00256dd1b849c8cd077b4a --- .../libmaindisplay/ExynosPrimaryDisplayModule.cpp | 14 +++---- .../libresource/ExynosResourceManagerModule.cpp | 45 +++++++++++----------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp index 36d3f93..be36f66 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp @@ -22,14 +22,14 @@ #include "ExynosHWCHelper.h" -#define OP_MANAGER_LOGD(msg, ...) \ - ALOGD("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGD(msg, ...) \ + ALOGD("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) -#define OP_MANAGER_LOGI(msg, ...) \ - ALOGI("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGI(msg, ...) \ + ALOGI("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) -#define OP_MANAGER_LOGE(msg, ...) \ - ALOGE("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGE(msg, ...) \ + ALOGE("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) using namespace zuma; @@ -242,5 +242,5 @@ void ExynosPrimaryDisplayModule::checkPreblendingRequirement() { for (size_t i = 0; i < mLayers.size(); ++i) { count += checkPreblending(i, mLayers[i]); } - DISPLAY_LOGD(eDebugTDM, "disp(%d),cnt=%d%s", mDisplayId, count, log.string()); + DISPLAY_LOGD(eDebugTDM, "disp(%d),cnt=%d%s", mDisplayId, count, log.c_str()); } diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp index afb5efd..b53fbc7 100644 --- a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp +++ b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp @@ -59,7 +59,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno const uint32_t blkId = currentMPP->getHWBlockId(); const uint32_t axiId = currentMPP->getAXIPortId(); HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with layers", __func__, - mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); ExynosLayer *layer = (mppSrc->mSourceType == MPP_SOURCE_LAYER) ? (ExynosLayer *)mppSrc : nullptr; for (auto compLayer : display->mLayers) { @@ -72,7 +72,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno if (display->mExynosCompositionInfo.mHasCompositionLayer) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with ExynosComposition Target buffer", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); ExynosMPP *otfMPP = display->mExynosCompositionInfo.mOtfMPP; if (otfMPP) getAmounts(display, blkId, axiId, otfMPP, mppSrc, &display->mExynosCompositionInfo, @@ -82,7 +82,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno if (display->mClientCompositionInfo.mHasCompositionLayer) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with ClientComposition Target buffer", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); ExynosMPP *otfMPP = display->mClientCompositionInfo.mOtfMPP; if (otfMPP) getAmounts(display, blkId, axiId, otfMPP, mppSrc, &display->mClientCompositionInfo, @@ -101,18 +101,18 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno display->mDisplayTDMInfo[TDMInfoIdx].getAvailableAmount(attr->first).totalAmount; HDEBUGLOGD(eDebugTDM, "%s, layer[%p] -> %s attr[%s],ls=%d,accumulated:%d,current:%d,total: %d", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string(), - attr->second.name.string(), loadSharing, accumulatedAmount[attr->first], + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str(), + attr->second.name.c_str(), loadSharing, accumulatedAmount[attr->first], currentAmount, totalAmount); if (accumulatedAmount[attr->first] + currentAmount > totalAmount) { HDEBUGLOGD(eDebugTDM, "%s, %s could not assigned by attr[%s]", __func__, - currentMPP->mName.string(), attr->second.name.string()); + currentMPP->mName.c_str(), attr->second.name.c_str()); return false; } } HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s successfully", __func__, - mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); return true; } @@ -136,7 +136,7 @@ bool ExynosResourceManagerModule::isHWResourceAvailable(ExynosDisplay *display, if (overlappedLayers.size()) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, check its overlapped layers(%zu) status", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string(), + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str(), overlappedLayers.size()); for (auto &overlappedLayer : overlappedLayers) { @@ -172,16 +172,15 @@ void ExynosResourceManagerModule::setupHWResource(const tdm_attr_t &tdmAttrId, c tdmAttrId); if (addedDisplay == nullptr) { HDEBUGLOGD(eDebugTDM, "(%s=>%s) : %s amount is updated to %d", - resourceIdx.toString8().string(), iter->first.toString8().string(), - name.string(), amount); + resourceIdx.toString8().c_str(), iter->first.toString8().c_str(), + name.c_str(), amount); } else { - HDEBUGLOGD(eDebugTDM, - "(%s=>%s) : hwResource.totalAmount=%d %s amount is updated to %d", - resourceIdx.toString8().string(), iter->first.toString8().string(), - hwResource.totalAmount, name.string(), amount); + HDEBUGLOGD(eDebugTDM, "(%s=>%s) : hwResource.totalAmount=%d %s amount is updated to %d", + resourceIdx.toString8().c_str(), iter->first.toString8().c_str(), + hwResource.totalAmount, name.c_str(), amount); } } else { - ALOGW("(%s): cannot find resource for %s", resourceIdx.toString8().string(), name.string()); + ALOGW("(%s): cannot find resource for %s", resourceIdx.toString8().c_str(), name.c_str()); } } @@ -231,7 +230,7 @@ uint32_t ExynosResourceManagerModule::setDisplaysTDMInfo() .getAvailableAmount(attr->first) .totalAmount; HDEBUGLOGD(eDebugTDM, "%s : [%s] display:%d,block:%d, amount : %d(%s)", - __func__, attr->second.name.string(), display->mType, + __func__, attr->second.name.c_str(), display->mType, blockId->first, amount, display->isEnabled() ? "used" : "not used"); } else { @@ -242,7 +241,7 @@ uint32_t ExynosResourceManagerModule::setDisplaysTDMInfo() .totalAmount; HDEBUGLOGD(eDebugTDM, "%s : [%s] display:%d,block:%d,axi:%d, amount:%d(%s)", - __func__, attr->second.name.string(), display->mType, + __func__, attr->second.name.c_str(), display->mType, blockId->first, axi->first, amount, display->isEnabled() ? "used" : "not used"); } @@ -558,7 +557,7 @@ int32_t ExynosResourceManagerModule::otfMppReordering(ExynosDisplay *display, } HDEBUGLOGD(eDebugLoadBalancing, "%s: %s is assigned (AFBC:%d, WCG:%d), is %s", __func__, - mpp->mName.string(), isAFBC, isWCG, + mpp->mName.c_str(), isAFBC, isWCG, (mppSrc->mSourceType == MPP_SOURCE_LAYER) ? "Layer" : "Client Target"); usedBlockCount[bId]++; usedAXIPortCount[aId]++; @@ -577,10 +576,10 @@ int32_t ExynosResourceManagerModule::otfMppReordering(ExynosDisplay *display, String8 after; for (uint32_t i = 0; i < otfMPPs.size(); i++) { ExynosMPPModule *mpp = (ExynosMPPModule *)otfMPPs[i]; - after.appendFormat("%s) ->", mpp->mName.string()); + after.appendFormat("%s) ->", mpp->mName.c_str()); } - HDEBUGLOGD(eDebugLoadBalancing, "%s %p, %s", __func__, src.bufferHandle, after.string()); + HDEBUGLOGD(eDebugLoadBalancing, "%s %p, %s", __func__, src.bufferHandle, after.c_str()); return 0; } @@ -615,12 +614,12 @@ uint32_t ExynosResourceManagerModule::getAmounts(ExynosDisplay *display, if (currentBlockId == blockId && isOverlapped(display, curSrc, compSrc)) { String8 log; if (hwcCheckDebugMessages(eDebugTDM)) { - log.appendFormat("%s", compOtfMPP->mName.string()); + log.appendFormat("%s", compOtfMPP->mName.c_str()); } for (auto attr = HWAttrs.begin(); attr != HWAttrs.end(); attr++) { uint32_t compareAmount = compSrc->getHWResourceAmount(attr->first); if (hwcCheckDebugMessages(eDebugTDM)) { - log.appendFormat(", attr %s DPUF-%d(+ %d)", attr->second.name.string(), + log.appendFormat(", attr %s DPUF-%d(+ %d)", attr->second.name.c_str(), DPUFAmounts[attr->first], compareAmount); } DPUFAmounts[attr->first] += compareAmount; @@ -631,7 +630,7 @@ uint32_t ExynosResourceManagerModule::getAmounts(ExynosDisplay *display, AXIAmounts[attr->first] += compareAmount; } } - HDEBUGLOGD(eDebugTDM, "%s %s", __func__, log.string()); + HDEBUGLOGD(eDebugTDM, "%s %s", __func__, log.c_str()); } return 0; -- cgit v1.2.3 From 684102a39b1531d9e558cc8d57882f703a703d5d Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 15 Sep 2023 19:17:18 +0000 Subject: Use String8/16 c_str Bug: 295394788 Test: m libexynosdisplay Change-Id: I83f24914c9db7cab6d00256dd1b849c8cd077b4a --- .../ExynosDisplayDrmInterfaceModule.cpp | 4 +- .../libmaindisplay/ExynosPrimaryDisplayModule.cpp | 14 +++---- .../libresource/ExynosResourceManagerModule.cpp | 45 +++++++++++----------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp index 83fc581..987cd90 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp @@ -61,11 +61,11 @@ int32_t ExynosPrimaryDisplayDrmInterfaceModule::sendHistogramChannelIoctl(Histog histogramRequest.hist_id = channelId; if (control == HistogramChannelIoctl_t::REQUEST) { - ATRACE_NAME(String8::format("requestIoctl #%u", channelId).string()); + ATRACE_NAME(String8::format("requestIoctl #%u", channelId).c_str()); return mDrmDevice->CallVendorIoctl(DRM_IOCTL_EXYNOS_HISTOGRAM_CHANNEL_REQUEST, (void *)&histogramRequest); } else if (control == HistogramChannelIoctl_t::CANCEL) { - ATRACE_NAME(String8::format("cancelIoctl #%u", channelId).string()); + ATRACE_NAME(String8::format("cancelIoctl #%u", channelId).c_str()); return mDrmDevice->CallVendorIoctl(DRM_IOCTL_EXYNOS_HISTOGRAM_CHANNEL_CANCEL, (void *)&histogramRequest); } else { diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp index fc2ac33..3f3439f 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp @@ -22,14 +22,14 @@ #include "ExynosHWCHelper.h" -#define OP_MANAGER_LOGD(msg, ...) \ - ALOGD("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGD(msg, ...) \ + ALOGD("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) -#define OP_MANAGER_LOGI(msg, ...) \ - ALOGI("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGI(msg, ...) \ + ALOGI("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) -#define OP_MANAGER_LOGE(msg, ...) \ - ALOGE("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGE(msg, ...) \ + ALOGE("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) using namespace zuma; @@ -271,5 +271,5 @@ void ExynosPrimaryDisplayModule::checkPreblendingRequirement() { for (size_t i = 0; i < mLayers.size(); ++i) { count += checkPreblending(i, mLayers[i]); } - DISPLAY_LOGD(eDebugTDM, "disp(%d),cnt=%d%s", mDisplayId, count, log.string()); + DISPLAY_LOGD(eDebugTDM, "disp(%d),cnt=%d%s", mDisplayId, count, log.c_str()); } diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp index c2befbd..46c17fb 100644 --- a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp +++ b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp @@ -59,7 +59,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno const uint32_t blkId = currentMPP->getHWBlockId(); const uint32_t axiId = currentMPP->getAXIPortId(); HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with layers", __func__, - mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); ExynosLayer *layer = (mppSrc->mSourceType == MPP_SOURCE_LAYER) ? (ExynosLayer *)mppSrc : nullptr; for (auto compLayer : display->mLayers) { @@ -72,7 +72,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno if (display->mExynosCompositionInfo.mHasCompositionLayer) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with ExynosComposition Target buffer", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); ExynosMPP *otfMPP = display->mExynosCompositionInfo.mOtfMPP; if (otfMPP) getAmounts(display, blkId, axiId, otfMPP, mppSrc, &display->mExynosCompositionInfo, @@ -82,7 +82,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno if (display->mClientCompositionInfo.mHasCompositionLayer) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with ClientComposition Target buffer", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); ExynosMPP *otfMPP = display->mClientCompositionInfo.mOtfMPP; if (otfMPP) getAmounts(display, blkId, axiId, otfMPP, mppSrc, &display->mClientCompositionInfo, @@ -101,18 +101,18 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno display->mDisplayTDMInfo[TDMInfoIdx].getAvailableAmount(attr->first).totalAmount; HDEBUGLOGD(eDebugTDM, "%s, layer[%p] -> %s attr[%s],ls=%d,accumulated:%d,current:%d,total: %d", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string(), - attr->second.name.string(), loadSharing, accumulatedAmount[attr->first], + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str(), + attr->second.name.c_str(), loadSharing, accumulatedAmount[attr->first], currentAmount, totalAmount); if (accumulatedAmount[attr->first] + currentAmount > totalAmount) { HDEBUGLOGD(eDebugTDM, "%s, %s could not assigned by attr[%s]", __func__, - currentMPP->mName.string(), attr->second.name.string()); + currentMPP->mName.c_str(), attr->second.name.c_str()); return false; } } HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s successfully", __func__, - mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); return true; } @@ -136,7 +136,7 @@ bool ExynosResourceManagerModule::isHWResourceAvailable(ExynosDisplay *display, if (overlappedLayers.size()) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, check its overlapped layers(%zu) status", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string(), + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str(), overlappedLayers.size()); for (auto &overlappedLayer : overlappedLayers) { @@ -172,16 +172,15 @@ void ExynosResourceManagerModule::setupHWResource(const tdm_attr_t &tdmAttrId, c tdmAttrId); if (addedDisplay == nullptr) { HDEBUGLOGD(eDebugTDM, "(%s=>%s) : %s amount is updated to %d", - resourceIdx.toString8().string(), iter->first.toString8().string(), - name.string(), amount); + resourceIdx.toString8().c_str(), iter->first.toString8().c_str(), + name.c_str(), amount); } else { - HDEBUGLOGD(eDebugTDM, - "(%s=>%s) : hwResource.totalAmount=%d %s amount is updated to %d", - resourceIdx.toString8().string(), iter->first.toString8().string(), - hwResource.totalAmount, name.string(), amount); + HDEBUGLOGD(eDebugTDM, "(%s=>%s) : hwResource.totalAmount=%d %s amount is updated to %d", + resourceIdx.toString8().c_str(), iter->first.toString8().c_str(), + hwResource.totalAmount, name.c_str(), amount); } } else { - ALOGW("(%s): cannot find resource for %s", resourceIdx.toString8().string(), name.string()); + ALOGW("(%s): cannot find resource for %s", resourceIdx.toString8().c_str(), name.c_str()); } } @@ -231,7 +230,7 @@ uint32_t ExynosResourceManagerModule::setDisplaysTDMInfo() .getAvailableAmount(attr->first) .totalAmount; HDEBUGLOGD(eDebugTDM, "%s : [%s] display:%d,block:%d, amount : %d(%s)", - __func__, attr->second.name.string(), display->mType, + __func__, attr->second.name.c_str(), display->mType, blockId->first, amount, display->isEnabled() ? "used" : "not used"); } else { @@ -242,7 +241,7 @@ uint32_t ExynosResourceManagerModule::setDisplaysTDMInfo() .totalAmount; HDEBUGLOGD(eDebugTDM, "%s : [%s] display:%d,block:%d,axi:%d, amount:%d(%s)", - __func__, attr->second.name.string(), display->mType, + __func__, attr->second.name.c_str(), display->mType, blockId->first, axi->first, amount, display->isEnabled() ? "used" : "not used"); } @@ -558,7 +557,7 @@ int32_t ExynosResourceManagerModule::otfMppReordering(ExynosDisplay *display, } HDEBUGLOGD(eDebugLoadBalancing, "%s: %s is assigned (AFBC:%d, WCG:%d), is %s", __func__, - mpp->mName.string(), isAFBC, isWCG, + mpp->mName.c_str(), isAFBC, isWCG, (mppSrc->mSourceType == MPP_SOURCE_LAYER) ? "Layer" : "Client Target"); usedBlockCount[bId]++; usedAXIPortCount[aId]++; @@ -578,10 +577,10 @@ int32_t ExynosResourceManagerModule::otfMppReordering(ExynosDisplay *display, String8 after; for (uint32_t i = 0; i < otfMPPs.size(); i++) { ExynosMPPModule *mpp = (ExynosMPPModule *)otfMPPs[i]; - after.appendFormat("(%s) -> ", mpp->mName.string()); + after.appendFormat("(%s) -> ", mpp->mName.c_str()); } - ALOGD("%s %p, %s", __func__, src.bufferHandle, after.string()); + ALOGD("%s %p, %s", __func__, src.bufferHandle, after.c_str()); } return 0; @@ -617,12 +616,12 @@ uint32_t ExynosResourceManagerModule::getAmounts(ExynosDisplay *display, if (currentBlockId == blockId && isOverlapped(display, curSrc, compSrc)) { String8 log; if (hwcCheckDebugMessages(eDebugTDM)) { - log.appendFormat("%s", compOtfMPP->mName.string()); + log.appendFormat("%s", compOtfMPP->mName.c_str()); } for (auto attr = HWAttrs.begin(); attr != HWAttrs.end(); attr++) { uint32_t compareAmount = compSrc->getHWResourceAmount(attr->first); if (hwcCheckDebugMessages(eDebugTDM)) { - log.appendFormat(", attr %s DPUF-%d(+ %d)", attr->second.name.string(), + log.appendFormat(", attr %s DPUF-%d(+ %d)", attr->second.name.c_str(), DPUFAmounts[attr->first], compareAmount); } DPUFAmounts[attr->first] += compareAmount; @@ -633,7 +632,7 @@ uint32_t ExynosResourceManagerModule::getAmounts(ExynosDisplay *display, AXIAmounts[attr->first] += compareAmount; } } - HDEBUGLOGD(eDebugTDM, "%s %s", __func__, log.string()); + HDEBUGLOGD(eDebugTDM, "%s %s", __func__, log.c_str()); } return 0; -- cgit v1.2.3 From 265e1f7c97a99311fb4b88976aea54c2e555bd69 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 15 Sep 2023 20:19:39 +0000 Subject: Use String8/16 c_str Bug: 295394788 Test: m libexynosdisplay Change-Id: I83f24914c9db7cab6d00256dd1b849c8cd077b4a Merged-In: I83f24914c9db7cab6d00256dd1b849c8cd077b4a --- .../libmaindisplay/ExynosPrimaryDisplayModule.cpp | 12 ++++---- .../libresource/ExynosResourceManagerModule.cpp | 32 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp index da18f85..ba959ea 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp @@ -20,14 +20,14 @@ #include "ExynosHWCHelper.h" -#define OP_MANAGER_LOGD(msg, ...) \ - ALOGD("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGD(msg, ...) \ + ALOGD("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) -#define OP_MANAGER_LOGI(msg, ...) \ - ALOGI("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGI(msg, ...) \ + ALOGI("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) -#define OP_MANAGER_LOGE(msg, ...) \ - ALOGE("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.string(), __func__, \ +#define OP_MANAGER_LOGE(msg, ...) \ + ALOGE("[%s] OperationRateManager::%s:" msg, mDisplay->mDisplayName.c_str(), __func__, \ ##__VA_ARGS__) using namespace zuma; diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp index 9f9bba3..6024f41 100644 --- a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp +++ b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp @@ -48,7 +48,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno std::map accumulatedAmount; uint32_t currentBlockId = currentMPP->getHWBlockId(); HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with layers", __func__, - mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); for (auto layer : display->mLayers) { ExynosMPP *otfMPP = layer->mOtfMPP; if (!otfMPP) continue; @@ -58,7 +58,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno if (display->mExynosCompositionInfo.mHasCompositionLayer) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with ExynosComposition Target buffer", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); ExynosMPP *otfMPP = display->mExynosCompositionInfo.mOtfMPP; if (otfMPP) getAmounts(display, otfMPP, currentBlockId, &display->mExynosCompositionInfo, mppSrc, @@ -68,7 +68,7 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno if (display->mClientCompositionInfo.mHasCompositionLayer) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with ClientComposition Target buffer", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); ExynosMPP *otfMPP = display->mClientCompositionInfo.mOtfMPP; if (otfMPP) getAmounts(display, otfMPP, currentBlockId, &display->mClientCompositionInfo, mppSrc, @@ -81,18 +81,18 @@ bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, Exyno amount = display->mDisplayTDMInfo[currentBlockId].getAvailableAmount(attr->first); HDEBUGLOGD(eDebugTDM, "%s, layer[%p] -> %s attr[%s], accumulated : %d, current : %d, total : %d", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string(), - attr->second.string(), accumulatedAmount[attr->first], currentAmount, + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str(), + attr->second.c_str(), accumulatedAmount[attr->first], currentAmount, amount.totalAmount); if (accumulatedAmount[attr->first] + currentAmount > amount.totalAmount) { HDEBUGLOGD(eDebugTDM, "%s, %s could not assigned by attr[%s]", __func__, - currentMPP->mName.string(), attr->second.string()); + currentMPP->mName.c_str(), attr->second.c_str()); return false; } } HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s successfully", __func__, - mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string()); + mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str()); return true; } @@ -116,7 +116,7 @@ bool ExynosResourceManagerModule::isHWResourceAvailable(ExynosDisplay *display, if (overlappedLayers.size()) { HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, check its overlapped layers(%zu) status", - __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.string(), + __func__, mppSrc->mSrcImg.bufferHandle, currentMPP->mName.c_str(), overlappedLayers.size()); for (auto &overlappedLayer : overlappedLayers) { @@ -175,7 +175,7 @@ uint32_t ExynosResourceManagerModule::setDisplaysTDMInfo() amount.totalAmount = total; primaryDisplay->mDisplayTDMInfo[blockId->first].initTDMInfo(amount, attr->first); HDEBUGLOGD(eDebugTDM, "Primary display (block : %d) : %s amount is updated to %d", - blockId->first, attr->second.string(), amount.totalAmount); + blockId->first, attr->second.c_str(), amount.totalAmount); } } } @@ -190,7 +190,7 @@ uint32_t ExynosResourceManagerModule::setDisplaysTDMInfo() amount = display->mDisplayTDMInfo[blockId->first].getAvailableAmount( attr->first); HDEBUGLOGD(eDebugTDM, "%s : [%s] display: %d, block : %d, amount : %d(%s)", - __func__, attr->second.string(), display->mType, blockId->first, + __func__, attr->second.c_str(), display->mType, blockId->first, amount.totalAmount, display->isEnabled() ? "used" : "not used"); } } @@ -509,7 +509,7 @@ int32_t ExynosResourceManagerModule::otfMppReordering(ExynosDisplay *display, } HDEBUGLOGD(eDebugLoadBalancing, "%s: %s is assigned (AFBC:%d, WCG:%d), is %s", __func__, - mpp->mName.string(), isAFBC, isWCG, + mpp->mName.c_str(), isAFBC, isWCG, (mppSrc->mSourceType == MPP_SOURCE_LAYER) ? "Layer" : "Client Target"); usedBlockCount[bId]++; usedAXIPortCount[aId]++; @@ -528,10 +528,10 @@ int32_t ExynosResourceManagerModule::otfMppReordering(ExynosDisplay *display, String8 after; for (uint32_t i = 0; i < otfMPPs.size(); i++) { ExynosMPPModule *mpp = (ExynosMPPModule *)otfMPPs[i]; - after.appendFormat("%s) ->", mpp->mName.string()); + after.appendFormat("%s) ->", mpp->mName.c_str()); } - HDEBUGLOGD(eDebugLoadBalancing, "%s %p, %s", __func__, src.bufferHandle, after.string()); + HDEBUGLOGD(eDebugLoadBalancing, "%s %p, %s", __func__, src.bufferHandle, after.c_str()); return 0; } @@ -564,17 +564,17 @@ uint32_t ExynosResourceManagerModule::getAmounts(ExynosDisplay *display, ExynosM if ((currentBlockId == blockId) && (isOverlapped(display, current, compare))) { String8 log; if (hwcCheckDebugMessages(eDebugTDM)) { - log.appendFormat("%s", otfMPP->mName.string()); + log.appendFormat("%s", otfMPP->mName.c_str()); } for (auto attr = HWAttrs.begin(); attr != HWAttrs.end(); attr++) { uint32_t compareAmount = compare->getHWResourceAmount(attr->first); if (hwcCheckDebugMessages(eDebugTDM)) { - log.appendFormat(", attr %s %d(+ %d)", attr->second.string(), amounts[attr->first], + log.appendFormat(", attr %s %d(+ %d)", attr->second.c_str(), amounts[attr->first], compareAmount); } amounts[attr->first] += compareAmount; } - HDEBUGLOGD(eDebugTDM, "%s %s", __func__, log.string()); + HDEBUGLOGD(eDebugTDM, "%s %s", __func__, log.c_str()); } return 0; -- cgit v1.2.3 From 578af9e67c4bcc533d0d741c7e9d2054cdfb03bb Mon Sep 17 00:00:00 2001 From: Wiwit Rifa'i Date: Thu, 14 Sep 2023 16:15:14 +0800 Subject: libhwc2.1: change small std::map to std::array Constructing and accessing a map are more expensive than a fixed-size array for small container with small indices. Bug: 295892886 Test: trigger assignResource using hwc-tester & check simpleperf Change-Id: I9b059a4de276f9906e9361dff6520628965054ae --- libhwc2.1/libresource/ExynosResourceManagerModule.cpp | 15 +++++++-------- libhwc2.1/libresource/ExynosResourceManagerModule.h | 11 +++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp index c2befbd..859eb48 100644 --- a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp +++ b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp @@ -54,8 +54,8 @@ ExynosResourceManagerModule::~ExynosResourceManagerModule() {} bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, ExynosMPP *currentMPP, ExynosMPPSource *mppSrc) { - std::map accumulatedDPUFAmount; - std::map accumulatedDPUFAXIAmount; + std::array accumulatedDPUFAmount{}; + std::array accumulatedDPUFAXIAmount{}; const uint32_t blkId = currentMPP->getHWBlockId(); const uint32_t axiId = currentMPP->getAXIPortId(); HDEBUGLOGD(eDebugTDM, "%s : %p trying to assign to %s, compare with layers", __func__, @@ -606,12 +606,11 @@ bool ExynosResourceManagerModule::isOverlapped(ExynosDisplay *display, ExynosMPP return false; } -uint32_t ExynosResourceManagerModule::getAmounts(ExynosDisplay *display, - uint32_t currentBlockId, uint32_t currentAXIId, - ExynosMPP *compOtfMPP, - ExynosMPPSource *curSrc, ExynosMPPSource *compSrc, - std::map &DPUFAmounts, - std::map &AXIAmounts) { +uint32_t ExynosResourceManagerModule::getAmounts(ExynosDisplay* display, uint32_t currentBlockId, + uint32_t currentAXIId, ExynosMPP* compOtfMPP, + ExynosMPPSource* curSrc, ExynosMPPSource* compSrc, + std::array& DPUFAmounts, + std::array& AXIAmounts) { const uint32_t blockId = compOtfMPP->getHWBlockId(); const uint32_t AXIId = compOtfMPP->getAXIPortId(); if (currentBlockId == blockId && isOverlapped(display, curSrc, compSrc)) { diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.h b/libhwc2.1/libresource/ExynosResourceManagerModule.h index eb20259..cf6c4fe 100644 --- a/libhwc2.1/libresource/ExynosResourceManagerModule.h +++ b/libhwc2.1/libresource/ExynosResourceManagerModule.h @@ -37,12 +37,11 @@ class ExynosResourceManagerModule : public gs201::ExynosResourceManagerModule { bool isOverlapped(ExynosDisplay *display, ExynosMPPSource *current, ExynosMPPSource *compare); - uint32_t getAmounts(ExynosDisplay *display, - uint32_t currentBlockId, uint32_t currentAXIId, - ExynosMPP *compOtfMPP, - ExynosMPPSource *curSrc, ExynosMPPSource *compSrc, - std::map &DPUFAmounts, - std::map &AXIAmounts); + uint32_t getAmounts(ExynosDisplay* display, uint32_t currentBlockId, uint32_t currentAXIId, + ExynosMPP* compOtfMPP, ExynosMPPSource* curSrc, + ExynosMPPSource* compSrc, + std::array& DPUFAmounts, + std::array& AXIAmounts); bool checkTDMResource(ExynosDisplay *display, ExynosMPP *currentMPP, ExynosMPPSource *mppSrc); const std::map *mHWResourceTables = nullptr; -- cgit v1.2.3 From e67fb287bacdb0ba9666d8f773cae4b1d6bcb52c Mon Sep 17 00:00:00 2001 From: Wiwit Rifa'i Date: Thu, 14 Sep 2023 17:14:18 +0800 Subject: libhwc2.1: avoid finding std::map element twice We should not use std::map::at() after calling std::map::find() for the same key. Otherwise, it would find the same element twice and it's unnecessary. Bug: 295892886 Test: trigger assignResource using hwc-tester & check simpleperf Change-Id: I971965a8b2a84120c989e55b87e223225ea32456 --- .../libresource/ExynosResourceManagerModule.cpp | 51 +++++++--------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp index 859eb48..79653b4 100644 --- a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp +++ b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp @@ -280,6 +280,11 @@ uint32_t ExynosResourceManagerModule::initDisplaysTDMInfo() return 0; } +uint32_t getSramAmount(tdm_attr_t attr, uint32_t formatProperty, lbWidthIndex_t widthIndex) { + auto it = sramAmountMap.find(sramAmountParams(attr, formatProperty, widthIndex)); + return (it != sramAmountMap.end()) ? it->second : 0; +} + uint32_t ExynosResourceManagerModule::calculateHWResourceAmount(ExynosDisplay *display, ExynosMPPSource *mppSrc) { @@ -316,7 +321,7 @@ uint32_t ExynosResourceManagerModule::calculateHWResourceAmount(ExynosDisplay *d /** To find index **/ uint32_t formatIndex = 0; - lbWidthIndex_t widthIndex; + lbWidthIndex_t widthIndex = LB_W_3073_INF; auto findWidthIndex = [&](int32_t w) -> lbWidthIndex_t { for (auto it = LB_WIDTH_INDEX_MAP.begin(); it != LB_WIDTH_INDEX_MAP.end(); it++) { @@ -336,27 +341,13 @@ uint32_t ExynosResourceManagerModule::calculateHWResourceAmount(ExynosDisplay *d int32_t width_y = pixel_align(width + kSramSBWCRotWidthAlign, kSramSBWCRotWidthAlign); int32_t width_c = pixel_align(width / 2 + kSramSBWCRotWidthAlign, kSramSBWCRotWidthAlign); - widthIndex = findWidthIndex(width_y); - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_ROT_90, SBWC_Y, widthIndex)) != - sramAmountMap.end()) - SRAMtotal += - sramAmountMap.at(sramAmountParams(TDM_ATTR_ROT_90, SBWC_Y, widthIndex)); - widthIndex = findWidthIndex(width_c * 2); - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_ROT_90, SBWC_UV, widthIndex)) != - sramAmountMap.end()) - SRAMtotal += - sramAmountMap.at(sramAmountParams(TDM_ATTR_ROT_90, SBWC_UV, widthIndex)); + SRAMtotal += getSramAmount(TDM_ATTR_ROT_90, SBWC_Y, findWidthIndex(width_y)); + SRAMtotal += getSramAmount(TDM_ATTR_ROT_90, SBWC_UV, findWidthIndex(width_c * 2)); } else { /* sramAmountMap has SRAM for both Y and UV */ widthIndex = findWidthIndex(width); - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_ROT_90, NON_SBWC_Y | formatBPP, - widthIndex)) != sramAmountMap.end()) - SRAMtotal += sramAmountMap.at( - sramAmountParams(TDM_ATTR_ROT_90, NON_SBWC_Y | formatBPP, widthIndex)); - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_ROT_90, NON_SBWC_UV | formatBPP, - widthIndex)) != sramAmountMap.end()) - SRAMtotal += sramAmountMap.at( - sramAmountParams(TDM_ATTR_ROT_90, NON_SBWC_UV | formatBPP, widthIndex)); + SRAMtotal += getSramAmount(TDM_ATTR_ROT_90, NON_SBWC_Y | formatBPP, widthIndex); + SRAMtotal += getSramAmount(TDM_ATTR_ROT_90, NON_SBWC_UV | formatBPP, widthIndex); } HDEBUGLOGD(eDebugTDM, "+ rotation : %d", SRAMtotal); } else { @@ -376,21 +367,14 @@ uint32_t ExynosResourceManagerModule::calculateHWResourceAmount(ExynosDisplay *d /* AFBC amount */ if (compressType == COMP_TYPE_AFBC) { formatIndex = (isFormatRgb(format) ? RGB : 0) | formatBPP; - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_AFBC, formatIndex, widthIndex)) != - sramAmountMap.end()) - SRAMtotal += - sramAmountMap.at(sramAmountParams(TDM_ATTR_AFBC, formatIndex, widthIndex)); + SRAMtotal += getSramAmount(TDM_ATTR_AFBC, formatIndex, widthIndex); HDEBUGLOGD(eDebugTDM, "+ AFBC : %d", SRAMtotal); } /* SBWC amount */ if (compressType == COMP_TYPE_SBWC) { - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_SBWC, SBWC_Y, widthIndex)) != - sramAmountMap.end()) - SRAMtotal += sramAmountMap.at(sramAmountParams(TDM_ATTR_SBWC, SBWC_Y, widthIndex)); - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_SBWC, SBWC_UV, widthIndex)) != - sramAmountMap.end()) - SRAMtotal += sramAmountMap.at(sramAmountParams(TDM_ATTR_SBWC, SBWC_UV, widthIndex)); + SRAMtotal += getSramAmount(TDM_ATTR_SBWC, SBWC_Y, widthIndex); + SRAMtotal += getSramAmount(TDM_ATTR_SBWC, SBWC_UV, widthIndex); HDEBUGLOGD(eDebugTDM, "+ SBWC : %d", SRAMtotal); } } @@ -398,9 +382,7 @@ uint32_t ExynosResourceManagerModule::calculateHWResourceAmount(ExynosDisplay *d /* ITP (CSC) amount */ if (isFormatYUV(format)) { /** ITP has no size difference, Use width index as LB_W_3073_INF **/ - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_ITP, formatBPP, LB_W_3073_INF)) != - sramAmountMap.end()) - SRAMtotal += sramAmountMap.at(sramAmountParams(TDM_ATTR_ITP, formatBPP, LB_W_3073_INF)); + SRAMtotal += getSramAmount(TDM_ATTR_ITP, formatBPP, LB_W_3073_INF); HDEBUGLOGD(eDebugTDM, "+ YUV : %d", SRAMtotal); } @@ -425,10 +407,7 @@ uint32_t ExynosResourceManagerModule::calculateHWResourceAmount(ExynosDisplay *d formatIndex = FORMAT_YUV_MASK; /** Scale has no size difference, Use width index as LB_W_3073_INF **/ - if (sramAmountMap.find(sramAmountParams(TDM_ATTR_SCALE, formatIndex, LB_W_3073_INF)) != - sramAmountMap.end()) - SRAMtotal += - sramAmountMap.at(sramAmountParams(TDM_ATTR_SCALE, formatIndex, LB_W_3073_INF)); + SRAMtotal += getSramAmount(TDM_ATTR_SCALE, formatIndex, LB_W_3073_INF); HDEBUGLOGD(eDebugTDM, "+ Scale : %d", SRAMtotal); } -- cgit v1.2.3 From 83c9109add0dc05b67ab7ea99400c698a2339343 Mon Sep 17 00:00:00 2001 From: Wiwit Rifa'i Date: Mon, 18 Sep 2023 21:00:28 +0800 Subject: clang-format: add IncludeBlocks Preserve & PointerAlignment Left We usually follow the same code style from framework/native. This will add some new rules that have been added to framework/native but not added here yet. Bug: 295892886 Test: git-clang-format Change-Id: I2a33fb9cbb8b4b9471d78de7708e9f4087b1e48d --- .clang-format | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.clang-format b/.clang-format index 03af56d..f63f670 100644 --- a/.clang-format +++ b/.clang-format @@ -11,3 +11,7 @@ ContinuationIndentWidth: 8 IndentWidth: 4 PenaltyBreakBeforeFirstCallParameter: 100000 SpacesBeforeTrailingComments: 1 +IncludeBlocks: Preserve + +DerivePointerAlignment: false +PointerAlignment: Left -- cgit v1.2.3 From 61ab65c104a75f0e09e34bad4356791a2c901914 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Fri, 6 Oct 2023 08:14:21 +0000 Subject: libhwc2.1: Apply the clang-format for HistogramController Bug: 299410182 Test: Build pass Change-Id: Ic1ddf8cc3c08b3b9a3c5b35f337d97bed2cdbc34 Signed-off-by: Leo Chen --- libhwc2.1/libdevice/HistogramController.cpp | 18 +++++++++--------- libhwc2.1/libdevice/HistogramController.h | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libhwc2.1/libdevice/HistogramController.cpp b/libhwc2.1/libdevice/HistogramController.cpp index 30b0d5d..ac616fb 100644 --- a/libhwc2.1/libdevice/HistogramController.cpp +++ b/libhwc2.1/libdevice/HistogramController.cpp @@ -18,12 +18,12 @@ // TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. #if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) -int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo &channel, - std::shared_ptr &configPtr, - size_t &length) const { +int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo& channel, + std::shared_ptr& configPtr, + size_t& length) const { configPtr = std::make_shared(); - struct histogram_channel_config *channelConfig = - (struct histogram_channel_config *)configPtr.get(); + struct histogram_channel_config* channelConfig = + (struct histogram_channel_config*)configPtr.get(); if (channelConfig == nullptr) { ALOGE("%s: histogram failed to allocate histogram_channel_config", __func__); @@ -46,11 +46,11 @@ int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo &chann return NO_ERROR; } -int HistogramController::parseDrmEvent(void *event, uint8_t &channelId, char16_t *&buffer) const { - struct exynos_drm_histogram_channel_event *histogram_channel_event = - (struct exynos_drm_histogram_channel_event *)event; +int HistogramController::parseDrmEvent(void* event, uint8_t& channelId, char16_t*& buffer) const { + struct exynos_drm_histogram_channel_event* histogram_channel_event = + (struct exynos_drm_histogram_channel_event*)event; channelId = histogram_channel_event->hist_id; - buffer = (char16_t *)&histogram_channel_event->bins; + buffer = (char16_t*)&histogram_channel_event->bins; return NO_ERROR; } #endif diff --git a/libhwc2.1/libdevice/HistogramController.h b/libhwc2.1/libdevice/HistogramController.h index 0cfee0e..224d19e 100644 --- a/libhwc2.1/libdevice/HistogramController.h +++ b/libhwc2.1/libdevice/HistogramController.h @@ -18,13 +18,13 @@ class HistogramController : public HistogramDevice { public: - HistogramController(ExynosDisplay *display) : HistogramDevice(display, 4, {3}) {} + HistogramController(ExynosDisplay* display) : HistogramDevice(display, 4, {3}) {} // TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. #if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) - virtual int createHistogramDrmConfigLocked(const ChannelInfo &channel, - std::shared_ptr &configPtr, - size_t &length) const override + virtual int createHistogramDrmConfigLocked(const ChannelInfo& channel, + std::shared_ptr& configPtr, + size_t& length) const override REQUIRES(channel.channelInfoMutex); - virtual int parseDrmEvent(void *event, uint8_t &channelId, char16_t *&buffer) const override; + virtual int parseDrmEvent(void* event, uint8_t& channelId, char16_t*& buffer) const override; #endif }; -- cgit v1.2.3 From fe2cdb7b3d0718e4a6792efc31954b74f6cdf0f0 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Fri, 6 Oct 2023 08:21:19 +0000 Subject: libhwc2.1: add missing pragma once for HistogramController Bug: 299410182 Test: Build pass Change-Id: I394efeff5735e998645bf3ea08aa024876eca4e1 Signed-off-by: Leo Chen --- libhwc2.1/libdevice/HistogramController.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libhwc2.1/libdevice/HistogramController.h b/libhwc2.1/libdevice/HistogramController.h index 224d19e..b5e8dac 100644 --- a/libhwc2.1/libdevice/HistogramController.h +++ b/libhwc2.1/libdevice/HistogramController.h @@ -14,6 +14,8 @@ * limitations under the License. */ +#pragma once + #include "HistogramDevice.h" class HistogramController : public HistogramDevice { -- cgit v1.2.3 From 9a55565eed10c80ce6b0f8d9262dd977d08b18e9 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Wed, 11 Oct 2023 14:20:15 +0000 Subject: libhwc2.1: Add histogram blocking roi support in HistogramController Bug: 299410182 Test: adb shell aidl_hist_client Change-Id: I5ef88e0c3a4bed8bfdcb9e31b884f8b94949e98a Signed-off-by: Leo Chen --- libhwc2.1/libdevice/HistogramController.cpp | 17 +++++++++++++++++ libhwc2.1/libdevice/HistogramController.h | 1 + 2 files changed, 18 insertions(+) diff --git a/libhwc2.1/libdevice/HistogramController.cpp b/libhwc2.1/libdevice/HistogramController.cpp index ac616fb..6cf6f78 100644 --- a/libhwc2.1/libdevice/HistogramController.cpp +++ b/libhwc2.1/libdevice/HistogramController.cpp @@ -16,6 +16,11 @@ #include "HistogramController.h" +void HistogramController::initPlatformHistogramCapability() { + mHistogramCapability.supportSamplePosList.push_back(HistogramSamplePos::PRE_POSTPROC); + mHistogramCapability.supportBlockingRoi = true; +} + // TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. #if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo& channel, @@ -34,6 +39,17 @@ int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo& chann channelConfig->roi.start_y = channel.workingConfig.roi.top; channelConfig->roi.hsize = channel.workingConfig.roi.right - channel.workingConfig.roi.left; channelConfig->roi.vsize = channel.workingConfig.roi.bottom - channel.workingConfig.roi.top; + if (channel.workingConfig.blockingRoi.has_value() && + channel.workingConfig.blockingRoi.value() != DISABLED_ROI) { + const HistogramRoiRect& blockedRoi = channel.workingConfig.blockingRoi.value(); + channelConfig->flags |= HISTOGRAM_FLAGS_BLOCKED_ROI; + channelConfig->blocked_roi.start_x = blockedRoi.left; + channelConfig->blocked_roi.start_y = blockedRoi.top; + channelConfig->blocked_roi.hsize = blockedRoi.right - blockedRoi.left; + channelConfig->blocked_roi.vsize = blockedRoi.bottom - blockedRoi.top; + } else { + channelConfig->flags &= ~HISTOGRAM_FLAGS_BLOCKED_ROI; + } channelConfig->weights.weight_r = channel.workingConfig.weights.weightR; channelConfig->weights.weight_g = channel.workingConfig.weights.weightG; channelConfig->weights.weight_b = channel.workingConfig.weights.weightB; @@ -41,6 +57,7 @@ int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo& chann ? POST_DQE : PRE_DQE; channelConfig->threshold = channel.threshold; + length = sizeof(struct histogram_channel_config); return NO_ERROR; diff --git a/libhwc2.1/libdevice/HistogramController.h b/libhwc2.1/libdevice/HistogramController.h index b5e8dac..a895bdd 100644 --- a/libhwc2.1/libdevice/HistogramController.h +++ b/libhwc2.1/libdevice/HistogramController.h @@ -21,6 +21,7 @@ class HistogramController : public HistogramDevice { public: HistogramController(ExynosDisplay* display) : HistogramDevice(display, 4, {3}) {} + virtual void initPlatformHistogramCapability() override; // TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. #if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) virtual int createHistogramDrmConfigLocked(const ChannelInfo& channel, -- cgit v1.2.3 From e9f84c15beaf7f4fb48d0a7a97921dd7a1211ec3 Mon Sep 17 00:00:00 2001 From: WeiChungChang Date: Sat, 18 Nov 2023 00:14:18 +0000 Subject: libhwc2.1: supply composer interface information Bug: 310742462 Test: verify the accurate retrieval of composer interface information expected results. Change-Id: I3d5423e40a723ff13784c2e32ae599386b1db0da --- libhwc2.1/libdevice/ExynosDeviceModule.cpp | 3 ++- libhwc2.1/libdevice/ExynosDeviceModule.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libhwc2.1/libdevice/ExynosDeviceModule.cpp b/libhwc2.1/libdevice/ExynosDeviceModule.cpp index 01fdaa0..9b8d62d 100644 --- a/libhwc2.1/libdevice/ExynosDeviceModule.cpp +++ b/libhwc2.1/libdevice/ExynosDeviceModule.cpp @@ -24,7 +24,8 @@ using Dataspace = aidl::android::hardware::graphics::common::Dataspace; namespace zuma { -ExynosDeviceModule::ExynosDeviceModule() {} +ExynosDeviceModule::ExynosDeviceModule(bool isVrrApiSupported) + : gs201::ExynosDeviceModule(isVrrApiSupported) {} ExynosDeviceModule::~ExynosDeviceModule() {} diff --git a/libhwc2.1/libdevice/ExynosDeviceModule.h b/libhwc2.1/libdevice/ExynosDeviceModule.h index eac369d..9746529 100644 --- a/libhwc2.1/libdevice/ExynosDeviceModule.h +++ b/libhwc2.1/libdevice/ExynosDeviceModule.h @@ -25,7 +25,7 @@ namespace zuma { class ExynosDeviceModule : public gs201::ExynosDeviceModule { public: - ExynosDeviceModule(); + ExynosDeviceModule(bool isVrrApiSupported); virtual ~ExynosDeviceModule(); using OverlayProperties = aidl::android::hardware::graphics::composer3::OverlayProperties; using SupportedBufferCombinations = OverlayProperties::SupportedBufferCombinations; -- cgit v1.2.3 From 04178834b22eda6e2a5cd5a2d8759ef403cf94e3 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Tue, 21 Nov 2023 06:49:48 +0000 Subject: libhwc2.1: remove the if defined guard for histogram When landing the multi channel histogram, we use the if defined guard to prevent the build breakage due to older kernel. Now all the kernel prebuilts are merged, the if defined guard can be removed. Bug: 295990513 Test: build pass Change-Id: If65f9cee656d9181fbbef5f6bd8ea2bb414d5c5e Signed-off-by: Leo Chen --- libhwc2.1/libdevice/HistogramController.cpp | 3 --- libhwc2.1/libdevice/HistogramController.h | 3 --- libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp | 3 --- libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h | 5 +---- 4 files changed, 1 insertion(+), 13 deletions(-) diff --git a/libhwc2.1/libdevice/HistogramController.cpp b/libhwc2.1/libdevice/HistogramController.cpp index 6cf6f78..8af0fa1 100644 --- a/libhwc2.1/libdevice/HistogramController.cpp +++ b/libhwc2.1/libdevice/HistogramController.cpp @@ -21,8 +21,6 @@ void HistogramController::initPlatformHistogramCapability() { mHistogramCapability.supportBlockingRoi = true; } -// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. -#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo& channel, std::shared_ptr& configPtr, size_t& length) const { @@ -70,4 +68,3 @@ int HistogramController::parseDrmEvent(void* event, uint8_t& channelId, char16_t buffer = (char16_t*)&histogram_channel_event->bins; return NO_ERROR; } -#endif diff --git a/libhwc2.1/libdevice/HistogramController.h b/libhwc2.1/libdevice/HistogramController.h index a895bdd..de60bf1 100644 --- a/libhwc2.1/libdevice/HistogramController.h +++ b/libhwc2.1/libdevice/HistogramController.h @@ -22,12 +22,9 @@ class HistogramController : public HistogramDevice { public: HistogramController(ExynosDisplay* display) : HistogramDevice(display, 4, {3}) {} virtual void initPlatformHistogramCapability() override; -// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. -#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) virtual int createHistogramDrmConfigLocked(const ChannelInfo& channel, std::shared_ptr& configPtr, size_t& length) const override REQUIRES(channel.channelInfoMutex); virtual int parseDrmEvent(void* event, uint8_t& channelId, char16_t*& buffer) const override; -#endif }; diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp index 987cd90..e4f8f08 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp @@ -52,8 +52,6 @@ ExynosPrimaryDisplayDrmInterfaceModule::ExynosPrimaryDisplayDrmInterfaceModule(E std::memcpy(mMonitorDescription.data(), panelModel.c_str(), mMonitorDescription.size()); } -// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. -#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) int32_t ExynosPrimaryDisplayDrmInterfaceModule::sendHistogramChannelIoctl(HistogramChannelIoctl_t control, uint8_t channelId) const { struct exynos_drm_histogram_channel_request histogramRequest; @@ -73,4 +71,3 @@ int32_t ExynosPrimaryDisplayDrmInterfaceModule::sendHistogramChannelIoctl(Histog return BAD_VALUE; } } -#endif diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h index f654d4b..c32d343 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h @@ -26,12 +26,9 @@ namespace zuma { class ExynosPrimaryDisplayDrmInterfaceModule : public gs201::ExynosPrimaryDisplayDrmInterfaceModule { public: - ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay); -// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. -#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) + ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay* exynosDisplay); virtual int32_t sendHistogramChannelIoctl(HistogramChannelIoctl_t control, uint8_t channelId) const override; -#endif }; using ExynosExternalDisplayDrmInterfaceModule = gs201::ExynosExternalDisplayDrmInterfaceModule; -- cgit v1.2.3 From 39343c0828fafab7994686a88c0a3960490975f0 Mon Sep 17 00:00:00 2001 From: Alessio Balsini Date: Wed, 22 Nov 2023 13:58:04 +0000 Subject: Revert "libhwc2.1: remove the if defined guard for histogram" This reverts commit 04178834b22eda6e2a5cd5a2d8759ef403cf94e3. Reason for revert: b/312699412 Change-Id: I8b94e99467790af5d7e3ce1dac35d5be988c19b2 --- libhwc2.1/libdevice/HistogramController.cpp | 3 +++ libhwc2.1/libdevice/HistogramController.h | 3 +++ libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp | 3 +++ libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h | 5 ++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libhwc2.1/libdevice/HistogramController.cpp b/libhwc2.1/libdevice/HistogramController.cpp index 8af0fa1..6cf6f78 100644 --- a/libhwc2.1/libdevice/HistogramController.cpp +++ b/libhwc2.1/libdevice/HistogramController.cpp @@ -21,6 +21,8 @@ void HistogramController::initPlatformHistogramCapability() { mHistogramCapability.supportBlockingRoi = true; } +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo& channel, std::shared_ptr& configPtr, size_t& length) const { @@ -68,3 +70,4 @@ int HistogramController::parseDrmEvent(void* event, uint8_t& channelId, char16_t buffer = (char16_t*)&histogram_channel_event->bins; return NO_ERROR; } +#endif diff --git a/libhwc2.1/libdevice/HistogramController.h b/libhwc2.1/libdevice/HistogramController.h index de60bf1..a895bdd 100644 --- a/libhwc2.1/libdevice/HistogramController.h +++ b/libhwc2.1/libdevice/HistogramController.h @@ -22,9 +22,12 @@ class HistogramController : public HistogramDevice { public: HistogramController(ExynosDisplay* display) : HistogramDevice(display, 4, {3}) {} virtual void initPlatformHistogramCapability() override; +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) virtual int createHistogramDrmConfigLocked(const ChannelInfo& channel, std::shared_ptr& configPtr, size_t& length) const override REQUIRES(channel.channelInfoMutex); virtual int parseDrmEvent(void* event, uint8_t& channelId, char16_t*& buffer) const override; +#endif }; diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp index e4f8f08..987cd90 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp @@ -52,6 +52,8 @@ ExynosPrimaryDisplayDrmInterfaceModule::ExynosPrimaryDisplayDrmInterfaceModule(E std::memcpy(mMonitorDescription.data(), panelModel.c_str(), mMonitorDescription.size()); } +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) int32_t ExynosPrimaryDisplayDrmInterfaceModule::sendHistogramChannelIoctl(HistogramChannelIoctl_t control, uint8_t channelId) const { struct exynos_drm_histogram_channel_request histogramRequest; @@ -71,3 +73,4 @@ int32_t ExynosPrimaryDisplayDrmInterfaceModule::sendHistogramChannelIoctl(Histog return BAD_VALUE; } } +#endif diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h index c32d343..f654d4b 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h @@ -26,9 +26,12 @@ namespace zuma { class ExynosPrimaryDisplayDrmInterfaceModule : public gs201::ExynosPrimaryDisplayDrmInterfaceModule { public: - ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay* exynosDisplay); + ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay); +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) virtual int32_t sendHistogramChannelIoctl(HistogramChannelIoctl_t control, uint8_t channelId) const override; +#endif }; using ExynosExternalDisplayDrmInterfaceModule = gs201::ExynosExternalDisplayDrmInterfaceModule; -- cgit v1.2.3 From acf6c72f6579eaf0f497df2d8550431ace2a30dd Mon Sep 17 00:00:00 2001 From: Sergey Volk Date: Tue, 28 Nov 2023 20:20:27 +0000 Subject: libhwc2.1: Use the new getPanelSysfsPath overload Bug: 288608645 Test: presubmit Change-Id: I74bfa5aec2cbc6dc4ff3c6b92a96a55fd4bc3baf --- libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp index 987cd90..62ab010 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp @@ -24,7 +24,7 @@ ExynosPrimaryDisplayDrmInterfaceModule::ExynosPrimaryDisplayDrmInterfaceModule(E : gs201::ExynosPrimaryDisplayDrmInterfaceModule(exynosDisplay) { ExynosPrimaryDisplayModule* display = (ExynosPrimaryDisplayModule*)mExynosDisplay; - const std::string &sysfs = display->getPanelSysfsPath(display->getBuiltInDisplayType()); + const std::string& sysfs = display->getPanelSysfsPath(); std::string panelModel; if (sysfs.empty()) { -- cgit v1.2.3 From 135784805878ef8e4bf77e1a88dc1a08a1ffaac5 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 29 Nov 2023 15:27:59 +0000 Subject: libhwc2.1: use const for getTargetOperationRate() Bug: 296163848 Test: build pass Change-Id: I5bf4143db67448d5ed2c581c61985f7e2ac21ddc --- libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp | 2 +- libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp index 3f3439f..b5bb83a 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp @@ -55,7 +55,7 @@ int32_t ExynosPrimaryDisplayModule::validateWinConfigData() return ExynosDisplay::validateWinConfigData(); } -int32_t ExynosPrimaryDisplayModule::OperationRateManager::getTargetOperationRate() { +int32_t ExynosPrimaryDisplayModule::OperationRateManager::getTargetOperationRate() const { if (mDisplayPowerMode == HWC2_POWER_MODE_DOZE || mDisplayPowerMode == HWC2_POWER_MODE_DOZE_SUSPEND) { return LP_OP_RATE; diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h index 9dc0673..37850d4 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h @@ -43,7 +43,7 @@ class ExynosPrimaryDisplayModule : public gs201::ExynosPrimaryDisplayModule { int32_t onConfig(hwc2_config_t cfg) override; int32_t onBrightness(uint32_t dbv) override; int32_t onPowerMode(int32_t mode) override; - int32_t getTargetOperationRate() override; + int32_t getTargetOperationRate() const override; private: enum class DispOpCondition : uint32_t { -- cgit v1.2.3