diff options
author | Saurabh Dubey <sdubey@codeaurora.org> | 2018-06-15 18:00:02 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-07-01 23:00:11 -0700 |
commit | efd7f9e29d4801d1d9bde521f58f0a2a2fec5ee3 (patch) | |
tree | 2669c6d5eb4b36aa35fd9779fe13e949ed9ee3eb /gralloc/gr_utils.cpp | |
parent | 52eb7a638f0ac6d2cf9fbeb7b6c0ce194c4cbaec (diff) |
Gralloc: Make size calculation consistent at all places
Fix size calculation by consistently using adreno or gralloc calculation APIs
Change-Id: Ic0cef22d6f99a17d7ce392d02a21edc812cd907b
CRs-Fixed: 2262355
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 |