summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeiyong Lin <lpy@google.com>2018-06-05 10:58:41 -0700
committerPeiyong Lin <lpy@google.com>2018-06-05 22:24:50 +0000
commit3c6b7efc5204eab5701d5ab2f0ff87763cc322fa (patch)
tree0ae0ecbd2573e2770bbc82bc51c731071ad8558c
parent4f80b867b3433ddc16d416809c7e9cd5d6deb88b (diff)
downloadnative-3c6b7efc5204eab5701d5ab2f0ff87763cc322fa.tar.gz
[SurfaceFlinger] Respect HDR data space.
Respect HDR data space when there is no legacy HDR support. Previously we only cared about HDR data space when it is supported, however, on Pixel 2 there is no HDR mode support. This patch makes sure that when HDR mode is not supported, we fall back to Display P3 color mode correctly. BUG: 80404330 Test: Build, flash and watch Youtube HDR Change-Id: I7d27711fe4d33268e5ebbd14fce0975f9e642e84 Merged-In: I7d27711fe4d33268e5ebbd14fce0975f9e642e84
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp4
-rw-r--r--services/surfaceflinger/DisplayDevice.h6
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp4
3 files changed, 7 insertions, 7 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 9ecbacc86b..db095a51d9 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -761,12 +761,12 @@ bool DisplayDevice::hasRenderIntent(RenderIntent intent) const {
return iter != mColorModes.end() && iter->second.renderIntent == intent;
}
-bool DisplayDevice::hasModernHdrSupport(Dataspace dataspace) const {
+bool DisplayDevice::hasLegacyHdrSupport(Dataspace dataspace) const {
if ((dataspace == Dataspace::BT2020_PQ && hasHDR10Support()) ||
(dataspace == Dataspace::BT2020_HLG && hasHLGSupport())) {
auto iter =
mColorModes.find(getColorModeKey(dataspace, RenderIntent::TONE_MAP_COLORIMETRIC));
- return iter != mColorModes.end() && iter->second.dataspace == dataspace;
+ return iter == mColorModes.end() || iter->second.dataspace != dataspace;
}
return false;
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index b3859b6793..6c3bd91793 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -150,9 +150,9 @@ public:
bool hasHLGSupport() const { return mHasHLG; }
bool hasDolbyVisionSupport() const { return mHasDolbyVision; }
- // Return true if the corresponding color mode for the HDR dataspace is
- // supported.
- bool hasModernHdrSupport(ui::Dataspace dataspace) const;
+ // Return true if the HDR dataspace is supported but
+ // there is no corresponding color mode.
+ bool hasLegacyHdrSupport(ui::Dataspace dataspace) const;
// The returned HdrCapabilities is the combination of HDR capabilities from
// hardware composer and RenderEngine. When the DisplayDevice supports wide
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 97edd357ed..cdd9c1804f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1932,9 +1932,9 @@ void SurfaceFlinger::pickColorMode(const sp<DisplayDevice>& displayDevice,
Dataspace hdrDataSpace;
Dataspace bestDataSpace = getBestDataspace(displayDevice, &hdrDataSpace);
- // respect hdrDataSpace only when there is modern HDR support
+ // respect hdrDataSpace only when there is no legacy HDR support
const bool isHdr = hdrDataSpace != Dataspace::UNKNOWN &&
- displayDevice->hasModernHdrSupport(hdrDataSpace);
+ !displayDevice->hasLegacyHdrSupport(hdrDataSpace);
if (isHdr) {
bestDataSpace = hdrDataSpace;
}