[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/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index a08ae8c..4ea587d 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -321,7 +321,10 @@
}
error = hwcLayer->setColorTransform(getColorTransform());
- if (error != HWC2::Error::None) {
+ if (error == HWC2::Error::Unsupported) {
+ // If per layer color transform is not supported, we use GPU composition.
+ setCompositionType(displayDevice, Hwc2::IComposerClient::Composition::CLIENT);
+ } else if (error != HWC2::Error::None) {
ALOGE("[%s] Failed to setColorTransform: %s (%d)", mName.string(),
to_string(error).c_str(), static_cast<int32_t>(error));
}