Loading graphics/composer/aidl/android/hardware/graphics/composer3/LutProperties.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ parcelable LutProperties { /** * SamplingKey is about how a Lut can be sampled. * A Lut can be sampled in more than one way, * but only one sampling method is used at one time. * A Lut can be sampled in more than one key, * but only one sampling key is used at one time. * * The implementations should use a sampling strategy * at least as good as linear sampling. Loading graphics/composer/aidl/android/hardware/graphics/composer3/Luts.aidl +5 −1 Original line number Diff line number Diff line Loading @@ -40,13 +40,15 @@ parcelable Luts { * For data precision, 32-bit float is used to specify a Lut by both the HWC and * the platform. * * * For unflattening/flattening 3D Lut(s), the algorithm below should be observed * by both the HWC and the platform. * Assuming that we have a 3D array `ORIGINAL[WIDTH, HEIGHT, DEPTH]`, we would turn it into * `FLAT[WIDTH * HEIGHT * DEPTH]` by * * `FLAT[z + DEPTH * (y + HEIGHT * x)] = ORIGINAL[x, y, z]` * * Noted that 1D Lut(s) should be gain curve ones * and 3D Lut(s) should be pure color lookup ones. */ @nullable ParcelFileDescriptor pfd; Loading @@ -60,6 +62,8 @@ parcelable Luts { /** * The properties list of the Luts. * * The number of sampling key inside should only be one. */ LutProperties[] lutProperties; } graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +54 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <android/hardware/graphics/composer3/ComposerClientReader.h> #include <android/hardware/graphics/composer3/ComposerClientWriter.h> #include <binder/ProcessState.h> #include <cutils/ashmem.h> #include <gtest/gtest.h> #include <ui/Fence.h> #include <ui/GraphicBuffer.h> Loading Loading @@ -3324,6 +3325,54 @@ TEST_P(GraphicsComposerAidlCommandV3Test, setLayerPictureProfileId_failsWithTooM } } class GraphicsComposerAidlCommandV4Test : public GraphicsComposerAidlCommandTest { protected: void SetUp() override { GraphicsComposerAidlTest::SetUp(); if (getInterfaceVersion() <= 3) { GTEST_SKIP() << "Device interface version is expected to be >= 4"; } } }; TEST_P(GraphicsComposerAidlCommandV4Test, SetUnsupportedLayerLuts) { auto& writer = getWriter(getPrimaryDisplayId()); const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount, &writer); EXPECT_TRUE(layerStatus.isOk()); 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"; return; } ASSERT_TRUE(status.isOk()); // TODO (b/362319189): add Lut VTS enforcement if (!properties.lutProperties) { int32_t size = 7; size_t bufferSize = static_cast<size_t>(size) * sizeof(float); int32_t fd = ashmem_create_region("lut_shared_mem", bufferSize); void* ptr = mmap(nullptr, bufferSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); std::vector<float> buffers = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; memcpy(ptr, buffers.data(), bufferSize); munmap(ptr, bufferSize); Luts luts; luts.offsets = {0}; luts.lutProperties = { {LutProperties::Dimension::ONE_D, size, {LutProperties::SamplingKey::RGB}}}; luts.pfd = ndk::ScopedFileDescriptor(fd); writer.setLayerLuts(getPrimaryDisplayId(), layer, luts); writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, VtsComposerClient::kNoFrameIntervalNs); execute(); // change to client composition ASSERT_FALSE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); ASSERT_TRUE(mReader.takeErrors().empty()); } } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandTest, Loading Loading @@ -3354,6 +3403,11 @@ INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandV3Test, testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), ::android::PrintInstanceNameToString); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandV4Test); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandV4Test, testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), ::android::PrintInstanceNameToString); } // namespace aidl::android::hardware::graphics::composer3::vts int main(int argc, char** argv) { Loading Loading
graphics/composer/aidl/android/hardware/graphics/composer3/LutProperties.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ parcelable LutProperties { /** * SamplingKey is about how a Lut can be sampled. * A Lut can be sampled in more than one way, * but only one sampling method is used at one time. * A Lut can be sampled in more than one key, * but only one sampling key is used at one time. * * The implementations should use a sampling strategy * at least as good as linear sampling. Loading
graphics/composer/aidl/android/hardware/graphics/composer3/Luts.aidl +5 −1 Original line number Diff line number Diff line Loading @@ -40,13 +40,15 @@ parcelable Luts { * For data precision, 32-bit float is used to specify a Lut by both the HWC and * the platform. * * * For unflattening/flattening 3D Lut(s), the algorithm below should be observed * by both the HWC and the platform. * Assuming that we have a 3D array `ORIGINAL[WIDTH, HEIGHT, DEPTH]`, we would turn it into * `FLAT[WIDTH * HEIGHT * DEPTH]` by * * `FLAT[z + DEPTH * (y + HEIGHT * x)] = ORIGINAL[x, y, z]` * * Noted that 1D Lut(s) should be gain curve ones * and 3D Lut(s) should be pure color lookup ones. */ @nullable ParcelFileDescriptor pfd; Loading @@ -60,6 +62,8 @@ parcelable Luts { /** * The properties list of the Luts. * * The number of sampling key inside should only be one. */ LutProperties[] lutProperties; }
graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +54 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <android/hardware/graphics/composer3/ComposerClientReader.h> #include <android/hardware/graphics/composer3/ComposerClientWriter.h> #include <binder/ProcessState.h> #include <cutils/ashmem.h> #include <gtest/gtest.h> #include <ui/Fence.h> #include <ui/GraphicBuffer.h> Loading Loading @@ -3324,6 +3325,54 @@ TEST_P(GraphicsComposerAidlCommandV3Test, setLayerPictureProfileId_failsWithTooM } } class GraphicsComposerAidlCommandV4Test : public GraphicsComposerAidlCommandTest { protected: void SetUp() override { GraphicsComposerAidlTest::SetUp(); if (getInterfaceVersion() <= 3) { GTEST_SKIP() << "Device interface version is expected to be >= 4"; } } }; TEST_P(GraphicsComposerAidlCommandV4Test, SetUnsupportedLayerLuts) { auto& writer = getWriter(getPrimaryDisplayId()); const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount, &writer); EXPECT_TRUE(layerStatus.isOk()); 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"; return; } ASSERT_TRUE(status.isOk()); // TODO (b/362319189): add Lut VTS enforcement if (!properties.lutProperties) { int32_t size = 7; size_t bufferSize = static_cast<size_t>(size) * sizeof(float); int32_t fd = ashmem_create_region("lut_shared_mem", bufferSize); void* ptr = mmap(nullptr, bufferSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); std::vector<float> buffers = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; memcpy(ptr, buffers.data(), bufferSize); munmap(ptr, bufferSize); Luts luts; luts.offsets = {0}; luts.lutProperties = { {LutProperties::Dimension::ONE_D, size, {LutProperties::SamplingKey::RGB}}}; luts.pfd = ndk::ScopedFileDescriptor(fd); writer.setLayerLuts(getPrimaryDisplayId(), layer, luts); writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, VtsComposerClient::kNoFrameIntervalNs); execute(); // change to client composition ASSERT_FALSE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); ASSERT_TRUE(mReader.takeErrors().empty()); } } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandTest, Loading Loading @@ -3354,6 +3403,11 @@ INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandV3Test, testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), ::android::PrintInstanceNameToString); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandV4Test); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandV4Test, testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), ::android::PrintInstanceNameToString); } // namespace aidl::android::hardware::graphics::composer3::vts int main(int argc, char** argv) { Loading