summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-29 00:21:40 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-29 00:21:40 +0000
commitdc666acc6e8be0de1f0db62620c66ef641ded2d4 (patch)
treed2f173c78f7c79b8ca90e7f965a3143c4e756806
parent1f42d5d0ca778aac3032a8579712a8741942b745 (diff)
parentf98c943a53019a0afae57dbc4459ce610f48e331 (diff)
downloadgchips-android13-qpr2-b-s1-release.tar.gz
Change-Id: Ib195649ba2adbaa838b4ddada3c7e44a0e19c3a0
-rw-r--r--libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp b/libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp
index a155519..ac3fc93 100644
--- a/libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp
+++ b/libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp
@@ -45,8 +45,7 @@ using android::hardware::graphics::mapper::V4_0::Error;
// libraries and should depend upon HAL (and it's extension) to call into
// Gralloc.
int mali_gralloc_reference_validate(buffer_handle_t handle) {
- auto hnd = static_cast<const private_handle_t *>(handle);
- return private_handle_t::validate(hnd);
+ return private_handle_t::validate(handle);
}
const private_handle_t * convertNativeHandleToPrivateHandle(buffer_handle_t handle) {
@@ -70,7 +69,7 @@ android::sp<IMapper> get_mapper() {
int VendorGraphicBufferMeta::get_video_metadata_fd(buffer_handle_t hnd)
{
- const private_handle_t *gralloc_hnd = static_cast<const private_handle_t *>(hnd);
+ const auto *gralloc_hnd = convertNativeHandleToPrivateHandle(hnd);
if (!gralloc_hnd)
return -EINVAL;
@@ -136,7 +135,7 @@ int VendorGraphicBufferMeta::set_dataspace(buffer_handle_t hnd, android_dataspac
int VendorGraphicBufferMeta::is_afbc(buffer_handle_t hnd)
{
- const private_handle_t *gralloc_hnd = static_cast<const private_handle_t *>(hnd);
+ const auto *gralloc_hnd = convertNativeHandleToPrivateHandle(hnd);
if (!gralloc_hnd)
return 0;
@@ -147,11 +146,9 @@ int VendorGraphicBufferMeta::is_afbc(buffer_handle_t hnd)
return 0;
}
-int VendorGraphicBufferMeta::is_sbwc(buffer_handle_t buffer_hnd_p)
+int VendorGraphicBufferMeta::is_sbwc(buffer_handle_t hnd)
{
- const private_handle_t *hnd = static_cast<const private_handle_t *>(buffer_hnd_p);
-
- return is_sbwc_format(static_cast<uint32_t>(hnd->alloc_format & MALI_GRALLOC_INTFMT_FMT_MASK));
+ return is_sbwc_format(VendorGraphicBufferMeta::get_internal_format(hnd));
}
#define GRALLOC_META_GETTER(__type__, __name__, __member__) \
@@ -165,7 +162,8 @@ __type__ VendorGraphicBufferMeta::get_##__name__(buffer_handle_t hnd) \
uint32_t VendorGraphicBufferMeta::get_format(buffer_handle_t hnd)
{
- const private_handle_t *gralloc_hnd = static_cast<const private_handle_t *>(hnd);
+ const auto *gralloc_hnd = convertNativeHandleToPrivateHandle(hnd);
+
if (!gralloc_hnd)
return 0;
@@ -174,7 +172,8 @@ uint32_t VendorGraphicBufferMeta::get_format(buffer_handle_t hnd)
uint64_t VendorGraphicBufferMeta::get_internal_format(buffer_handle_t hnd)
{
- const private_handle_t *gralloc_hnd = static_cast<const private_handle_t *>(hnd);
+ const auto *gralloc_hnd = convertNativeHandleToPrivateHandle(hnd);;
+
if (!gralloc_hnd)
return 0;
@@ -196,7 +195,7 @@ GRALLOC_META_GETTER(uint64_t, flags, flags);
int VendorGraphicBufferMeta::get_fd(buffer_handle_t hnd, int num)
{
- const private_handle_t *gralloc_hnd = static_cast<const private_handle_t *>(hnd);
+ const auto *gralloc_hnd = convertNativeHandleToPrivateHandle(hnd);
if (!gralloc_hnd)
return -1;
@@ -209,7 +208,7 @@ int VendorGraphicBufferMeta::get_fd(buffer_handle_t hnd, int num)
int VendorGraphicBufferMeta::get_size(buffer_handle_t hnd, int num)
{
- const private_handle_t *gralloc_hnd = static_cast<const private_handle_t *>(hnd);
+ const auto *gralloc_hnd = convertNativeHandleToPrivateHandle(hnd);
if (!gralloc_hnd)
return 0;
@@ -223,7 +222,7 @@ int VendorGraphicBufferMeta::get_size(buffer_handle_t hnd, int num)
uint64_t VendorGraphicBufferMeta::get_usage(buffer_handle_t hnd)
{
- const private_handle_t *gralloc_hnd = static_cast<const private_handle_t *>(hnd);
+ const auto *gralloc_hnd = convertNativeHandleToPrivateHandle(hnd);
if (!gralloc_hnd)
return 0;
@@ -257,7 +256,7 @@ void* VendorGraphicBufferMeta::get_video_metadata_roiinfo(buffer_handle_t hnd)
void VendorGraphicBufferMeta::init(const buffer_handle_t handle)
{
- const private_handle_t *gralloc_hnd = static_cast<const private_handle_t *>(handle);
+ const auto *gralloc_hnd = convertNativeHandleToPrivateHandle(handle);
if (!gralloc_hnd)
return;