[SurfaceFlinger] Use GPU composition for per layer color transform when necessary.
Previously we moved the fallback mechanism to composer@2.3 passthrough, as a
result composer before 2.3 can't trigger GPU composition. This patch help
proactively set the composition type to CLIENT on devices that don't upgrade to
composer@2.3.
BUG: 130621073
Test: Verify with customized grayscaled matrix.
Change-Id: I08e6a215872a62008deef708444245bd50807640
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index 9690605..3012ed8 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -1029,9 +1029,13 @@
if (matrix == mColorMatrix) {
return Error::None;
}
- mColorMatrix = matrix;
auto intError = mComposer.setLayerColorTransform(mDisplayId, mId, matrix.asArray());
- return static_cast<Error>(intError);
+ Error error = static_cast<Error>(intError);
+ if (error != Error::None) {
+ return error;
+ }
+ mColorMatrix = matrix;
+ return error;
}
} // namespace impl