summaryrefslogtreecommitdiff
path: root/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2023-01-13 04:37:29 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-01-13 04:37:29 +0000
commitbcd202486dcfc6feff01176e6d1be91b6e5cf860 (patch)
treef4da158934ef0569a36ca54285f0d678a5c4479b /libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
parentef4b5c4b257ddeb7255e2f8e447b39fa2a86e384 (diff)
parentc22220cf4c7f9575d507eb0c516b951989e6b39b (diff)
Merge "libhwc2.1: close unused RCD plane based on the respective display"
Diffstat (limited to 'libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp')
-rw-r--r--libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp60
1 files changed, 52 insertions, 8 deletions
diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
index 7b2739b..dbb11bd 100644
--- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
+++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterface.cpp
@@ -30,6 +30,7 @@
#include "BrightnessController.h"
#include "ExynosHWCDebug.h"
#include "ExynosHWCHelper.h"
+#include "ExynosPrimaryDisplay.h"
using namespace std::chrono_literals;
using namespace SOC_VERSION;
@@ -594,6 +595,27 @@ void ExynosDisplayDrmInterface::updateMountOrientation()
ALOGW("%s ignore unrecoganized orientation %" PRId64, __func__, drmOrientation);
}
+void ExynosDisplayDrmInterface::parseRCDId(const DrmProperty &property) {
+ if (mExynosDisplay->mType != HWC_DISPLAY_PRIMARY) {
+ ALOGW("%s invalid display type: %d", __func__, mExynosDisplay->mType);
+ return;
+ }
+
+ if (property.id() == 0) {
+ static_cast<ExynosPrimaryDisplay *>(mExynosDisplay)->mRcdId = -1;
+ return;
+ }
+
+ auto [err, rcd_id] = property.value();
+ if (err < 0) {
+ ALOGW("%s failed to get drm prop value", __func__);
+ return;
+ }
+
+ if (getSpecialChannelId(rcd_id) >= 0)
+ static_cast<ExynosPrimaryDisplay *>(mExynosDisplay)->mRcdId = rcd_id;
+}
+
uint32_t ExynosDisplayDrmInterface::getDrmDisplayId(uint32_t type, uint32_t index)
{
return type+index;
@@ -680,6 +702,8 @@ int32_t ExynosDisplayDrmInterface::initDrmDevice(DrmDevice *drmDevice)
parseMipiSyncEnums(mDrmConnector->mipi_sync());
updateMountOrientation();
+ if (mExynosDisplay->mType == HWC_DISPLAY_PRIMARY) parseRCDId(mDrmCrtc->rcd_plane_id_property());
+
if (mExynosDisplay->mBrightnessController &&
mExynosDisplay->mBrightnessController->initDrm(*mDrmDevice, *mDrmConnector)) {
ALOGW("%s failed to init brightness controller", __func__);
@@ -1771,15 +1795,18 @@ int32_t ExynosDisplayDrmInterface::deliverWinConfigData()
for (size_t i = 0; i < mExynosDisplay->mDpuData.rcdConfigs.size(); ++i) {
exynos_win_config_data &config = mExynosDisplay->mDpuData.rcdConfigs[i];
- if (config.state == config.WIN_STATE_RCD) {
- const int channelId = mExynosDisplay->mDevice->getSpecialPlaneId(
- mExynosDisplay->mIndex); // TODO: b/227584297
- auto &plane = mDrmDevice->planes().at(channelId);
- uint32_t fbId = 0;
- if ((ret = setupCommitFromDisplayConfig(drmReq, config, i, plane, fbId)) < 0) {
- HWC_LOGE(mExynosDisplay, "setupCommitFromDisplayConfig failed, config[%zu]", i);
+ if ((config.state == config.WIN_STATE_RCD) &&
+ (mExynosDisplay->mType == HWC_DISPLAY_PRIMARY)) {
+ const int32_t rcdId = static_cast<ExynosPrimaryDisplay *>(mExynosDisplay)->mRcdId;
+ const int32_t channelId = getSpecialChannelId(rcdId);
+ if (channelId >= 0) {
+ auto &plane = mDrmDevice->planes().at(channelId);
+ uint32_t fbId = 0;
+ if ((ret = setupCommitFromDisplayConfig(drmReq, config, i, plane, fbId)) < 0) {
+ HWC_LOGE(mExynosDisplay, "setupCommitFromDisplayConfig failed, config[%zu]", i);
+ }
+ planeEnableInfo[plane->id()] = 1;
}
- planeEnableInfo[plane->id()] = 1;
}
}
@@ -1793,6 +1820,10 @@ int32_t ExynosDisplayDrmInterface::deliverWinConfigData()
(exynosMPP->mReservedDisplay != (int32_t)mExynosDisplay->mDisplayId))
continue;
+ if ((exynosMPP == NULL) && (mExynosDisplay->mType == HWC_DISPLAY_PRIMARY) &&
+ (plane->id() != static_cast<ExynosPrimaryDisplay *>(mExynosDisplay)->mRcdId))
+ continue;
+
if ((ret = drmReq.atomicAddProperty(plane->id(),
plane->crtc_property(), 0)) < 0)
return ret;
@@ -2444,3 +2475,16 @@ int32_t ExynosDisplayDrmInterface::getDisplayIdentificationData(
return HWC2_ERROR_NONE;
}
+
+int32_t ExynosDisplayDrmInterface::getSpecialChannelId(uint32_t planeId) {
+ ExynosDevice *exynosDevice = mExynosDisplay->mDevice;
+ for (int i = 0; i < exynosDevice->getSpecialPlaneNum(); i++) {
+ const int32_t channelId = exynosDevice->getSpecialPlaneId(i);
+ auto &plane = mDrmDevice->planes().at(channelId);
+ if (plane->id() == planeId) return channelId;
+ }
+
+ ALOGE("%s: Failed to get RCD planeId.", __func__);
+
+ return -EINVAL;
+}