diff options
author | Yichi Chen <yichichen@google.com> | 2020-05-27 16:29:56 +0800 |
---|---|---|
committer | Yichi Chen <yichichen@google.com> | 2020-06-08 16:42:39 +0800 |
commit | 0809466b61f72960cdfbd0d6b969667f031525de (patch) | |
tree | da63122d163405f90c48293de2903fa140b736b7 /graphics | |
parent | cda23ea38eb55adf870fc47488f7f9e0ca1b9c6d (diff) | |
download | platform_hardware_interfaces-0809466b61f72960cdfbd0d6b969667f031525de.tar.gz platform_hardware_interfaces-0809466b61f72960cdfbd0d6b969667f031525de.tar.bz2 platform_hardware_interfaces-0809466b61f72960cdfbd0d6b969667f031525de.zip |
gralloc4-vts: Test layout and component info of RAW10
To ensure the correctness of the plane layout and layout component on
RAW10 format, the patch creates the test case to check corresponding
data.
Bug: 157534008
Test: VtsHalGraphicsMapperV4_0TargetTest
Change-Id: Ie504e687e149ee4f4fb3f715ee0de7d7ec31952a
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 529fb1817a..f0153ba4ed 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -605,6 +605,9 @@ TEST_P(GraphicsMapperHidlTest, LockUnlockBasic) { ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); } +/** + * Test multiple operations associated with different color formats + */ TEST_P(GraphicsMapperHidlTest, Lock_YCRCB_420_SP) { auto info = mDummyDescriptorInfo; info.format = PixelFormat::YCRCB_420_SP; @@ -751,6 +754,48 @@ TEST_P(GraphicsMapperHidlTest, Lock_YCBCR_420_888) { ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); } +TEST_P(GraphicsMapperHidlTest, Lock_RAW10) { + auto info = mDummyDescriptorInfo; + info.format = PixelFormat::RAW10; + + const native_handle_t* bufferHandle; + uint32_t stride; + ASSERT_NO_FATAL_FAILURE(bufferHandle = mGralloc->allocate( + info, true, Tolerance::kToleranceUnSupported, &stride)); + if (bufferHandle == nullptr) { + GTEST_SUCCEED() << "RAW10 format is unsupported"; + return; + } + + const IMapper::Rect region{0, 0, static_cast<int32_t>(info.width), + static_cast<int32_t>(info.height)}; + unique_fd fence; + + ASSERT_NO_FATAL_FAILURE(mGralloc->lock(bufferHandle, info.usage, region, fence.get())); + + hidl_vec<uint8_t> vec; + ASSERT_EQ(Error::NONE, mGralloc->get(bufferHandle, gralloc4::MetadataType_PlaneLayouts, &vec)); + std::vector<PlaneLayout> planeLayouts; + ASSERT_EQ(NO_ERROR, gralloc4::decodePlaneLayouts(vec, &planeLayouts)); + + ASSERT_EQ(1, planeLayouts.size()); + auto planeLayout = planeLayouts[0]; + + EXPECT_EQ(0, planeLayout.sampleIncrementInBits); + EXPECT_EQ(1, planeLayout.horizontalSubsampling); + EXPECT_EQ(1, planeLayout.verticalSubsampling); + + ASSERT_EQ(1, planeLayout.components.size()); + auto planeLayoutComponent = planeLayout.components[0]; + + EXPECT_EQ(PlaneLayoutComponentType::RAW, + static_cast<PlaneLayoutComponentType>(planeLayoutComponent.type.value)); + EXPECT_EQ(0, planeLayoutComponent.offsetInBits % 8); + EXPECT_EQ(-1, planeLayoutComponent.sizeInBits); + + ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); +} + /** * Test IMapper::unlock with bad access region */ |