• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 The Chromium OS Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6 
7 #include <optional>
8 #include <string>
9 #include <vector>
10 
11 #include <android/hardware/graphics/common/1.2/types.h>
12 #include <android/hardware/graphics/mapper/3.0/IMapper.h>
13 
14 std::string getPixelFormatString(android::hardware::graphics::common::V1_2::PixelFormat format);
15 
16 std::string getUsageString(
17         android::hardware::hidl_bitfield<android::hardware::graphics::common::V1_2::BufferUsage>
18                 usage);
19 
20 int convertToDrmFormat(android::hardware::graphics::common::V1_2::PixelFormat format,
21                        uint32_t* outDrmFormat);
22 
23 int convertToBufferUsage(uint64_t grallocUsage, uint64_t* outBufferUsage);
24 
25 int convertToMapUsage(uint64_t grallocUsage, uint32_t* outMapUsage);
26 
27 int convertToCrosDescriptor(
28         const android::hardware::graphics::mapper::V3_0::IMapper::BufferDescriptorInfo& descriptor,
29         struct cros_gralloc_buffer_descriptor* outCrosDescriptor);
30 
31 int convertToFenceFd(const android::hardware::hidl_handle& fence_handle, int* out_fence_fd);
32 
33 int convertToFenceHandle(int fence_fd, android::hardware::hidl_handle* out_fence_handle);
34 
35 std::optional<android::hardware::graphics::mapper::V3_0::IMapper::BufferDescriptorInfo>
36 decodeBufferDescriptorInfo(const android::hardware::hidl_vec<uint32_t>& encoded);
37 
38 std::optional<android::hardware::hidl_vec<uint32_t>> encodeBufferDescriptorInfo(
39         const android::hardware::graphics::mapper::V3_0::IMapper::BufferDescriptorInfo& info);
40