aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-14 23:01:10 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-14 23:01:10 +0000
commit6033fec700aa78c4b8784940ef50014102f21b1a (patch)
treed8aed68be718346b467f7fd5beea646d0f819070
parent41618f465c8b08011b96a0bbdf616accbc5b3b82 (diff)
parent9877e18b82fed1dbca0ca3d05d5bce2d8f7b542e (diff)
downloadgoldfish-opengl-android12L-d2-s6-release.tar.gz
Change-Id: I15eae48f978ad03ec4cf3ff7aeeed049e2999e16
-rw-r--r--system/hwc2/Display.cpp4
-rw-r--r--system/hwc2/DisplayConfig.cpp10
-rw-r--r--system/hwc2/DisplayConfig.h3
3 files changed, 11 insertions, 6 deletions
diff --git a/system/hwc2/Display.cpp b/system/hwc2/Display.cpp
index 9d754cba..a7cff779 100644
--- a/system/hwc2/Display.cpp
+++ b/system/hwc2/Display.cpp
@@ -114,8 +114,8 @@ HWC2::Error Display::updateParameters(
1000 * 1000 * 1000 / refreshRateHz);
it->second.setAttribute(HWC2::Attribute::Width, width);
it->second.setAttribute(HWC2::Attribute::Height, height);
- it->second.setAttribute(HWC2::Attribute::DpiX, dpiX * 1000);
- it->second.setAttribute(HWC2::Attribute::DpiY, dpiY * 1000);
+ it->second.setAttribute(HWC2::Attribute::DpiX, dpiX);
+ it->second.setAttribute(HWC2::Attribute::DpiY, dpiY);
mEdid = edid;
diff --git a/system/hwc2/DisplayConfig.cpp b/system/hwc2/DisplayConfig.cpp
index b05f9076..ee4cbb1e 100644
--- a/system/hwc2/DisplayConfig.cpp
+++ b/system/hwc2/DisplayConfig.cpp
@@ -57,10 +57,12 @@ int32_t DisplayConfig::getAttribute(HWC2::Attribute attribute) const {
return mHeight;
}
if (attribute == HWC2::Attribute::DpiX) {
- return mDpiX;
+ // From hwcomposer2.h, HWC2_ATTRIBUTE_DPI_X returns "Dots per thousand inches (DPI * 1000)".
+ return getDotsPerThousandInchesX();
}
if (attribute == HWC2::Attribute::DpiY) {
- return mDpiY;
+ // From hwcomposer2.h, HWC2_ATTRIBUTE_DPI_Y returns "Dots per thousand inches (DPI * 1000)"
+ return getDotsPerThousandInchesY();
}
if (attribute == HWC2::Attribute::VsyncPeriod) {
return mVsyncPeriodNanos;
@@ -75,8 +77,8 @@ std::string DisplayConfig::toString() const {
std::string output;
output += " w:" + std::to_string(mWidth);
output += " h:" + std::to_string(mHeight);
- output += " dpi-x:" + std::to_string(mDpiX / 1000.0f);
- output += " dpi-y:" + std::to_string(mDpiY / 1000.0f);
+ output += " dpi-x:" + std::to_string(mDpiX);
+ output += " dpi-y:" + std::to_string(mDpiY);
output += " vsync:" + std::to_string(1e9 / mVsyncPeriodNanos);
output += " config-group:" + std::to_string(mConfigGroup);
return output;
diff --git a/system/hwc2/DisplayConfig.h b/system/hwc2/DisplayConfig.h
index f7502d70..67e4c49e 100644
--- a/system/hwc2/DisplayConfig.h
+++ b/system/hwc2/DisplayConfig.h
@@ -60,6 +60,9 @@ class DisplayConfig {
int32_t getDpiY() const { return mDpiY; }
void setDpiY(int32_t dpi) { mDpiY = dpi; }
+ int32_t getDotsPerThousandInchesX() const { return mDpiX * 1000; }
+ int32_t getDotsPerThousandInchesY() const { return mDpiY * 1000; }
+
int32_t getVsyncPeriod() const { return mVsyncPeriodNanos; }
void setVsyncPeriod(int32_t vsync) { mVsyncPeriodNanos = vsync; }