diff options
author | Saurabh Dubey <sdubey@codeaurora.org> | 2018-04-04 15:50:37 +0530 |
---|---|---|
committer | Saurabh Dubey <sdubey@codeaurora.org> | 2018-04-24 22:21:02 +0530 |
commit | 99c687266851b3c090c6a5f4ad356ba3721dd50d (patch) | |
tree | f56fb5a451f4842bf9ef7e9c3d77fbb5d486e7fd /gralloc/gr_buf_mgr.cpp | |
parent | b9f0ae7f8b1b08ed9b821b21e21764a22f246c17 (diff) | |
download | display-99c687266851b3c090c6a5f4ad356ba3721dd50d.tar.gz |
Gralloc: Use adreno APIs for buffer size calculations
1) Add support to use adreno APIs for non video layers'
buffer size calculations.
2) Add graphics metadata field to MetaData_t structure.
3) Add bindings for newly introduced formats in
GetGpuPixelFormat.
4) Add support to retrieve the graphics metadata in
Perform API.
5) Modify BUFFER_TYPE determination logic
Change-Id: I7674209b42d7cd39bc8de39e3a10582bb216e6cf
CRs-Fixed: 2226672
Diffstat (limited to 'gralloc/gr_buf_mgr.cpp')
-rw-r--r-- | gralloc/gr_buf_mgr.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp index fadc8f0c..0b6567da 100644 --- a/gralloc/gr_buf_mgr.cpp +++ b/gralloc/gr_buf_mgr.cpp @@ -296,10 +296,10 @@ int BufferManager::GetHandleFlags(int format, uint64_t usage) { } int BufferManager::GetBufferType(int inputFormat) { - int buffer_type = BUFFER_TYPE_VIDEO; - if (IsUncompressedRGBFormat(inputFormat)) { - // RGB formats - buffer_type = BUFFER_TYPE_UI; + int buffer_type = BUFFER_TYPE_UI; + if (IsYuvFormat(inputFormat)) { + // Video format + buffer_type = BUFFER_TYPE_VIDEO; } return buffer_type; @@ -321,9 +321,18 @@ Error BufferManager::AllocateBuffer(const BufferDescriptor &descriptor, buffer_h int buffer_type = GetBufferType(format); BufferInfo info = GetBufferInfo(descriptor); info.format = format; - GetBufferSizeAndDimensions(info, &size, &alignedw, &alignedh); - size = (bufferSize >= size) ? bufferSize : size; + bool use_adreno_for_size = false; + GraphicsMetadata graphics_metadata = {}; + + use_adreno_for_size = ((buffer_type != BUFFER_TYPE_VIDEO) && GetAdrenoSizeAPIStatus()); + if (use_adreno_for_size) { + GetGpuResourceSizeAndDimensions(info, &size, &alignedw, &alignedh, &graphics_metadata); + } else { + GetBufferSizeAndDimensions(info, &size, &alignedw, &alignedh); + } + + size = (bufferSize >= size) ? bufferSize : size; int err = 0; int flags = 0; auto page_size = UINT(getpagesize()); @@ -367,6 +376,11 @@ Error BufferManager::AllocateBuffer(const BufferDescriptor &descriptor, buffer_h ColorSpace_t colorSpace = ITU_R_601; setMetaData(hnd, UPDATE_COLOR_SPACE, reinterpret_cast<void *>(&colorSpace)); + + if (use_adreno_for_size) { + setMetaData(hnd, SET_GRAPHICS_METADATA, reinterpret_cast<void *>(&graphics_metadata)); + } + *handle = hnd; RegisterHandleLocked(hnd, data.ion_handle, e_data.ion_handle); ALOGD_IF(DEBUG, "Allocated buffer handle: %p id: %" PRIu64, hnd, hnd->id); |