summaryrefslogtreecommitdiff
path: root/sdm/libs/hwc2/hwc_buffer_allocator.cpp
diff options
context:
space:
mode:
authorCh Ganesh Kumar <chganesh@codeaurora.org>2017-07-04 18:56:12 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-07-25 22:29:42 -0700
commit65788dca88783d1a28e57544220b851dc68f5c66 (patch)
treed2ac5ad8e4d6dacf50701410935891c0a1796d3b /sdm/libs/hwc2/hwc_buffer_allocator.cpp
parentac2427c9a5176a79c2eb23dcb6c3d1e1129a3ec4 (diff)
sdm:hwc2: Add buffer map to tonemap output buffer
Add support for map buffer in hwc buffer allocator Map intermediate TM buffers before dumping to file Change-Id: Ic595aec0bca6d841f5469244ece3fd9ba21625e8
Diffstat (limited to 'sdm/libs/hwc2/hwc_buffer_allocator.cpp')
-rw-r--r--sdm/libs/hwc2/hwc_buffer_allocator.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/sdm/libs/hwc2/hwc_buffer_allocator.cpp b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
index 3c8d460d..a1b763ca 100644
--- a/sdm/libs/hwc2/hwc_buffer_allocator.cpp
+++ b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
@@ -52,6 +52,8 @@ HWCBufferAllocator::HWCBufferAllocator() {
gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_RELEASE));
Perform_ = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_PERFORM));
+ Lock_ = reinterpret_cast<GRALLOC1_PFN_LOCK>(
+ gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_LOCK));
}
HWCBufferAllocator::~HWCBufferAllocator() {
@@ -354,4 +356,21 @@ DisplayError HWCBufferAllocator::GetBufferLayout(const AllocatedBufferInfo &buf_
return kErrorNone;
}
+DisplayError HWCBufferAllocator::MapBuffer(const private_handle_t *handle, int acquire_fence) {
+ void* buffer_ptr = NULL;
+ const gralloc1_rect_t accessRegion = {
+ .left = 0,
+ .top = 0,
+ .width = 0,
+ .height = 0
+ };
+ Lock_(gralloc_device_, handle, GRALLOC1_PRODUCER_USAGE_CPU_READ, GRALLOC1_CONSUMER_USAGE_NONE,
+ &accessRegion, &buffer_ptr, acquire_fence);
+ if (!buffer_ptr) {
+ return kErrorUndefined;
+ }
+
+ return kErrorNone;
+}
+
} // namespace sdm