android_external_minigbm/cros_gralloc/gralloc4/CrosGralloc4Allocator.h
Jason Macnak bd616875b5 gralloc: Move buffer metadata initialization into common layer
... to dedup and support upcoming change to metadata initialization.

Bug: b/321158178
Test: vts -m VtsHalGraphicsAllocatorAidl_TargetTest
Test: vts -m VtsHalGraphicsMapperV4_0Target
Test: vts -m VtsHalGraphicsMapperStableC_TargetTest
Change-Id: Ib00873babcb2ec8816b0d319e675d6884594f618
2024-01-23 13:52:14 -08:00

31 lines
1.1 KiB
C++

/*
* Copyright 2020 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <android/hardware/graphics/allocator/4.0/IAllocator.h>
#include <android/hardware/graphics/mapper/4.0/IMapper.h>
#include <memory>
#include "cros_gralloc/cros_gralloc_driver.h"
#include "cros_gralloc/cros_gralloc_helpers.h"
class CrosGralloc4Allocator : public android::hardware::graphics::allocator::V4_0::IAllocator {
public:
CrosGralloc4Allocator() = default;
android::hardware::Return<void> allocate(const android::hardware::hidl_vec<uint8_t>& descriptor,
uint32_t count, allocate_cb hidl_cb) override;
android::hardware::graphics::mapper::V4_0::Error init();
private:
android::hardware::graphics::mapper::V4_0::Error allocate(
const android::hardware::graphics::mapper::V4_0::IMapper::BufferDescriptorInfo&
description,
uint32_t* outStride, android::hardware::hidl_handle* outHandle);
std::shared_ptr<cros_gralloc_driver> mDriver;
};