summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-05-31 07:24:47 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-05-31 07:24:47 +0000
commit45d6f0affcdefe1f0f2a60e61d7cab3a0ddf338c (patch)
treeef9eac3b2a1771ecd0ad5f427749a93254035d9b
parent8a41f8c28090945101f4f8b76bb0ab5679c374c1 (diff)
parent88fbd425a85fbba6365976ca9b056c719f7685a5 (diff)
downloadnative-45d6f0affcdefe1f0f2a60e61d7cab3a0ddf338c.tar.gz
Snap for 4813226 from 88fbd425a85fbba6365976ca9b056c719f7685a5 to pi-release
Change-Id: If5a4e90e76d111e1cc415fa2f0ab250ddf5f04c8
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp28
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp18
2 files changed, 29 insertions, 17 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index e81df8ad53..9ecbacc86b 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -162,18 +162,20 @@ std::vector<RenderIntent> getRenderIntentCandidates(RenderIntent intent) {
}
}
- // add other HDR candidates when intent is HDR
if (isHdr) {
+ // add other HDR candidates when intent is HDR
for (auto hdrIntent : sHdrRenderIntents) {
if (hdrIntent != intent) {
candidates.push_back(hdrIntent);
}
}
- }
-
- // add COLORIMETRIC
- if (intent != RenderIntent::COLORIMETRIC) {
- candidates.push_back(RenderIntent::COLORIMETRIC);
+ } else {
+ // add other SDR candidates when intent is SDR
+ for (auto sdrIntent : sSdrRenderIntents) {
+ if (sdrIntent != intent) {
+ candidates.push_back(sdrIntent);
+ }
+ }
}
return candidates;
@@ -727,14 +729,24 @@ void DisplayDevice::populateColorModes(
}
}
- // add known SDR combinations
+ // add all known SDR combinations
for (auto intent : sdrRenderIntents) {
for (auto mode : sSdrColorModes) {
addColorMode(hwcColorModes, mode, intent);
}
}
- // add known HDR combinations
+ // collect all known HDR render intents
+ std::unordered_set<RenderIntent> hdrRenderIntents(sHdrRenderIntents.begin(),
+ sHdrRenderIntents.end());
+ iter = hwcColorModes.find(ColorMode::BT2100_PQ);
+ if (iter != hwcColorModes.end()) {
+ for (auto intent : iter->second) {
+ hdrRenderIntents.insert(intent);
+ }
+ }
+
+ // add all known HDR combinations
for (auto intent : sHdrRenderIntents) {
for (auto mode : sHdrColorModes) {
addColorMode(hwcColorModes, mode, intent);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f5fa478a2d..a120738713 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1932,27 +1932,27 @@ void SurfaceFlinger::pickColorMode(const sp<DisplayDevice>& displayDevice,
Dataspace hdrDataSpace;
Dataspace bestDataSpace = getBestDataspace(displayDevice, &hdrDataSpace);
+ // respect hdrDataSpace only when there is modern HDR support
+ const bool isHdr = hdrDataSpace != Dataspace::UNKNOWN &&
+ displayDevice->hasModernHdrSupport(hdrDataSpace);
+ if (isHdr) {
+ bestDataSpace = hdrDataSpace;
+ }
+
RenderIntent intent;
switch (mDisplayColorSetting) {
case DisplayColorSetting::MANAGED:
case DisplayColorSetting::UNMANAGED:
- intent = RenderIntent::COLORIMETRIC;
+ intent = isHdr ? RenderIntent::TONE_MAP_COLORIMETRIC : RenderIntent::COLORIMETRIC;
break;
case DisplayColorSetting::ENHANCED:
- intent = RenderIntent::ENHANCE;
+ intent = isHdr ? RenderIntent::TONE_MAP_ENHANCE : RenderIntent::ENHANCE;
break;
default: // vendor display color setting
intent = static_cast<RenderIntent>(mDisplayColorSetting);
break;
}
- // respect hdrDataSpace only when there is modern HDR support
- if (hdrDataSpace != Dataspace::UNKNOWN && displayDevice->hasModernHdrSupport(hdrDataSpace)) {
- bestDataSpace = hdrDataSpace;
- intent = mDisplayColorSetting == DisplayColorSetting::ENHANCED ?
- RenderIntent::TONE_MAP_ENHANCE : RenderIntent::TONE_MAP_COLORIMETRIC;
- }
-
displayDevice->getBestColorMode(bestDataSpace, intent, outDataSpace, outMode, outRenderIntent);
}