From d3788632cfc226386f7c7e30612ed2584b6ecb46 Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Tue, 18 Sep 2018 16:01:31 -0700 Subject: [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 --- libs/gui/LayerState.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libs/gui/LayerState.cpp') 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(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? " -- cgit v1.2.3-59-g8ed1b