summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Goyal <layog@google.com>2023-10-05 22:07:35 -0700
committerAnkit Goyal <layog@google.com>2023-10-06 23:17:27 +0000
commite4bb448a7b080f306010bbd54f843698128a75f2 (patch)
tree73c3d67dcbaae8b9a65b8a12a571af068e8af797
parentb02314c22da225bcc0951307a26fe99a9f431a9c (diff)
downloadgchips-e4bb448a7b080f306010bbd54f843698128a75f2.tar.gz
libvendorgraphicbuffer: Use mapper::get for pixel metadata
Bug: 176048725 Test: Boot to home Test: Custom logs in the graphics driver Change-Id: I8760dacef8cacd16f41e8e242587e7bc88ee1830
-rw-r--r--libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp49
1 files changed, 10 insertions, 39 deletions
diff --git a/libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp b/libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp
index eb8d663..a39b4db 100644
--- a/libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp
+++ b/libvendorgraphicbuffer/gralloc4/vendor_graphicbuffer_meta.cpp
@@ -28,6 +28,7 @@
#include "exynos_format.h"
#include <pixel-gralloc/metadata.h>
+#include <pixel-gralloc/mapper.h>
using namespace android;
using namespace vendor::graphics;
@@ -244,30 +245,15 @@ void* VendorGraphicBufferMeta::get_video_metadata(buffer_handle_t hnd)
return nullptr;
}
- MapperMetadataType metadata_type{
- .name = ::pixel::graphics::kPixelMetadataTypeName,
- .value = static_cast<int64_t>(::pixel::graphics::MetadataType::VIDEO_HDR),
- };
+ using namespace ::pixel::graphics;
+ auto out_oe = mapper::get<MetadataType::VIDEO_HDR>(handle);
- Error error = Error::NONE;
- void* output = nullptr;
-
- get_mapper()->get(handle, metadata_type,
- [&](const auto& tmpError, const android::hardware::hidl_vec<uint8_t>& tmpVec) {
- error = tmpError;
- if (error != Error::NONE) {
- return;
- }
- output = decodePointer(tmpVec);
- });
-
-
- if (error != Error::NONE) {
+ if (!out_oe.has_value()) {
ALOGE("Failed to get video HDR metadata");
return nullptr;
}
- return output;
+ return out_oe.value();
}
void* VendorGraphicBufferMeta::get_video_metadata_roiinfo(buffer_handle_t hnd)
@@ -277,30 +263,15 @@ void* VendorGraphicBufferMeta::get_video_metadata_roiinfo(buffer_handle_t hnd)
return nullptr;
}
- MapperMetadataType metadata_type{
- .name = ::pixel::graphics::kPixelMetadataTypeName,
- .value = static_cast<int64_t>(::pixel::graphics::MetadataType::VIDEO_ROI),
- };
+ using namespace ::pixel::graphics;
+ auto out_oe = mapper::get<MetadataType::VIDEO_ROI>(handle);
- Error error = Error::NONE;
- void* output = nullptr;
-
- get_mapper()->get(handle, metadata_type,
- [&](const auto& tmpError, const android::hardware::hidl_vec<uint8_t>& tmpVec) {
- error = tmpError;
- if (error != Error::NONE) {
- return;
- }
- output = decodePointer(tmpVec);
- });
-
-
- if (error != Error::NONE) {
- ALOGE("Failed to get video HDR metadata");
+ if (!out_oe.has_value()) {
+ ALOGE("Failed to get video ROI metadata");
return nullptr;
}
- return output;
+ return out_oe.value();
}
uint32_t VendorGraphicBufferMeta::get_format_fourcc(buffer_handle_t hnd) {