summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Volk <servolk@google.com>2023-12-04 20:27:38 +0000
committerSergey Volk <servolk@google.com>2023-12-11 20:15:19 +0000
commit4793d1473ba5b3593643c0e2bf4e109af9c422fd (patch)
tree7435383658c892a9747d8420756d8ba4d89d006a
parentadce874c7984b310b42dde98f7ee579b9f6629cf (diff)
downloadcommon-4793d1473ba5b3593643c0e2bf4e109af9c422fd.tar.gz
libhwc2.1: Add getDcDisplayType function
Currently HWC uses the getDisplayTypeFromIndex function in a number of places in common/gs101 code, but that function is defined only for primary displays. This CL introduces the getDcDisplayType function, which has the same behavior as getDisplayTypeFromIndex, but will also handle external display properly. Bug: 299682821 Test: presubmit Change-Id: If8d6050bdabef39b8caef5560db32fb579fe1821
-rw-r--r--libhwc2.1/libdevice/ExynosDisplay.cpp15
-rw-r--r--libhwc2.1/libdevice/ExynosDisplay.h2
-rw-r--r--libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp6
-rw-r--r--libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h6
4 files changed, 22 insertions, 7 deletions
diff --git a/libhwc2.1/libdevice/ExynosDisplay.cpp b/libhwc2.1/libdevice/ExynosDisplay.cpp
index 6fb4a3c..2f77bb9 100644
--- a/libhwc2.1/libdevice/ExynosDisplay.cpp
+++ b/libhwc2.1/libdevice/ExynosDisplay.cpp
@@ -6616,3 +6616,18 @@ void ExynosDisplay::storePrevValidateCompositionType() {
}
mClientCompositionInfo.mPrevHasCompositionLayer = mClientCompositionInfo.mHasCompositionLayer;
}
+
+displaycolor::DisplayType ExynosDisplay::getDcDisplayType() const {
+ switch (mType) {
+ case HWC_DISPLAY_PRIMARY:
+ return mIndex == 0 ? displaycolor::DisplayType::DISPLAY_PRIMARY
+ : displaycolor::DisplayType::DISPLAY_SECONDARY;
+ case HWC_DISPLAY_EXTERNAL:
+ return displaycolor::DisplayType::DISPLAY_EXTERNAL;
+ case HWC_DISPLAY_VIRTUAL:
+ default:
+ DISPLAY_LOGE("%s: Unsupported display type(%d)", __func__, mType);
+ assert(false);
+ return displaycolor::DisplayType::DISPLAY_PRIMARY;
+ }
+}
diff --git a/libhwc2.1/libdevice/ExynosDisplay.h b/libhwc2.1/libdevice/ExynosDisplay.h
index 382b387..cdb62d6 100644
--- a/libhwc2.1/libdevice/ExynosDisplay.h
+++ b/libhwc2.1/libdevice/ExynosDisplay.h
@@ -1320,6 +1320,8 @@ class ExynosDisplay {
virtual void onVsync(int64_t __unused timestamp) { return; };
+ displaycolor::DisplayType getDcDisplayType() const;
+
protected:
virtual bool getHDRException(ExynosLayer *layer);
virtual int32_t getActiveConfigInternal(hwc2_config_t* outConfig);
diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp
index ba2cb5c..d15c4fe 100644
--- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp
+++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp
@@ -132,10 +132,12 @@ ExynosPrimaryDisplay::ExynosPrimaryDisplay(uint32_t index, ExynosDevice *device,
mDbvThresholdForBlockingZone);
}
- DisplayType displayType = getDisplayTypeFromIndex(mIndex);
+ DisplayType displayType = getDcDisplayType();
std::string displayTypeIdentifier;
if (displayType == DisplayType::DISPLAY_PRIMARY) {
displayTypeIdentifier = "primarydisplay";
+ } else if (displayType == DisplayType::DISPLAY_EXTERNAL) {
+ displayTypeIdentifier = "externaldisplay";
}
#ifdef USES_IDISPLAY_INTF_SEC
else if (displayType == DisplayType::DISPLAY_SECONDARY) {
@@ -189,7 +191,7 @@ ExynosPrimaryDisplay::ExynosPrimaryDisplay(uint32_t index, ExynosDevice *device,
char value[PROPERTY_VALUE_MAX];
const char *earlyWakeupNodeBase = early_wakeup_node_0_base;
- if (getDisplayTypeFromIndex(mIndex) == DisplayType::DISPLAY_SECONDARY &&
+ if (getDcDisplayType() == DisplayType::DISPLAY_SECONDARY &&
property_get("vendor.display.secondary_early_wakeup_node", value, "") > 0) {
earlyWakeupNodeBase = value;
}
diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h
index 0be4c60..2d5b657 100644
--- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h
+++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.h
@@ -93,16 +93,12 @@ class ExynosPrimaryDisplay : public ExynosDisplay {
virtual bool getHDRException(ExynosLayer* __unused layer);
virtual int32_t setActiveConfigInternal(hwc2_config_t config, bool force) override;
virtual int32_t getActiveConfigInternal(hwc2_config_t* outConfig) override;
- DisplayType getDisplayTypeFromIndex(uint32_t index) const {
- return (index >= DisplayType::DISPLAY_MAX) ? DisplayType::DISPLAY_PRIMARY
- : DisplayType(mIndex);
- };
public:
// Prepare multi resolution
ResolutionInfo mResolutionInfo;
std::string getPanelSysfsPath() const override {
- return getPanelSysfsPath(getDisplayTypeFromIndex(mIndex));
+ return getPanelSysfsPath(getDcDisplayType());
}
std::string getPanelSysfsPath(const displaycolor::DisplayType& type) const;