diff options
-rw-r--r-- | libgralloc/alloc_controller.cpp | 13 | ||||
-rw-r--r-- | libgralloc/gr.h | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp index 8eaf7f4c8..e6693c9d6 100644 --- a/libgralloc/alloc_controller.cpp +++ b/libgralloc/alloc_controller.cpp @@ -105,6 +105,7 @@ AdrenoMemInfo::AdrenoMemInfo() LINK_adreno_isMacroTilingSupportedByGpu = NULL; LINK_adreno_compute_compressedfmt_aligned_width_and_height = NULL; LINK_adreno_isUBWCSupportedByGpu = NULL; + LINK_adreno_get_gpu_pixel_alignment = NULL; libadreno_utils = ::dlopen("libadreno_utils.so", RTLD_NOW); if (libadreno_utils) { @@ -119,6 +120,8 @@ AdrenoMemInfo::AdrenoMemInfo() "compute_compressedfmt_aligned_width_and_height"); *(void **)&LINK_adreno_isUBWCSupportedByGpu = ::dlsym(libadreno_utils, "isUBWCSupportedByGpu"); + *(void **)&LINK_adreno_get_gpu_pixel_alignment = + ::dlsym(libadreno_utils, "get_gpu_pixel_alignment"); } // Check if the overriding property debug.gralloc.gfx_ubwc_disable @@ -214,11 +217,18 @@ void AdrenoMemInfo::getAlignedWidthAndHeight(int width, int height, int format, aligned_w = width; aligned_h = height; + int alignment = 32; switch (format) { case HAL_PIXEL_FORMAT_YCrCb_420_SP: + case HAL_PIXEL_FORMAT_YCbCr_420_SP: + if (LINK_adreno_get_gpu_pixel_alignment) { + alignment = LINK_adreno_get_gpu_pixel_alignment(); + } + aligned_w = ALIGN(width, alignment); + break; case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO: - aligned_w = ALIGN(width, 32); + aligned_w = ALIGN(width, alignment); break; case HAL_PIXEL_FORMAT_RAW16: aligned_w = ALIGN(width, 16); @@ -229,7 +239,6 @@ void AdrenoMemInfo::getAlignedWidthAndHeight(int width, int height, int format, case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED: aligned_w = ALIGN(width, 128); break; - case HAL_PIXEL_FORMAT_YCbCr_420_SP: case HAL_PIXEL_FORMAT_YV12: case HAL_PIXEL_FORMAT_YCbCr_422_SP: case HAL_PIXEL_FORMAT_YCrCb_422_SP: diff --git a/libgralloc/gr.h b/libgralloc/gr.h index 978d564c7..1b8d9b4a5 100644 --- a/libgralloc/gr.h +++ b/libgralloc/gr.h @@ -194,5 +194,7 @@ class AdrenoMemInfo : public android::Singleton <AdrenoMemInfo> int *bpp); int (*LINK_adreno_isUBWCSupportedByGpu) (ADRENOPIXELFORMAT format); + + unsigned int (*LINK_adreno_get_gpu_pixel_alignment) (); }; #endif /* GR_H_ */ |