diff options
Diffstat (limited to 'gralloc/gr_utils.cpp')
-rw-r--r-- | gralloc/gr_utils.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp index 10bbf27a..7c480dc1 100644 --- a/gralloc/gr_utils.cpp +++ b/gralloc/gr_utils.cpp @@ -319,8 +319,19 @@ unsigned int GetSize(const BufferInfo &info, unsigned int alignedw, unsigned int void GetBufferSizeAndDimensions(const BufferInfo &info, unsigned int *size, unsigned int *alignedw, unsigned int *alignedh) { - GetAlignedWidthAndHeight(info, alignedw, alignedh); - *size = GetSize(info, *alignedw, *alignedh); + GraphicsMetadata graphics_metadata = {}; + GetBufferSizeAndDimensions(info, size, alignedw, alignedh, &graphics_metadata); +} + +void GetBufferSizeAndDimensions(const BufferInfo &info, unsigned int *size, unsigned int *alignedw, + unsigned int *alignedh, GraphicsMetadata *graphics_metadata) { + int buffer_type = GetBufferType(info.format); + if (CanUseAdrenoForSize(buffer_type, info.usage)) { + GetGpuResourceSizeAndDimensions(info, size, alignedw, alignedh, graphics_metadata); + } else { + GetAlignedWidthAndHeight(info, alignedw, alignedh); + *size = GetSize(info, *alignedw, *alignedh); + } } void GetYuvUbwcSPPlaneInfo(uint64_t base, uint32_t width, uint32_t height, int color_format, @@ -1157,4 +1168,8 @@ int GetCustomFormatFlags(int format, uint64_t usage, return 0; } +int GetBufferType(int inputFormat) { + return IsYuvFormat(inputFormat) ? BUFFER_TYPE_VIDEO : BUFFER_TYPE_UI; +} + } // namespace gralloc |