Loading graphics/mapper/4.0/IMapper.hal +38 −0 Original line number Diff line number Diff line Loading @@ -515,5 +515,43 @@ interface IMapper { MetadataType metadataType) generates (Error error, vec<uint8_t> metadata); struct MetadataTypeDescription { MetadataType metadataType; /** * description should contain a string representation of the MetadataType. * * For example: "MyExampleMetadataType is a 64-bit timestamp in nanoseconds * that indicates when a buffer is decoded. It is set by the media HAL after * a buffer is decoded. It is used by the display HAL for hardware * synchronization". * * This field is required for any non-StandardMetadataTypes. */ string description; /** * isGettable represents if the MetadataType can be get. */ bool isGettable; /** * isSettable represents if the MetadataType can be set. */ bool isSettable; }; /** * Lists all the MetadataTypes supported by IMapper as well as a description * of each supported MetadataType. For StandardMetadataTypes, the description * string can be left empty. * * @return error Error status of the call, which may be * - `NONE` upon success. * - `NO_RESOURCES` if the get cannot be fullfilled due to unavailability of * resources. * @return descriptions Vector of MetadataTypeDescriptions that represent the * MetadataTypes supported by the device. */ listSupportedMetadataTypes() generates (Error error, vec<MetadataTypeDescription> descriptions); }; graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +70 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ using aidl::android::hardware::graphics::common::Dataspace; using aidl::android::hardware::graphics::common::ExtendableType; using aidl::android::hardware::graphics::common::PlaneLayout; using aidl::android::hardware::graphics::common::PlaneLayoutComponent; using aidl::android::hardware::graphics::common::StandardMetadataType; using DecodeFunction = std::function<void(const IMapper::BufferDescriptorInfo& descriptorInfo, const hidl_vec<uint8_t>& vec)>; Loading Loading @@ -162,6 +163,27 @@ class GraphicsMapperHidlTest : public ::testing::VtsHalHidlTargetTestBase { std::unique_ptr<Gralloc> mGralloc; IMapper::BufferDescriptorInfo mDummyDescriptorInfo{}; static const std::set<StandardMetadataType> sRequiredMetadataTypes; }; const std::set<StandardMetadataType> GraphicsMapperHidlTest::sRequiredMetadataTypes{ StandardMetadataType::BUFFER_ID, StandardMetadataType::NAME, StandardMetadataType::WIDTH, StandardMetadataType::HEIGHT, StandardMetadataType::LAYER_COUNT, StandardMetadataType::PIXEL_FORMAT_REQUESTED, StandardMetadataType::PIXEL_FORMAT_FOURCC, StandardMetadataType::PIXEL_FORMAT_MODIFIER, StandardMetadataType::USAGE, StandardMetadataType::ALLOCATION_SIZE, StandardMetadataType::PROTECTED_CONTENT, StandardMetadataType::COMPRESSION, StandardMetadataType::INTERLACED, StandardMetadataType::CHROMA_SITING, StandardMetadataType::PLANE_LAYOUTS, StandardMetadataType::DATASPACE, StandardMetadataType::BLEND_MODE, }; /** Loading Loading @@ -1591,6 +1613,54 @@ TEST_F(GraphicsMapperHidlTest, GetFromBufferDescriptorInfoUnsupportedStandardMet ASSERT_EQ(0, vec.size()); } /** * Test IMapper::listSupportedMetadataTypes() */ TEST_F(GraphicsMapperHidlTest, ListSupportedMetadataTypes) { hidl_vec<IMapper::MetadataTypeDescription> descriptions; mGralloc->getMapper()->listSupportedMetadataTypes( [&](const auto& tmpError, const auto& tmpDescriptions) { ASSERT_EQ(Error::NONE, tmpError); descriptions = tmpDescriptions; }); std::set<StandardMetadataType> foundMetadataTypes; std::set<StandardMetadataType> notSettableMetadataTypes{ StandardMetadataType::BUFFER_ID, StandardMetadataType::NAME, StandardMetadataType::WIDTH, StandardMetadataType::HEIGHT, StandardMetadataType::LAYER_COUNT, StandardMetadataType::PIXEL_FORMAT_REQUESTED, StandardMetadataType::USAGE}; ASSERT_LE(sRequiredMetadataTypes.size(), descriptions.size()); for (const auto& description : descriptions) { const auto& metadataType = description.metadataType; if (!gralloc4::isStandardMetadataType(metadataType)) { EXPECT_GT(0, description.description.size()); continue; } StandardMetadataType type = gralloc4::getStandardMetadataTypeValue(metadataType); if (sRequiredMetadataTypes.find(type) == sRequiredMetadataTypes.end()) { continue; } ASSERT_EQ(foundMetadataTypes.find(type), foundMetadataTypes.end()); foundMetadataTypes.insert(type); ASSERT_TRUE(description.isGettable); if (notSettableMetadataTypes.find(type) != notSettableMetadataTypes.end()) { ASSERT_FALSE(description.isSettable); } } ASSERT_EQ(sRequiredMetadataTypes, foundMetadataTypes); } } // namespace } // namespace vts } // namespace V4_0 Loading Loading
graphics/mapper/4.0/IMapper.hal +38 −0 Original line number Diff line number Diff line Loading @@ -515,5 +515,43 @@ interface IMapper { MetadataType metadataType) generates (Error error, vec<uint8_t> metadata); struct MetadataTypeDescription { MetadataType metadataType; /** * description should contain a string representation of the MetadataType. * * For example: "MyExampleMetadataType is a 64-bit timestamp in nanoseconds * that indicates when a buffer is decoded. It is set by the media HAL after * a buffer is decoded. It is used by the display HAL for hardware * synchronization". * * This field is required for any non-StandardMetadataTypes. */ string description; /** * isGettable represents if the MetadataType can be get. */ bool isGettable; /** * isSettable represents if the MetadataType can be set. */ bool isSettable; }; /** * Lists all the MetadataTypes supported by IMapper as well as a description * of each supported MetadataType. For StandardMetadataTypes, the description * string can be left empty. * * @return error Error status of the call, which may be * - `NONE` upon success. * - `NO_RESOURCES` if the get cannot be fullfilled due to unavailability of * resources. * @return descriptions Vector of MetadataTypeDescriptions that represent the * MetadataTypes supported by the device. */ listSupportedMetadataTypes() generates (Error error, vec<MetadataTypeDescription> descriptions); };
graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +70 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ using aidl::android::hardware::graphics::common::Dataspace; using aidl::android::hardware::graphics::common::ExtendableType; using aidl::android::hardware::graphics::common::PlaneLayout; using aidl::android::hardware::graphics::common::PlaneLayoutComponent; using aidl::android::hardware::graphics::common::StandardMetadataType; using DecodeFunction = std::function<void(const IMapper::BufferDescriptorInfo& descriptorInfo, const hidl_vec<uint8_t>& vec)>; Loading Loading @@ -162,6 +163,27 @@ class GraphicsMapperHidlTest : public ::testing::VtsHalHidlTargetTestBase { std::unique_ptr<Gralloc> mGralloc; IMapper::BufferDescriptorInfo mDummyDescriptorInfo{}; static const std::set<StandardMetadataType> sRequiredMetadataTypes; }; const std::set<StandardMetadataType> GraphicsMapperHidlTest::sRequiredMetadataTypes{ StandardMetadataType::BUFFER_ID, StandardMetadataType::NAME, StandardMetadataType::WIDTH, StandardMetadataType::HEIGHT, StandardMetadataType::LAYER_COUNT, StandardMetadataType::PIXEL_FORMAT_REQUESTED, StandardMetadataType::PIXEL_FORMAT_FOURCC, StandardMetadataType::PIXEL_FORMAT_MODIFIER, StandardMetadataType::USAGE, StandardMetadataType::ALLOCATION_SIZE, StandardMetadataType::PROTECTED_CONTENT, StandardMetadataType::COMPRESSION, StandardMetadataType::INTERLACED, StandardMetadataType::CHROMA_SITING, StandardMetadataType::PLANE_LAYOUTS, StandardMetadataType::DATASPACE, StandardMetadataType::BLEND_MODE, }; /** Loading Loading @@ -1591,6 +1613,54 @@ TEST_F(GraphicsMapperHidlTest, GetFromBufferDescriptorInfoUnsupportedStandardMet ASSERT_EQ(0, vec.size()); } /** * Test IMapper::listSupportedMetadataTypes() */ TEST_F(GraphicsMapperHidlTest, ListSupportedMetadataTypes) { hidl_vec<IMapper::MetadataTypeDescription> descriptions; mGralloc->getMapper()->listSupportedMetadataTypes( [&](const auto& tmpError, const auto& tmpDescriptions) { ASSERT_EQ(Error::NONE, tmpError); descriptions = tmpDescriptions; }); std::set<StandardMetadataType> foundMetadataTypes; std::set<StandardMetadataType> notSettableMetadataTypes{ StandardMetadataType::BUFFER_ID, StandardMetadataType::NAME, StandardMetadataType::WIDTH, StandardMetadataType::HEIGHT, StandardMetadataType::LAYER_COUNT, StandardMetadataType::PIXEL_FORMAT_REQUESTED, StandardMetadataType::USAGE}; ASSERT_LE(sRequiredMetadataTypes.size(), descriptions.size()); for (const auto& description : descriptions) { const auto& metadataType = description.metadataType; if (!gralloc4::isStandardMetadataType(metadataType)) { EXPECT_GT(0, description.description.size()); continue; } StandardMetadataType type = gralloc4::getStandardMetadataTypeValue(metadataType); if (sRequiredMetadataTypes.find(type) == sRequiredMetadataTypes.end()) { continue; } ASSERT_EQ(foundMetadataTypes.find(type), foundMetadataTypes.end()); foundMetadataTypes.insert(type); ASSERT_TRUE(description.isGettable); if (notSettableMetadataTypes.find(type) != notSettableMetadataTypes.end()) { ASSERT_FALSE(description.isSettable); } } ASSERT_EQ(sRequiredMetadataTypes, foundMetadataTypes); } } // namespace } // namespace vts } // namespace V4_0 Loading