summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Peiyong Lin <lpy@google.com> 2018-09-18 16:01:31 -0700
committer Peiyong Lin <lpy@google.com> 2018-09-28 13:20:37 -0700
commitd3788632cfc226386f7c7e30612ed2584b6ecb46 (patch)
tree5bbaf8841bf31e049180e6dd26262055e512febd /libs/gui/LayerState.cpp
parent48de54237ee300ae04c15c07a9dbdd93e746b068 (diff)
[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
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 5a8d8dbc81..2b0a46181b 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -77,6 +77,9 @@ status_t layer_state_t::write(Parcel& output) const
output.writeBool(false);
}
+ memcpy(output.writeInplace(16 * sizeof(float)),
+ colorTransform.asArray(), 16 * sizeof(float));
+
return NO_ERROR;
}
@@ -130,6 +133,8 @@ status_t layer_state_t::read(const Parcel& input)
sidebandStream = NativeHandle::create(input.readNativeHandle(), true);
}
+ colorTransform = mat4(static_cast<const float*>(input.readInplace(16 * sizeof(float))));
+
return NO_ERROR;
}
@@ -314,6 +319,10 @@ void layer_state_t::merge(const layer_state_t& other) {
what |= eSidebandStreamChanged;
sidebandStream = other.sidebandStream;
}
+ if (other.what & eColorTransformChanged) {
+ what |= eColorTransformChanged;
+ colorTransform = other.colorTransform;
+ }
if ((other.what & what) != other.what) {
ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "