diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-10-14 23:01:10 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-10-14 23:01:10 +0000 |
commit | 6033fec700aa78c4b8784940ef50014102f21b1a (patch) | |
tree | d8aed68be718346b467f7fd5beea646d0f819070 | |
parent | 41618f465c8b08011b96a0bbdf616accbc5b3b82 (diff) | |
parent | 9877e18b82fed1dbca0ca3d05d5bce2d8f7b542e (diff) | |
download | goldfish-opengl-android12L-d2-s6-release.tar.gz |
Snap for 7824833 from 9877e18b82fed1dbca0ca3d05d5bce2d8f7b542e to sc-d2-releaseandroid-12.1.0_r26android-12.1.0_r25android-12.1.0_r24android-12.1.0_r23android-12.1.0_r18android-12.1.0_r17android-12.1.0_r16android-12.1.0_r15android-12.1.0_r14android-12.1.0_r13android-12.1.0_r12android12L-d2-s8-releaseandroid12L-d2-s7-releaseandroid12L-d2-s6-releaseandroid12L-d2-s5-releaseandroid12L-d2-s4-releaseandroid12L-d2-s3-releaseandroid12L-d2-s2-releaseandroid12L-d2-s1-releaseandroid12L-d2-release
Change-Id: I15eae48f978ad03ec4cf3ff7aeeed049e2999e16
-rw-r--r-- | system/hwc2/Display.cpp | 4 | ||||
-rw-r--r-- | system/hwc2/DisplayConfig.cpp | 10 | ||||
-rw-r--r-- | system/hwc2/DisplayConfig.h | 3 |
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; } |