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.
7 #include <android/hardware/graphics/mapper/3.0/IMapper.h>
11 #include "cros_gralloc/cros_gralloc_driver.h"
12 #include "cros_gralloc/cros_gralloc_handle.h"
14 class CrosGralloc3Mapper : public android::hardware::graphics::mapper::V3_0::IMapper {
18 android::hardware::Return<void> createDescriptor(const BufferDescriptorInfo& description,
19 createDescriptor_cb hidlCb) override;
21 android::hardware::Return<void> importBuffer(const android::hardware::hidl_handle& rawHandle,
22 importBuffer_cb hidlCb) override;
24 android::hardware::Return<android::hardware::graphics::mapper::V3_0::Error> freeBuffer(
25 void* rawHandle) override;
27 android::hardware::Return<android::hardware::graphics::mapper::V3_0::Error> validateBufferSize(
28 void* rawHandle, const BufferDescriptorInfo& descriptor, uint32_t stride) override;
30 android::hardware::Return<void> getTransportSize(void* rawHandle,
31 getTransportSize_cb hidlCb) override;
33 android::hardware::Return<void> lock(void* rawHandle, uint64_t cpuUsage,
34 const Rect& accessRegion,
35 const android::hardware::hidl_handle& acquireFence,
36 lock_cb hidlCb) override;
38 android::hardware::Return<void> lockYCbCr(void* rawHandle, uint64_t cpuUsage,
39 const Rect& accessRegion,
40 const android::hardware::hidl_handle& acquireFence,
41 lockYCbCr_cb _hidl_cb) override;
43 android::hardware::Return<void> unlock(void* rawHandle, unlock_cb hidlCb) override;
45 android::hardware::Return<void> isSupported(const BufferDescriptorInfo& descriptor,
46 isSupported_cb hidlCb) override;
49 int getResolvedDrmFormat(android::hardware::graphics::common::V1_2::PixelFormat pixelFormat,
50 uint64_t bufferUsage, uint32_t* outDrmFormat);
53 android::hardware::graphics::mapper::V3_0::Error error;
55 uint8_t* mapped[DRV_MAX_PLANES];
57 LockResult lockInternal(cros_gralloc_handle_t crosHandle, uint64_t cpuUsage,
58 const Rect& accessRegion,
59 const android::hardware::hidl_handle& acquireFence);
61 std::unique_ptr<cros_gralloc_driver> mDriver;
64 extern "C" android::hardware::graphics::mapper::V3_0::IMapper* HIDL_FETCH_IMapper(const char* name);