1*d95af8dfSAndroid Build Coastguard Worker /* 2*d95af8dfSAndroid Build Coastguard Worker * Copyright 2020 The Chromium OS Authors. All rights reserved. 3*d95af8dfSAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license that can be 4*d95af8dfSAndroid Build Coastguard Worker * found in the LICENSE file. 5*d95af8dfSAndroid Build Coastguard Worker */ 6*d95af8dfSAndroid Build Coastguard Worker 7*d95af8dfSAndroid Build Coastguard Worker #include <android/hardware/graphics/allocator/4.0/IAllocator.h> 8*d95af8dfSAndroid Build Coastguard Worker #include <android/hardware/graphics/mapper/4.0/IMapper.h> 9*d95af8dfSAndroid Build Coastguard Worker 10*d95af8dfSAndroid Build Coastguard Worker #include <memory> 11*d95af8dfSAndroid Build Coastguard Worker 12*d95af8dfSAndroid Build Coastguard Worker #include "cros_gralloc/cros_gralloc_driver.h" 13*d95af8dfSAndroid Build Coastguard Worker #include "cros_gralloc/cros_gralloc_helpers.h" 14*d95af8dfSAndroid Build Coastguard Worker 15*d95af8dfSAndroid Build Coastguard Worker class CrosGralloc4Allocator : public android::hardware::graphics::allocator::V4_0::IAllocator { 16*d95af8dfSAndroid Build Coastguard Worker public: 17*d95af8dfSAndroid Build Coastguard Worker CrosGralloc4Allocator() = default; 18*d95af8dfSAndroid Build Coastguard Worker 19*d95af8dfSAndroid Build Coastguard Worker android::hardware::Return<void> allocate(const android::hardware::hidl_vec<uint8_t>& descriptor, 20*d95af8dfSAndroid Build Coastguard Worker uint32_t count, allocate_cb hidl_cb) override; 21*d95af8dfSAndroid Build Coastguard Worker 22*d95af8dfSAndroid Build Coastguard Worker android::hardware::graphics::mapper::V4_0::Error init(); 23*d95af8dfSAndroid Build Coastguard Worker 24*d95af8dfSAndroid Build Coastguard Worker private: 25*d95af8dfSAndroid Build Coastguard Worker android::hardware::graphics::mapper::V4_0::Error allocate( 26*d95af8dfSAndroid Build Coastguard Worker const android::hardware::graphics::mapper::V4_0::IMapper::BufferDescriptorInfo& 27*d95af8dfSAndroid Build Coastguard Worker description, 28*d95af8dfSAndroid Build Coastguard Worker uint32_t* outStride, android::hardware::hidl_handle* outHandle); 29*d95af8dfSAndroid Build Coastguard Worker 30*d95af8dfSAndroid Build Coastguard Worker std::shared_ptr<cros_gralloc_driver> mDriver; 31*d95af8dfSAndroid Build Coastguard Worker }; 32