blob: 0492568d721b8365f507aacefe2eb79f3217caf7 [file] [log] [blame]
Jason Macnak1de7f662020-01-24 15:05:57 -08001/*
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
Jason Macnak1de7f662020-01-24 15:05:57 -080014std::string getPixelFormatString(android::hardware::graphics::common::V1_2::PixelFormat format);
15
16std::string getUsageString(
17 android::hardware::hidl_bitfield<android::hardware::graphics::common::V1_2::BufferUsage>
18 usage);
19
20int convertToDrmFormat(android::hardware::graphics::common::V1_2::PixelFormat format,
21 uint32_t* outDrmFormat);
22
23int convertToBufferUsage(uint64_t grallocUsage, uint64_t* outBufferUsage);
24
25int convertToMapUsage(uint64_t grallocUsage, uint32_t* outMapUsage);
26
27int convertToCrosDescriptor(
28 const android::hardware::graphics::mapper::V3_0::IMapper::BufferDescriptorInfo& descriptor,
29 struct cros_gralloc_buffer_descriptor* outCrosDescriptor);
30
31int convertToFenceFd(const android::hardware::hidl_handle& fence_handle, int* out_fence_fd);
32
33int convertToFenceHandle(int fence_fd, android::hardware::hidl_handle* out_fence_handle);
34
35std::optional<android::hardware::graphics::mapper::V3_0::IMapper::BufferDescriptorInfo>
36decodeBufferDescriptorInfo(const android::hardware::hidl_vec<uint32_t>& encoded);
37
38std::optional<android::hardware::hidl_vec<uint32_t>> encodeBufferDescriptorInfo(
39 const android::hardware::graphics::mapper::V3_0::IMapper::BufferDescriptorInfo& info);