summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2024-01-17 22:14:14 -0800
committerXin Li <delphij@google.com>2024-01-17 22:14:14 -0800
commit3f66ebf163cd7f84b2e13a0ff863178ff5711010 (patch)
tree353267dcbae9e656781041b21cda38c8c2461639
parentdc44bfee58bcb707ac330bbce2cdb59745a57d66 (diff)
parent135784805878ef8e4bf77e1a88dc1a08a1ffaac5 (diff)
downloadzuma-temp_319669529.tar.gz
Merge Android 24Q1 Release (ab/11220357)temp_319669529
Bug: 319669529 Merged-In: I5bf4143db67448d5ed2c581c61985f7e2ac21ddc Change-Id: I0b618c20e539c62706958808ba1792532d4cf0a5
-rw-r--r--.clang-format4
-rw-r--r--OWNERS1
-rw-r--r--libhwc2.1/Android.mk3
-rw-r--r--libhwc2.1/libdevice/ExynosDeviceModule.cpp3
-rw-r--r--libhwc2.1/libdevice/ExynosDeviceModule.h2
-rw-r--r--libhwc2.1/libdevice/HistogramController.cpp73
-rw-r--r--libhwc2.1/libdevice/HistogramController.h33
-rw-r--r--libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp25
-rw-r--r--libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h12
-rw-r--r--libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp45
-rw-r--r--libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.h2
-rw-r--r--libhwc2.1/libresource/ExynosResourceManagerModule.cpp121
-rw-r--r--libhwc2.1/libresource/ExynosResourceManagerModule.h11
13 files changed, 242 insertions, 93 deletions
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
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
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/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;
diff --git a/libhwc2.1/libdevice/HistogramController.cpp b/libhwc2.1/libdevice/HistogramController.cpp
new file mode 100644
index 0000000..6cf6f78
--- /dev/null
+++ b/libhwc2.1/libdevice/HistogramController.cpp
@@ -0,0 +1,73 @@
+/*
+ * 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"
+
+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,
+ std::shared_ptr<void>& configPtr,
+ size_t& length) const {
+ configPtr = std::make_shared<struct histogram_channel_config>();
+ 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;
+ 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;
+ 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..a895bdd
--- /dev/null
+++ b/libhwc2.1/libdevice/HistogramController.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "HistogramDevice.h"
+
+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<void>& 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 1973006..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()) {
@@ -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).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).c_str());
+ 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;
diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplayModule.cpp
index 36d3f93..b5bb83a 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;
@@ -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;
@@ -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);
}
@@ -242,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/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 {
diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp
index afb5efd..faf52af 100644
--- a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp
+++ b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp
@@ -54,12 +54,12 @@ ExynosResourceManagerModule::~ExynosResourceManagerModule() {}
bool ExynosResourceManagerModule::checkTDMResource(ExynosDisplay *display, ExynosMPP *currentMPP,
ExynosMPPSource *mppSrc) {
- std::map<tdm_attr_t, uint32_t> accumulatedDPUFAmount;
- std::map<tdm_attr_t, uint32_t> accumulatedDPUFAXIAmount;
+ std::array<uint32_t, TDM_ATTR_MAX> accumulatedDPUFAmount{};
+ std::array<uint32_t, TDM_ATTR_MAX> 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__,
- 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");
}
@@ -280,6 +279,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 +320,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 +340,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 +366,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 +381,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 +406,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);
}
@@ -558,7 +536,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]++;
@@ -574,13 +552,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.c_str());
+ }
- HDEBUGLOGD(eDebugLoadBalancing, "%s %p, %s", __func__, src.bufferHandle, after.string());
+ ALOGD("%s %p, %s", __func__, src.bufferHandle, after.c_str());
+ }
return 0;
}
@@ -604,23 +584,22 @@ 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<tdm_attr_t, uint32_t> &DPUFAmounts,
- std::map<tdm_attr_t, uint32_t> &AXIAmounts) {
+uint32_t ExynosResourceManagerModule::getAmounts(ExynosDisplay* display, uint32_t currentBlockId,
+ uint32_t currentAXIId, ExynosMPP* compOtfMPP,
+ ExynosMPPSource* curSrc, ExynosMPPSource* compSrc,
+ std::array<uint32_t, TDM_ATTR_MAX>& DPUFAmounts,
+ std::array<uint32_t, TDM_ATTR_MAX>& AXIAmounts) {
const uint32_t blockId = compOtfMPP->getHWBlockId();
const uint32_t AXIId = compOtfMPP->getAXIPortId();
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 +610,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;
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<tdm_attr_t, uint32_t> &DPUFAmounts,
- std::map<tdm_attr_t, uint32_t> &AXIAmounts);
+ uint32_t getAmounts(ExynosDisplay* display, uint32_t currentBlockId, uint32_t currentAXIId,
+ ExynosMPP* compOtfMPP, ExynosMPPSource* curSrc,
+ ExynosMPPSource* compSrc,
+ std::array<uint32_t, TDM_ATTR_MAX>& DPUFAmounts,
+ std::array<uint32_t, TDM_ATTR_MAX>& AXIAmounts);
bool checkTDMResource(ExynosDisplay *display, ExynosMPP *currentMPP,
ExynosMPPSource *mppSrc);
const std::map<HWResourceIndexes, HWResourceAmounts_t> *mHWResourceTables = nullptr;