[SurfaceFlinger] Implement per layer color transformation.
Previously we introduced a new composer HAL API to set color transform for per
layer and added the plumbing in SurfaceFlinger. This patch implements the
functionality and alwasy mark those layers to fall back to GPU composition
until composer 2.3 is implemented.
BUG: 111562338
Test: Build, boot, flash, tested by setting a greyscale matrix on Settings
Test: adb shell /data/nativetest/SurfaceFlinger_test/SurfaceFlinger_test
Change-Id: If8d5ed52bf920d8cc962602196fb1b0b6e2955da
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 09ea0f6..1ac9609 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -602,6 +602,18 @@
return *this;
}
+SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColorTransform(
+ const sp<SurfaceControl>& sc, const mat3& matrix, const vec3& translation) {
+ layer_state_t* s = getLayerState(sc);
+ if (!s) {
+ mStatus = BAD_INDEX;
+ return *this;
+ }
+ s->what |= layer_state_t::eColorTransformChanged;
+ s->colorTransform = mat4(matrix, translation);
+ return *this;
+}
+
// ---------------------------------------------------------------------------
DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {