From c2c392fbea425bb1bbaf09314ef50eec1ab4035d Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Fri, 13 Jan 2023 14:50:20 -0800 Subject: [PATCH] [Aidl graphics API] split dataspace array into tuples. - update VTS test to make sure primaries/transfers/ranges bits are correct. Bug: 242588489 Test: build and flash; atest VtsHalGraphicsComposer3_TargetTest Change-Id: I77536d97b98e4dead208b7c8aeed9cfbb0d82316 --- .../graphics/composer3/OverlayProperties.aidl | 4 +++- .../graphics/composer3/OverlayProperties.aidl | 22 +++++++++++++------ .../VtsHalGraphicsComposer3_TargetTest.cpp | 19 +++++++++++++++- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl index 3db134e3fe..7d31ea3b1e 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -38,6 +38,8 @@ parcelable OverlayProperties { boolean supportMixedColorSpaces; parcelable SupportedBufferCombinations { android.hardware.graphics.common.PixelFormat[] pixelFormats; - android.hardware.graphics.common.Dataspace[] dataspaces; + android.hardware.graphics.common.Dataspace[] standards; + android.hardware.graphics.common.Dataspace[] transfers; + android.hardware.graphics.common.Dataspace[] ranges; } } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl index 32688e2530..c25eea484f 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -19,16 +19,24 @@ package android.hardware.graphics.composer3; @VintfStability parcelable OverlayProperties { parcelable SupportedBufferCombinations { - // List of pixelformats and dataspaces that can be used together. - // All pixelformats and dataspaces stored inside are valid combinations. + // List of pixelformats, standards, transfers and ranges dataspaces that can be used + // together. + // The pixelformats, standards, transfers and ranges stored inside are valid + // combinations. + // Dataspace identifies three components of colors - standard, transfer and + // range. android.hardware.graphics.common.PixelFormat[] pixelFormats; - android.hardware.graphics.common.Dataspace[] dataspaces; + android.hardware.graphics.common.Dataspace[] standards; + android.hardware.graphics.common.Dataspace[] transfers; + android.hardware.graphics.common.Dataspace[] ranges; } - // Array of all valid pixelformat and dataspace combinations. - // If all supported formats work with all supported dataspaces, + // Array of all valid pixelformat, standard, transfer and range combinations. + // If all supported formats work with all standards, transfers and ranges, // then this list may only have 1 entry. - // If some dataspaces, e.g. scRGB, only work with specific formats, - // then this list may contain more than 1 entry. + // If some dataspaces, e.g. scRGB (STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED), + // only work with specific formats, then this list may contain more than 1 entry. + // If some ranges, e.g. RANGE_LIMITED, only work with specific + // formats/standards/transfers, then this list may contain more than 1 entry. SupportedBufferCombinations[] combinations; // True if the DPU is able to color manage at least two overlays diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 7b852e029d..15128ca649 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -812,7 +812,7 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) { } TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { - const auto& [status, _] = mComposerClient->getOverlaySupport(); + const auto& [status, properties] = mComposerClient->getOverlaySupport(); if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { GTEST_SUCCEED() << "getOverlaySupport is not supported"; @@ -820,6 +820,23 @@ TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { } ASSERT_TRUE(status.isOk()); + for (const auto& i : properties.combinations) { + for (const auto standard : i.standards) { + const auto val = static_cast(standard) & + static_cast(common::Dataspace::STANDARD_MASK); + ASSERT_TRUE(val == static_cast(standard)); + } + for (const auto transfer : i.transfers) { + const auto val = static_cast(transfer) & + static_cast(common::Dataspace::TRANSFER_MASK); + ASSERT_TRUE(val == static_cast(transfer)); + } + for (const auto range : i.ranges) { + const auto val = static_cast(range) & + static_cast(common::Dataspace::RANGE_MASK); + ASSERT_TRUE(val == static_cast(range)); + } + } } TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) {