summaryrefslogtreecommitdiff
path: root/gralloc4
diff options
context:
space:
mode:
authorAnkit Goyal <layog@google.com>2021-06-25 21:19:00 +0800
committerAnkit Goyal <layog@google.com>2021-07-01 23:20:42 +0800
commit27d4aa1db7cb69ef1b38a4cf61df57236d31ad5c (patch)
tree34e5ee51558af6b806c5d7d9a3019d967687eec8 /gralloc4
parent2877762dd5e6693448db63d3cff2709bd8a755b1 (diff)
downloadgchips-27d4aa1db7cb69ef1b38a4cf61df57236d31ad5c.tar.gz
Decouple metadata operations from implementation
Bug: 191912915 Test: Full-range video playback with known calls to set_dataspace Change-Id: I9ee1419922a316f3ce0e303ab46c2e46d1b72fec
Diffstat (limited to 'gralloc4')
-rw-r--r--gralloc4/src/hidl_common/Mapper.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/gralloc4/src/hidl_common/Mapper.cpp b/gralloc4/src/hidl_common/Mapper.cpp
index bfe632d..80ea7e1 100644
--- a/gralloc4/src/hidl_common/Mapper.cpp
+++ b/gralloc4/src/hidl_common/Mapper.cpp
@@ -623,6 +623,14 @@ void get(void *buffer, const IMapper::MetadataType &metadataType, IMapper::get_c
hidl_cb(Error::BAD_BUFFER, hidl_vec<uint8_t>());
return;
}
+
+ if (mali_gralloc_reference_validate((buffer_handle_t)handle) < 0)
+ {
+ MALI_GRALLOC_LOGE("Buffer: %p is not imported", handle);
+ hidl_cb(Error::BAD_VALUE, hidl_vec<uint8_t>());
+ return;
+ }
+
get_metadata(handle, metadataType, hidl_cb);
}
@@ -635,6 +643,13 @@ Error set(void *buffer, const IMapper::MetadataType &metadataType, const hidl_ve
MALI_GRALLOC_LOGE("Buffer: %p has not been registered with Gralloc", buffer);
return Error::BAD_BUFFER;
}
+
+ if (mali_gralloc_reference_validate((buffer_handle_t)handle) < 0)
+ {
+ MALI_GRALLOC_LOGE("Buffer: %p is not imported", handle);
+ return Error::BAD_VALUE;
+ }
+
return set_metadata(handle, metadataType, metadata);
}