Do not send HdrMetadata on older interface
Need to make sure composer@2.2 is supported before sending
HDR data across composer interface.
Test: boot
Bug: 74523164
Change-Id: I551c8568098990193309939483f10a30cc47350c
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index b804af8..d22c021 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -631,7 +631,7 @@
const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata();
error = hwcLayer->setHdrMetadata(metadata);
- if (error != HWC2::Error::None) {
+ if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) {
ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(),
to_string(error).c_str(), static_cast<int32_t>(error));
}
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
index bb720f7..0425a8a 100644
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
@@ -706,6 +706,9 @@
}
Error Composer::setLayerHdrMetadata(Display display, Layer layer, const HdrMetadata& metadata) {
+ if (!mClient_2_2) {
+ return Error::UNSUPPORTED;
+ }
mWriter.selectDisplay(display);
mWriter.selectLayer(layer);