1 /* 2 * Copyright (C) 2020 Arm Limited. 3 * 4 * Copyright 2016 The Android Open Source Project 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 #ifndef GRALLOC_COMMON_SHARED_METADATA_H 20 #define GRALLOC_COMMON_SHARED_METADATA_H 21 22 #include <optional> 23 #include <vector> 24 #include "gralloctypes/Gralloc4.h" 25 #include "mali_gralloc_buffer.h" 26 #include "core/mali_gralloc_bufferdescriptor.h" 27 #include "gralloc_helper.h" 28 29 #include "SharedMetadata_struct.h" 30 #include "pixel-gralloc/metadata.h" 31 32 namespace arm 33 { 34 namespace mapper 35 { 36 namespace common 37 { 38 39 using android::hardware::hidl_vec; 40 using aidl::android::hardware::graphics::common::Rect; 41 using aidl::android::hardware::graphics::common::Smpte2086; 42 using aidl::android::hardware::graphics::common::Cta861_3; 43 using aidl::android::hardware::graphics::common::BlendMode; 44 using aidl::android::hardware::graphics::common::Dataspace; 45 using ::pixel::graphics::VideoGMV; 46 47 void shared_metadata_init(void *memory, std::string_view name); 48 size_t shared_metadata_size(); 49 50 void get_name(const private_handle_t *hnd, std::string *name); 51 52 void get_crop_rect(const private_handle_t *hnd, std::optional<Rect> *crop); 53 android::status_t set_crop_rect(const private_handle_t *hnd, const Rect &crop_rectangle); 54 55 void get_dataspace(const private_handle_t *hnd, std::optional<Dataspace> *dataspace); 56 void set_dataspace(const private_handle_t *hnd, const Dataspace &dataspace); 57 58 void get_blend_mode(const private_handle_t *hnd, std::optional<BlendMode> *blend_mode); 59 void set_blend_mode(const private_handle_t *hnd, const BlendMode &blend_mode); 60 61 void get_smpte2086(const private_handle_t *hnd, std::optional<Smpte2086> *smpte2086); 62 android::status_t set_smpte2086(const private_handle_t *hnd, const std::optional<Smpte2086> &smpte2086); 63 64 void get_cta861_3(const private_handle_t *hnd, std::optional<Cta861_3> *cta861_3); 65 android::status_t set_cta861_3(const private_handle_t *hnd, const std::optional<Cta861_3> &cta861_3); 66 67 void get_smpte2094_40(const private_handle_t *hnd, std::optional<std::vector<uint8_t>> *smpte2094_40); 68 android::status_t set_smpte2094_40(const private_handle_t *hnd, const std::optional<std::vector<uint8_t>> &smpte2094_40); 69 70 void* get_video_hdr(const private_handle_t *hnd); 71 72 void* get_video_roiinfo(const private_handle_t *hnd); 73 74 VideoGMV get_video_gmv(const private_handle_t *hnd); 75 android::status_t set_video_gmv(const private_handle_t *hnd, const VideoGMV &data); 76 77 } // namespace common 78 } // namespace mapper 79 } // namespace arm 80 81 #endif 82