Pass display's colorTransform to RE even if HW handles it
Even if the DPU handles the colorTransform, RE needs to know about it
for A8 screen decorations layers. So pass the colorTransform to RE
always. Add a new boolean, specifying whether the DPU handles it, so
existing use cases can continue to ignore it.
RE uses a color matrix to turn transparent pixels in the A8 screen
decorations layer to black, providing antialiasing. If the DPU handles
the colorTransform, that black will then be converted to another color
(e.g. white, if the colorTransform comes from the "Color inversion"
accesibility feature). So RE needs to convert it to a color that the DPU
will then convert back to black, matching plastic next to the screen. Do
this by inverting the upper left 3x3 of the matrix and applying it to
black. If the color matrix is not invertible (note that the one used for
"Color inversion" *is*), leave black unchanged.
If the DPU does not handle the colorTransform, concat the A8 layer's
color matrix with the colorTransform.
Update libcompositionengine_test to use the proper colorTransform.
Add GTEST_SKIP if R8 buffers are not supported (follow-up from
I340de485fd62bea12a5a097f09073c4f7d58fa90).
Bug: 215706351
Bug: 216178319
Test: librenderengine_test
Test: libcompositionengine_test
Test: manual
Change-Id: Ib127620be4e5fc400ac2525c90dea1b9a29bd1f7
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index 65f9731..e036252 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -1079,9 +1079,9 @@
clientCompositionDisplay.targetLuminanceNits = outputState.clientTargetWhitePointNits;
// Compute the global color transform matrix.
- if (!outputState.usesDeviceComposition && !getSkipColorTransform()) {
- clientCompositionDisplay.colorTransform = outputState.colorTransformMatrix;
- }
+ clientCompositionDisplay.colorTransform = outputState.colorTransformMatrix;
+ clientCompositionDisplay.deviceHandlesColorTransform =
+ outputState.usesDeviceComposition || getSkipColorTransform();
// Generate the client composition requests for the layers on this output.
std::vector<LayerFE*> clientCompositionLayersFE;