diff options
author | Jason Macnak <natsu@google.com> | 2020-09-10 10:57:46 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-17 01:07:54 +0000 |
commit | 2a77d942ae6cfd2b168254d99f0e891b88d04155 (patch) | |
tree | 692ece3ac58704374ca0cc5eb0d0d2b0c6278b1e /cros_gralloc/gralloc4/CrosGralloc4Mapper.h | |
parent | 310cf97a929fced825454e03e0a9390a204dc2d8 (diff) | |
download | minigbm-2a77d942ae6cfd2b168254d99f0e891b88d04155.tar.gz |
minigbm: Adds Gralloc 4 support
Implements the Allocator 4.0 and Mapper 4.0 interfaces.
Some notable features of the 4.0 interface:
- buffer metadata getter/setters
- buffer flushing
- buffer debugging (buffer listing and buffer id)
BUG=b:161909468
TEST=build and launch Cuttlefish with Gralloc4
Change-Id: I63bdc76604207e1fcfe0135c9b64fa62bfba5b27
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2404601
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
Diffstat (limited to 'cros_gralloc/gralloc4/CrosGralloc4Mapper.h')
-rw-r--r-- | cros_gralloc/gralloc4/CrosGralloc4Mapper.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/cros_gralloc/gralloc4/CrosGralloc4Mapper.h b/cros_gralloc/gralloc4/CrosGralloc4Mapper.h new file mode 100644 index 0000000..b318930 --- /dev/null +++ b/cros_gralloc/gralloc4/CrosGralloc4Mapper.h @@ -0,0 +1,80 @@ +/* + * 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/mapper/4.0/IMapper.h> + +#include "cros_gralloc/cros_gralloc_driver.h" +#include "cros_gralloc/cros_gralloc_handle.h" + +class CrosGralloc4Mapper : public android::hardware::graphics::mapper::V4_0::IMapper { + public: + CrosGralloc4Mapper(); + + android::hardware::Return<void> createDescriptor(const BufferDescriptorInfo& description, + createDescriptor_cb hidlCb) override; + + android::hardware::Return<void> importBuffer(const android::hardware::hidl_handle& rawHandle, + importBuffer_cb hidlCb) override; + + android::hardware::Return<android::hardware::graphics::mapper::V4_0::Error> freeBuffer( + void* rawHandle) override; + + android::hardware::Return<android::hardware::graphics::mapper::V4_0::Error> validateBufferSize( + void* rawHandle, const BufferDescriptorInfo& descriptor, uint32_t stride) override; + + android::hardware::Return<void> getTransportSize(void* rawHandle, + getTransportSize_cb hidlCb) override; + + android::hardware::Return<void> lock(void* rawHandle, uint64_t cpuUsage, + const Rect& accessRegion, + const android::hardware::hidl_handle& acquireFence, + lock_cb hidlCb) override; + + android::hardware::Return<void> unlock(void* rawHandle, unlock_cb hidlCb) override; + + android::hardware::Return<void> flushLockedBuffer(void* rawHandle, + flushLockedBuffer_cb hidlCb) override; + + android::hardware::Return<android::hardware::graphics::mapper::V4_0::Error> rereadLockedBuffer( + void* rawHandle) override; + + android::hardware::Return<void> isSupported(const BufferDescriptorInfo& descriptor, + isSupported_cb hidlCb) override; + + android::hardware::Return<void> get(void* rawHandle, const MetadataType& metadataType, + get_cb hidlCb) override; + + android::hardware::Return<android::hardware::graphics::mapper::V4_0::Error> set( + void* rawHandle, const MetadataType& metadataType, + const android::hardware::hidl_vec<uint8_t>& metadata) override; + + android::hardware::Return<void> getFromBufferDescriptorInfo( + const BufferDescriptorInfo& descriptor, const MetadataType& metadataType, + getFromBufferDescriptorInfo_cb hidlCb) override; + + android::hardware::Return<void> listSupportedMetadataTypes( + listSupportedMetadataTypes_cb hidlCb) override; + + android::hardware::Return<void> dumpBuffer(void* rawHandle, dumpBuffer_cb hidlCb) override; + android::hardware::Return<void> dumpBuffers(dumpBuffers_cb hidlCb) override; + + android::hardware::Return<void> getReservedRegion(void* rawHandle, + getReservedRegion_cb hidlCb) override; + + private: + android::hardware::Return<void> get(cros_gralloc_handle_t crosHandle, + const MetadataType& metadataType, get_cb hidlCb); + + android::hardware::Return<void> dumpBuffer(cros_gralloc_handle_t crosHandle, + dumpBuffer_cb hidlCb); + + int getResolvedDrmFormat(android::hardware::graphics::common::V1_2::PixelFormat pixelFormat, + uint64_t bufferUsage, uint32_t* outDrmFormat); + + std::unique_ptr<cros_gralloc_driver> mDriver; +}; + +extern "C" android::hardware::graphics::mapper::V4_0::IMapper* HIDL_FETCH_IMapper(const char* name); |