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