diff options
author | Craig Donner <cdonner@google.com> | 2016-10-20 17:12:58 -0700 |
---|---|---|
committer | Craig Donner <cdonner@google.com> | 2016-11-11 11:35:06 -0800 |
commit | 0b00adf391bff9ffd4416d5a711da409a29c6d70 (patch) | |
tree | 3e798d53e65afc1a8723e8b88a313b064c2c54a5 /graphics/allocator | |
parent | 1c3718b0cd3af113c8f2b9df2af6ac7e23363cee (diff) | |
download | platform_hardware_interfaces-0b00adf391bff9ffd4416d5a711da409a29c6d70.tar.gz platform_hardware_interfaces-0b00adf391bff9ffd4416d5a711da409a29c6d70.tar.bz2 platform_hardware_interfaces-0b00adf391bff9ffd4416d5a711da409a29c6d70.zip |
Add layered image support to gralloc1 hal.
Bug: 31686534
Test: manual
Change-Id: I6442413072cef2a19abd3aacddf964ca1f4e7481
Diffstat (limited to 'graphics/allocator')
-rw-r--r-- | graphics/allocator/2.0/IAllocator.hal | 14 | ||||
-rw-r--r-- | graphics/allocator/2.0/default/Gralloc.cpp | 10 |
2 files changed, 22 insertions, 2 deletions
diff --git a/graphics/allocator/2.0/IAllocator.hal b/graphics/allocator/2.0/IAllocator.hal index 8accb82131..ff08a7edee 100644 --- a/graphics/allocator/2.0/IAllocator.hal +++ b/graphics/allocator/2.0/IAllocator.hal @@ -26,11 +26,16 @@ interface IAllocator { * is supported. */ TEST_ALLOCATE = 1, + + /* + * layerCount must be 1 unless this capability is supported. + */ + LAYERED_BUFFERS = 2, }; struct BufferDescriptorInfo { /* - * The width specifies how many columns of pixels should be in the + * The width specifies how many columns of pixels must be in the * allocated buffer, but does not necessarily represent the offset in * columns between the same column in adjacent rows. The rows may be * padded. @@ -38,11 +43,16 @@ interface IAllocator { uint32_t width; /* - * The height specifies how many rows of pixels should be in the + * The height specifies how many rows of pixels must be in the * allocated buffer. */ uint32_t height; + /* + * The number of image layers that must be in the allocated buffer. + */ + uint32_t layerCount; + /* Buffer pixel format. */ PixelFormat format; diff --git a/graphics/allocator/2.0/default/Gralloc.cpp b/graphics/allocator/2.0/default/Gralloc.cpp index a7fc6c103b..8a746617a0 100644 --- a/graphics/allocator/2.0/default/Gralloc.cpp +++ b/graphics/allocator/2.0/default/Gralloc.cpp @@ -74,6 +74,7 @@ private: GRALLOC1_PFN_DESTROY_DESCRIPTOR destroyDescriptor; GRALLOC1_PFN_SET_DIMENSIONS setDimensions; GRALLOC1_PFN_SET_FORMAT setFormat; + GRALLOC1_PFN_SET_LAYER_COUNT setLayerCount; GRALLOC1_PFN_SET_CONSUMER_USAGE setConsumerUsage; GRALLOC1_PFN_SET_PRODUCER_USAGE setProducerUsage; GRALLOC1_PFN_ALLOCATE allocate; @@ -135,6 +136,10 @@ void GrallocHal::initDispatch() GRALLOC1_FUNCTION_DESTROY_DESCRIPTOR); initDispatch(mDispatch.setDimensions, GRALLOC1_FUNCTION_SET_DIMENSIONS); initDispatch(mDispatch.setFormat, GRALLOC1_FUNCTION_SET_FORMAT); + if (hasCapability(Capability::LAYERED_BUFFERS)) { + initDispatch( + mDispatch.setLayerCount, GRALLOC1_FUNCTION_SET_LAYER_COUNT); + } initDispatch(mDispatch.setConsumerUsage, GRALLOC1_FUNCTION_SET_CONSUMER_USAGE); initDispatch(mDispatch.setProducerUsage, @@ -191,6 +196,11 @@ Return<void> GrallocHal::createDescriptor( err = mDispatch.setFormat(mDevice, descriptor, static_cast<int32_t>(descriptorInfo.format)); } + if (err == GRALLOC1_ERROR_NONE && + hasCapability(Capability::LAYERED_BUFFERS)) { + err = mDispatch.setLayerCount(mDevice, descriptor, + descriptorInfo.layerCount); + } if (err == GRALLOC1_ERROR_NONE) { uint64_t producerUsageMask = descriptorInfo.producerUsageMask; if (producerUsageMask & GRALLOC1_PRODUCER_USAGE_CPU_READ_OFTEN) { |