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 <string> 8 #include <vector> 9 10 #include <aidl/android/hardware/graphics/common/PlaneLayout.h> 11 #include <android/hardware/graphics/common/1.2/types.h> 12 #include <android/hardware/graphics/mapper/4.0/IMapper.h> 13 14 #include "cros_gralloc/cros_gralloc_types.h" 15 16 std::string getDrmFormatString(uint32_t drmFormat); 17 18 std::string getPixelFormatString(android::hardware::graphics::common::V1_2::PixelFormat format); 19 20 std::string getUsageString( 21 android::hardware::hidl_bitfield<android::hardware::graphics::common::V1_2::BufferUsage> 22 usage); 23 24 int convertToDrmFormat(android::hardware::graphics::common::V1_2::PixelFormat format, 25 uint32_t* outDrmFormat); 26 27 int convertToBufferUsage(uint64_t grallocUsage, uint64_t* outBufferUsage); 28 29 int convertToCrosDescriptor( 30 const android::hardware::graphics::mapper::V4_0::IMapper::BufferDescriptorInfo& descriptor, 31 struct cros_gralloc_buffer_descriptor* outCrosDescriptor); 32 33 int convertToMapUsage(uint64_t grallocUsage, uint32_t* outMapUsage); 34 35 int convertToFenceFd(const android::hardware::hidl_handle& fence_handle, int* out_fence_fd); 36 37 int convertToFenceHandle(int fence_fd, android::hardware::hidl_handle* out_fence_handle); 38 39 int getPlaneLayouts( 40 uint32_t drm_format, 41 std::vector<aidl::android::hardware::graphics::common::PlaneLayout>* out_layouts);