gralloc: Add support for QtiMapperExtension version 1.1
Add new API getSurfaceMetadata_V1() which will take a valid pointer
to surface metadata and fill it with metadata values.
CRs-Fixed: 2505696
Change-Id: I82882a7cb36a5bd18417fd43a19976e078c77ca9
diff --git a/gralloc/QtiMapperExtensions.cpp b/gralloc/QtiMapperExtensions.cpp
index afe3efa..56b747b 100644
--- a/gralloc/QtiMapperExtensions.cpp
+++ b/gralloc/QtiMapperExtensions.cpp
@@ -40,7 +40,7 @@
namespace hardware {
namespace display {
namespace mapperextensions {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using gralloc::BufferInfo;
@@ -351,8 +351,23 @@
return Void();
}
+Return<Error> QtiMapperExtensions::getSurfaceMetadata_V1(void *buffer, void *metadata) {
+ auto err = Error::BAD_BUFFER;
+ auto hnd = static_cast<private_handle_t *>(buffer);
+ if (metadata != nullptr && buffer != nullptr && private_handle_t::validate(hnd) == 0) {
+ if (getMetaData(hnd, GET_GRAPHICS_METADATA, metadata) == 0) {
+ err = Error::NONE;
+ } else {
+ err = Error::UNSUPPORTED;
+ }
+ } else {
+ ALOGE("%s: buffer pointer: %p, metadata pointer: %p ", __FUNCTION__, buffer, metadata);
+ }
+ return err;
+}
+
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace mapperextensions
} // namespace display
} // namespace hardware