summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaomi Luis <nluis@codeaurora.org>2015-08-28 14:57:31 -0700
committerKaushik Kanetkar <kaushikk@codeaurora.org>2015-09-02 15:25:26 -0600
commitcffc5bd986746c344cee291fa2684515e55b8033 (patch)
tree9a3a37f90fef6d91e7d86492b41c76b49d5d5b52
parent57265ee8cc5b88edc174e15796f7e087d0f3febc (diff)
downloadhardware_qcom_display-cffc5bd986746c344cee291fa2684515e55b8033.tar.gz
hardware_qcom_display-cffc5bd986746c344cee291fa2684515e55b8033.tar.bz2
hardware_qcom_display-cffc5bd986746c344cee291fa2684515e55b8033.zip
gralloc: Modify check for uncompressed RGB buffers
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 CRs-fixed: 888733 Change-Id: Icae4cfb92ceae5e593fd6c5658999fc90ef97ea1
-rw-r--r--libgralloc/alloc_controller.cpp27
-rw-r--r--libgralloc/gpu.cpp5
-rw-r--r--libgralloc/gr.h3
3 files changed, 30 insertions, 5 deletions
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 26e3ec59a..8eaf7f4c8 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -170,13 +170,38 @@ void AdrenoMemInfo::getAlignedWidthAndHeight(const private_handle_t *hnd, int& a
}
+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)
{
bool ubwc_enabled = isUBwcEnabled(format, usage);
// Currently surface padding is only computed for RGB* surfaces.
- if (format <= HAL_PIXEL_FORMAT_BGRA_8888) {
+ if (isUncompressedRgbFormat(format) == true) {
int tileEnabled = ubwc_enabled || isMacroTileEnabled(format, usage);
getGpuAlignedWidthHeight(width, height, format, tileEnabled, aligned_w, aligned_h);
return;
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index 13b063896..978861462 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -188,12 +188,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/libgralloc/gr.h b/libgralloc/gr.h
index 6d7f4a7bb..978d564c7 100644
--- a/libgralloc/gr.h
+++ b/libgralloc/gr.h
@@ -76,6 +76,9 @@ int getRgbDataAddress(private_handle_t* pHnd, void** rgb_data);
// 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 {