summaryrefslogtreecommitdiff
path: root/gralloc4/src/hidl_common/Allocator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gralloc4/src/hidl_common/Allocator.cpp')
-rw-r--r--gralloc4/src/hidl_common/Allocator.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/gralloc4/src/hidl_common/Allocator.cpp b/gralloc4/src/hidl_common/Allocator.cpp
index 0f7340a..78ef905 100644
--- a/gralloc4/src/hidl_common/Allocator.cpp
+++ b/gralloc4/src/hidl_common/Allocator.cpp
@@ -80,9 +80,11 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo
Error error = Error::NONE;
int stride = 0;
+ bool is_dry = bufferDescriptor.producer_usage & GRALLOC_USAGE_ALLOCATE_DRY;
+ buffer_descriptor_t *bufDesc = const_cast<buffer_descriptor_t*>(&bufferDescriptor);
+
std::vector<hidl_handle> grallocBuffers;
gralloc_buffer_descriptor_t grallocBufferDescriptor[1];
-
grallocBufferDescriptor[0] = (gralloc_buffer_descriptor_t)(&bufferDescriptor);
grallocBuffers.reserve(count);
@@ -101,7 +103,7 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo
else
#endif
{
- allocResult = mali_gralloc_buffer_allocate(grallocBufferDescriptor, 1, &tmpBuffer, nullptr);
+ allocResult = mali_gralloc_buffer_allocate(grallocBufferDescriptor, 1, &tmpBuffer, nullptr, is_dry);
if (allocResult != 0)
{
MALI_GRALLOC_LOGE("%s, buffer allocation failed with %d", __func__, allocResult);
@@ -179,6 +181,13 @@ void allocate(const buffer_descriptor_t &bufferDescriptor, uint32_t count, IAllo
}
munmap(metadata_vaddr, hnd->attr_size);
+
+ /* Must set this to false to ensure that when this
+ * buffer is passed back to mapper, metadata_fd_idx is
+ * not 0
+ */
+ hnd->is_dry = false;
+
}
int tmpStride = 0;