diff options
author | Ramkumar Radhakrishnan <ramkumar@codeaurora.org> | 2018-10-11 19:25:10 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-11-13 16:09:34 -0800 |
commit | 30ea0f0278370df5d017a929055ebd0e64df5292 (patch) | |
tree | 892c0fe92a58cb4d994d4cd26a767d817bb2a5a9 /gralloc/gr_utils.cpp | |
parent | 11138ee7a4ff2170f0904ed2845e3a55908c2296 (diff) |
gralloc: Add support to RGB compressed format and handle error
1. Add corresponding adreno format for RGB compressed hal format,
as new adreno API adreno_init_memory_layout needs ADRENO_FORMAT to
be passed.
2. Handle the error returned by adreno_init_memory_layout API for the
inappropriate values passed.
Change-Id: Iedcf306583b83ecb80db5495a801f37d2479276b
CRs-Fixed: 2262839
Diffstat (limited to 'gralloc/gr_utils.cpp')
-rw-r--r-- | gralloc/gr_utils.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp index 7c825bdc..3b019a3b 100644 --- a/gralloc/gr_utils.cpp +++ b/gralloc/gr_utils.cpp @@ -341,21 +341,22 @@ unsigned int GetSize(const BufferInfo &info, unsigned int alignedw, unsigned int return size; } -void GetBufferSizeAndDimensions(const BufferInfo &info, unsigned int *size, unsigned int *alignedw, - unsigned int *alignedh) { +int GetBufferSizeAndDimensions(const BufferInfo &info, unsigned int *size, unsigned int *alignedw, + unsigned int *alignedh) { GraphicsMetadata graphics_metadata = {}; - GetBufferSizeAndDimensions(info, size, alignedw, alignedh, &graphics_metadata); + return 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 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); + return GetGpuResourceSizeAndDimensions(info, size, alignedw, alignedh, graphics_metadata); } else { GetAlignedWidthAndHeight(info, alignedw, alignedh); *size = GetSize(info, *alignedw, *alignedh); } + return 0; } void GetYuvUbwcSPPlaneInfo(uint64_t base, uint32_t width, uint32_t height, int color_format, @@ -1014,9 +1015,9 @@ int GetBufferLayout(private_handle_t *hnd, uint32_t stride[4], uint32_t offset[4 return 0; } -void GetGpuResourceSizeAndDimensions(const BufferInfo &info, unsigned int *size, - unsigned int *alignedw, unsigned int *alignedh, - GraphicsMetadata *graphics_metadata) { +int GetGpuResourceSizeAndDimensions(const BufferInfo &info, unsigned int *size, + unsigned int *alignedw, unsigned int *alignedh, + GraphicsMetadata *graphics_metadata) { GetAlignedWidthAndHeight(info, alignedw, alignedh); AdrenoMemInfo* adreno_mem_info = AdrenoMemInfo::GetInstance(); graphics_metadata->size = adreno_mem_info->AdrenoGetMetadataBlobSize(); @@ -1038,10 +1039,11 @@ void GetGpuResourceSizeAndDimensions(const BufferInfo &info, unsigned int *size, if (ret != 0) { ALOGE("%s Graphics metadata init failed", __FUNCTION__); *size = 0; - return; + return -EINVAL; } // Call adreno api with the metadata blob to get buffer size *size = adreno_mem_info->AdrenoGetAlignedGpuBufferSize(graphics_metadata->data); + return 0; } bool CanUseAdrenoForSize(int buffer_type, uint64_t usage) { |