summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
author android-build-team Robot <android-build-team-robot@google.com> 2018-05-16 07:24:38 +0000
committer android-build-team Robot <android-build-team-robot@google.com> 2018-05-16 07:24:38 +0000
commit83f55554df7ebfd0129cb465b01e2f46ae9b74b5 (patch)
tree363ea32069aae897b71f560fefe1072772bb60f8 /services/surfaceflinger/SurfaceFlinger.cpp
parentbf71bf65b82059012df6e860b821d39ccf1158df (diff)
parenteae8fe3d01ba43df32e868eeb5a5f33a095beab8 (diff)
Snap for 4784261 from eae8fe3d01ba43df32e868eeb5a5f33a095beab8 to pi-release
Change-Id: Ia26c75fef8d05a1c1737601621bc7056a1943284
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp40
1 files changed, 15 insertions, 25 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 588d24c45f..c687e9db93 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2963,10 +2963,8 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& displayDev
ATRACE_INT("hasClientComposition", hasClientComposition);
bool applyColorMatrix = false;
- bool applyLegacyColorMatrix = false;
- mat4 colorMatrix;
- mat4 legacyColorMatrix;
- const mat4* currentColorMatrix = nullptr;
+ bool needsLegacyColorMatrix = false;
+ bool legacyColorMatrixApplied = false;
if (hasClientComposition) {
ALOGV("hasClientComposition");
@@ -2985,19 +2983,12 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& displayDev
applyColorMatrix = !hasDeviceComposition && !skipClientColorTransform;
if (applyColorMatrix) {
- colorMatrix = mDrawingState.colorMatrix;
+ getRenderEngine().setupColorTransform(mDrawingState.colorMatrix);
}
- applyLegacyColorMatrix = (mDisplayColorSetting == DisplayColorSetting::ENHANCED &&
+ needsLegacyColorMatrix = (mDisplayColorSetting == DisplayColorSetting::ENHANCED &&
outputDataspace != Dataspace::UNKNOWN &&
outputDataspace != Dataspace::SRGB);
- if (applyLegacyColorMatrix) {
- if (applyColorMatrix) {
- legacyColorMatrix = colorMatrix * mLegacySrgbSaturationMatrix;
- } else {
- legacyColorMatrix = mLegacySrgbSaturationMatrix;
- }
- }
if (!displayDevice->makeCurrent()) {
ALOGW("DisplayDevice::makeCurrent failed. Aborting surface composition for display %s",
@@ -3085,18 +3076,14 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& displayDev
}
case HWC2::Composition::Client: {
// switch color matrices lazily
- if (layer->isLegacyDataSpace()) {
- if (applyLegacyColorMatrix && currentColorMatrix != &legacyColorMatrix) {
- // TODO(b/78891890) Legacy sRGB saturation matrix should be set
- // separately.
- getRenderEngine().setupColorTransform(legacyColorMatrix);
- currentColorMatrix = &legacyColorMatrix;
- }
- } else {
- if (applyColorMatrix && currentColorMatrix != &colorMatrix) {
- getRenderEngine().setupColorTransform(colorMatrix);
- currentColorMatrix = &colorMatrix;
+ if (layer->isLegacyDataSpace() && needsLegacyColorMatrix) {
+ if (!legacyColorMatrixApplied) {
+ getRenderEngine().setSaturationMatrix(mLegacySrgbSaturationMatrix);
+ legacyColorMatrixApplied = true;
}
+ } else if (legacyColorMatrixApplied) {
+ getRenderEngine().setSaturationMatrix(mat4());
+ legacyColorMatrixApplied = false;
}
layer->draw(renderArea, clip);
@@ -3111,9 +3098,12 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& displayDev
firstLayer = false;
}
- if (applyColorMatrix || applyLegacyColorMatrix) {
+ if (applyColorMatrix) {
getRenderEngine().setupColorTransform(mat4());
}
+ if (needsLegacyColorMatrix && legacyColorMatrixApplied) {
+ getRenderEngine().setSaturationMatrix(mat4());
+ }
// disable scissor at the end of the frame
getBE().mRenderEngine->disableScissor();