diff options
| author | Arun Kumar K.R <akumarkr@codeaurora.org> | 2015-08-28 14:57:31 -0700 |
|---|---|---|
| committer | Vineeta Srivastava <vsrivastava@google.com> | 2015-09-15 23:46:32 +0000 |
| commit | ba008b62daf056bc4322ee3693e6e79eb000c4b0 (patch) | |
| tree | 625350081f6642581d012e22506c6763b5cfa025 | |
| parent | 0e28139946056563a3e44aa811b3721f4ce63121 (diff) | |
| download | platform_hardware_qcom_display-marshmallow-dr-dev.tar.gz platform_hardware_qcom_display-marshmallow-dr-dev.tar.bz2 platform_hardware_qcom_display-marshmallow-dr-dev.zip | |
gralloc: Modify check for uncompressed RGB buffersmarshmallow-dr-dev
The previous check for RGB formats skipped certain formats and hence
the alignment was incorrect.
Add a check for all non-compressed RGB formats before calling
getGpuAlignedWidthHeight
Acked by: Naomi Luis<nluis@codeaurora.org>
CRs-fixed: 888733
Bug: 23967172
Change-Id: Icae4cfb92ceae5e593fd6c5658999fc90ef97ea1
| -rwxr-xr-x[-rw-r--r--] | msm8994/libgralloc/alloc_controller.cpp | 27 | ||||
| -rw-r--r-- | msm8994/libgralloc/gpu.cpp | 5 | ||||
| -rw-r--r-- | msm8994/libgralloc/gr.h | 3 |
3 files changed, 30 insertions, 5 deletions
diff --git a/msm8994/libgralloc/alloc_controller.cpp b/msm8994/libgralloc/alloc_controller.cpp index 4cb16615..bc5e68c8 100644..100755 --- a/msm8994/libgralloc/alloc_controller.cpp +++ b/msm8994/libgralloc/alloc_controller.cpp @@ -137,12 +137,37 @@ int AdrenoMemInfo::isMacroTilingSupportedByGPU() } +bool isUncompressedRgbFormat(int format) +{ + bool is_rgb_format = false; + + switch (format) + { + case HAL_PIXEL_FORMAT_RGBA_8888: + case HAL_PIXEL_FORMAT_RGBX_8888: + case HAL_PIXEL_FORMAT_RGB_888: + case HAL_PIXEL_FORMAT_RGB_565: + case HAL_PIXEL_FORMAT_BGRA_8888: + case HAL_PIXEL_FORMAT_RGBA_5551: + case HAL_PIXEL_FORMAT_RGBA_4444: + case HAL_PIXEL_FORMAT_R_8: + case HAL_PIXEL_FORMAT_RG_88: + case HAL_PIXEL_FORMAT_BGRX_8888: // Intentional fallthrough + is_rgb_format = true; + break; + default: + break; + } + + return is_rgb_format; +} + void AdrenoMemInfo::getAlignedWidthAndHeight(int width, int height, int format, int usage, int& aligned_w, int& aligned_h) { // Currently surface padding is only computed for RGB* surfaces. - if (format <= HAL_PIXEL_FORMAT_BGRA_8888) { + if (isUncompressedRgbFormat(format) == true) { int tileEnabled = isMacroTileEnabled(format, usage); AdrenoMemInfo::getInstance().getGpuAlignedWidthHeight(width, height, format, tileEnabled, aligned_w, aligned_h); diff --git a/msm8994/libgralloc/gpu.cpp b/msm8994/libgralloc/gpu.cpp index 6269ee68..447dde4c 100644 --- a/msm8994/libgralloc/gpu.cpp +++ b/msm8994/libgralloc/gpu.cpp @@ -192,12 +192,9 @@ void gpu_context_t::getGrallocInformationFromFormat(int inputFormat, { *bufferType = BUFFER_TYPE_VIDEO; - if (inputFormat <= HAL_PIXEL_FORMAT_BGRA_8888) { + if (isUncompressedRgbFormat(inputFormat) == TRUE) { // RGB formats *bufferType = BUFFER_TYPE_UI; - } else if ((inputFormat == HAL_PIXEL_FORMAT_R_8) || - (inputFormat == HAL_PIXEL_FORMAT_RG_88)) { - *bufferType = BUFFER_TYPE_UI; } } diff --git a/msm8994/libgralloc/gr.h b/msm8994/libgralloc/gr.h index 5ee0cf87..54202c51 100644 --- a/msm8994/libgralloc/gr.h +++ b/msm8994/libgralloc/gr.h @@ -75,6 +75,9 @@ int getYUVPlaneInfo(private_handle_t* pHnd, struct android_ycbcr* ycbcr); // To query if UBWC is enabled, based on format and usage flags bool isUBwcEnabled(int format, int usage); +// Function to check if the format is an uncompressed RGB format +bool isUncompressedRgbFormat(int format); + /*****************************************************************************/ class Locker { |
