summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWiwit Rifa'i <wiwitrifai@google.com>2023-09-21 12:24:49 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-09-21 12:24:49 +0000
commitbe43cacb792906890ad2e60e8120c0ed6f3fea93 (patch)
treed2e1863fcfd8895e81159350755cc1164620118f
parent1fb0f976699bd959216d84f981ced944ee4ed140 (diff)
parent7a659c79a546ac93e2878d92fc9a4dedcc2c5a62 (diff)
downloadzuma-be43cacb792906890ad2e60e8120c0ed6f3fea93.tar.gz
Merge changes from topic "optimize-instructions-count-b295892886" into udc-qpr-dev am: 98b3c1884d am: 7a659c79a5
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/google/graphics/zuma/+/24754397 Change-Id: I7ff78e5ec9dcf1d1080e20ac9c1c523bedd949ca Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libhwc2.1/libresource/ExynosResourceManagerModule.cpp66
-rw-r--r--libhwc2.1/libresource/ExynosResourceManagerModule.h11
2 files changed, 27 insertions, 50 deletions
diff --git a/libhwc2.1/libresource/ExynosResourceManagerModule.cpp b/libhwc2.1/libresource/ExynosResourceManagerModule.cpp
index 46c17fb..faf52af 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<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__,
@@ -279,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)
{
@@ -315,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++) {
@@ -335,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 {
@@ -375,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);
}
}
@@ -397,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);
}
@@ -424,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);
}
@@ -605,12 +584,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<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)) {
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;