diff options
author | Jeremy DeHaan <jdehaan@google.com> | 2023-02-15 10:52:05 -0800 |
---|---|---|
committer | Jeremy DeHaan <jdehaan@google.com> | 2023-03-03 16:26:44 -0800 |
commit | 139dfb9a97b51e30e44f1cd0b7f2c0d12c914d24 (patch) | |
tree | bf6f8fd9a2c543bca7d8af63ae71eddba2ae9df1 | |
parent | 071cdcea072b8b82ee5393c6fd3f551e32dca07e (diff) | |
download | zuma-139dfb9a97b51e30e44f1cd0b7f2c0d12c914d24.tar.gz |
libhwc2.1: use panel model in EDID
Use the panel model as the monitor descriptor in the EDID, which
provides a unique display ID for the panel revision.
Bug: 217472351
Change-Id: Ica67cee1cf3b4e7a267a9d7d6dd1e71e983a0889
Signed-off-by: Jeremy DeHaan <jdehaan@google.com>
-rw-r--r-- | libhwc2.1/Android.mk | 1 | ||||
-rw-r--r-- | libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp | 53 | ||||
-rw-r--r-- | libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h | 6 |
3 files changed, 59 insertions, 1 deletions
diff --git a/libhwc2.1/Android.mk b/libhwc2.1/Android.mk index 0c6d82d..a6b6fba 100644 --- a/libhwc2.1/Android.mk +++ b/libhwc2.1/Android.mk @@ -26,6 +26,7 @@ LOCAL_SRC_FILES += \ ../../gs101/libhwc2.1/libvirtualdisplay/ExynosVirtualDisplayModule.cpp \ ../../gs101/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp \ ../../gs201/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp \ + ../../zuma/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp \ ../../zuma/libhwc2.1/libcolormanager/DisplayColorModule.cpp \ ../../zuma/libhwc2.1/libdevice/ExynosDeviceModule.cpp diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp new file mode 100644 index 0000000..1973006 --- /dev/null +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp @@ -0,0 +1,53 @@ +/* + * 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 "ExynosDisplayDrmInterfaceModule.h" +#include "ExynosPrimaryDisplayModule.h" + +using namespace zuma; + +//////////////////////////////////////////////////// ExynosPrimaryDisplayDrmInterfaceModule ////////////////////////////////////////////////////////////////// +ExynosPrimaryDisplayDrmInterfaceModule::ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay) + : gs201::ExynosPrimaryDisplayDrmInterfaceModule(exynosDisplay) +{ + ExynosPrimaryDisplayModule* display = (ExynosPrimaryDisplayModule*)mExynosDisplay; + const std::string &sysfs = display->getPanelSysfsPath(display->getBuiltInDisplayType()); + std::string panelModel; + + if (sysfs.empty()) { + return; + } + + if (readLineFromFile(sysfs + "/panel_model", panelModel, '\n') != OK) { + return; + } + + /* + * VESA EDID Standard requires monitor descriptor data to terminate + * with '\n' character and to pad with ' ' characters if < 13 bytes. + */ + if (panelModel.size() < MONITOR_DESCRIPTOR_DATA_LENGTH) { + panelModel += '\n'; + panelModel.append(MONITOR_DESCRIPTOR_DATA_LENGTH - panelModel.size(), ' '); + } + + if (panelModel.size() > MONITOR_DESCRIPTOR_DATA_LENGTH) { + ALOGE("Panel model longer than maximum %u bytes", MONITOR_DESCRIPTOR_DATA_LENGTH); + return; + } + + std::memcpy(mMonitorDescription.data(), panelModel.c_str(), mMonitorDescription.size()); +} diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h index 2232ce3..45783b1 100644 --- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h +++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h @@ -23,7 +23,11 @@ namespace zuma { -using ExynosPrimaryDisplayDrmInterfaceModule = gs201::ExynosPrimaryDisplayDrmInterfaceModule; + class ExynosPrimaryDisplayDrmInterfaceModule : public gs201::ExynosPrimaryDisplayDrmInterfaceModule { +public: + ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay); + }; + using ExynosExternalDisplayDrmInterfaceModule = gs201::ExynosExternalDisplayDrmInterfaceModule; } // namespace zuma |