summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Peiyong Lin <lpy@google.com> 2018-12-05 07:38:28 -0800
committer Peiyong Lin <lpy@google.com> 2018-12-11 06:50:51 +0000
commitc1ccb0bf1ec523b67745890874a2e605e603538c (patch)
tree79b310275aba3cb6bcb6e1aaebe913519c471c82
parent14724e6caf841e719bdbe1f4ac5cdcc70bc68a21 (diff)
[SurfaceFlinger] Remove saturation matrix of Adaptive mode.
Previously, we have to hack our code to make sure the input color is saturated to the same output color regarding the color mode because we can't deliver the saturation for Display P3 in the color profile. However, such capability should really be device specific, and since we already have it, remove the usage of this API. BUG: 80490445 BUG: 118503801 Test: Build, flash and boot. Open Photos and Files to verify. Change-Id: I09f4a157394056acb970751b820a87a387702e44
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp32
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h2
2 files changed, 0 insertions, 34 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4aea3697f4..a14ca2d2a2 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -734,24 +734,6 @@ void SurfaceFlinger::init() {
ALOGE("Run StartPropertySetThread failed!");
}
- // This is a hack. Per definition of getDataspaceSaturationMatrix, the returned matrix
- // is used to saturate legacy sRGB content. However, to make sure the same color under
- // Display P3 will be saturated to the same color, we intentionally break the API spec
- // and apply this saturation matrix on Display P3 content. Unless the risk of applying
- // such saturation matrix on Display P3 is understood fully, the API should always return
- // identify matrix.
- mEnhancedSaturationMatrix =
- getHwComposer().getDataspaceSaturationMatrix(*display->getId(), Dataspace::SRGB_LINEAR);
-
- // we will apply this on Display P3.
- if (mEnhancedSaturationMatrix != mat4()) {
- ColorSpace srgb(ColorSpace::sRGB());
- ColorSpace displayP3(ColorSpace::DisplayP3());
- mat4 srgbToP3 = mat4(ColorSpaceConnector(srgb, displayP3).getTransform());
- mat4 p3ToSrgb = mat4(ColorSpaceConnector(displayP3, srgb).getTransform());
- mEnhancedSaturationMatrix = srgbToP3 * mEnhancedSaturationMatrix * p3ToSrgb;
- }
-
ALOGV("Done initializing");
}
@@ -3085,7 +3067,6 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<DisplayDevice>& display) {
mat4 colorMatrix;
bool applyColorMatrix = false;
- bool needsEnhancedColorMatrix = false;
// Framebuffer will live in this scope for GPU composition.
std::unique_ptr<renderengine::BindNativeBufferAsFramebuffer> fbo;
@@ -3132,16 +3113,6 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<DisplayDevice>& display) {
colorMatrix = mDrawingState.colorMatrix;
}
- // The current enhanced saturation matrix is designed to enhance Display P3,
- // thus we only apply this matrix when the render intent is not colorimetric
- // and the output color space is Display P3.
- needsEnhancedColorMatrix =
- (display->getActiveRenderIntent() >= RenderIntent::ENHANCE &&
- outputDataspace == Dataspace::DISPLAY_P3);
- if (needsEnhancedColorMatrix) {
- colorMatrix *= mEnhancedSaturationMatrix;
- }
-
display->setViewportAndProjection();
// Never touch the framebuffer if we don't have any framebuffer layers
@@ -3216,9 +3187,6 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<DisplayDevice>& display) {
tmpMatrix = mDrawingState.colorMatrix;
}
tmpMatrix *= layer->getColorTransform();
- if (needsEnhancedColorMatrix) {
- tmpMatrix *= mEnhancedSaturationMatrix;
- }
getRenderEngine().setColorTransform(tmpMatrix);
} else {
getRenderEngine().setColorTransform(colorMatrix);
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 9f520583fe..4977ca08d2 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -986,8 +986,6 @@ private:
std::thread::id mMainThreadId;
DisplayColorSetting mDisplayColorSetting = DisplayColorSetting::ENHANCED;
- // Applied on Display P3 layers when the render intent is non-colorimetric.
- mat4 mEnhancedSaturationMatrix;
ui::Dataspace mDefaultCompositionDataspace;
ui::Dataspace mWideColorGamutCompositionDataspace;