summaryrefslogtreecommitdiffstats
path: root/libgralloc/alloc_controller.cpp
diff options
context:
space:
mode:
authorSushil Chauhan <sushilchauhan@codeaurora.org>2015-02-20 15:44:52 -0800
committerSushil Chauhan <sushilchauhan@codeaurora.org>2015-03-11 18:15:28 -0700
commit4686c97328beffaca319eacc6fcc8fe5689fe644 (patch)
treef5c34d452c91c8e10acfeecce0436ec584b1bb3e /libgralloc/alloc_controller.cpp
parent51c08146fd7e43944a06ac1e99a35e3b883881bd (diff)
downloadandroid_hardware_qcom_display-4686c97328beffaca319eacc6fcc8fe5689fe644.tar.gz
android_hardware_qcom_display-4686c97328beffaca319eacc6fcc8fe5689fe644.tar.bz2
android_hardware_qcom_display-4686c97328beffaca319eacc6fcc8fe5689fe644.zip
gralloc: Add support for NV12_UBWC in getYUVPlaneInfo api
Add support for NV12_UBWC HAL pixel format in getYUVPlaneInfo api to enable GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO for this format. Change-Id: I94389ddc45cba94124b36fb3ecb0b947250c0681
Diffstat (limited to 'libgralloc/alloc_controller.cpp')
-rw-r--r--libgralloc/alloc_controller.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index f70ead35e..508564a5a 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -628,6 +628,7 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr)
int width = hnd->width;
int height = hnd->height;
unsigned int ystride, cstride;
+ unsigned int alignment = 4096;
memset(ycbcr->reserved, 0, sizeof(ycbcr->reserved));
@@ -655,6 +656,34 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr)
ycbcr->chroma_step = 2;
break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
+ // NV12_UBWC buffer has these 4 planes in the following sequence:
+ // Y_Meta_Plane, Y_Plane, UV_Meta_Plane, UV_Plane
+ unsigned int y_meta_stride, y_meta_height, y_meta_size;
+ unsigned int y_stride, y_height, y_size;
+ unsigned int c_meta_stride, c_meta_height, c_meta_size;
+
+ y_meta_stride = VENUS_Y_META_STRIDE(COLOR_FMT_NV12_UBWC, width);
+ y_meta_height = VENUS_Y_META_SCANLINES(COLOR_FMT_NV12_UBWC, height);
+ y_meta_size = ALIGN((y_meta_stride * y_meta_height), alignment);
+
+ y_stride = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, width);
+ y_height = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, height);
+ y_size = ALIGN((y_stride * y_height), alignment);
+
+ c_meta_stride = VENUS_UV_META_STRIDE(COLOR_FMT_NV12_UBWC, width);
+ c_meta_height = VENUS_UV_META_SCANLINES(COLOR_FMT_NV12_UBWC, height);
+ c_meta_size = ALIGN((c_meta_stride * c_meta_height), alignment);
+
+ ycbcr->y = (void*)(hnd->base + y_meta_size);
+ ycbcr->cb = (void*)(hnd->base + y_meta_size + y_size + c_meta_size);
+ ycbcr->cr = (void*)(hnd->base + y_meta_size + y_size +
+ c_meta_size + 1);
+ ycbcr->ystride = y_stride;
+ ycbcr->cstride = VENUS_UV_STRIDE(COLOR_FMT_NV12_UBWC, width);
+ ycbcr->chroma_step = 2;
+ break;
+
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
case HAL_PIXEL_FORMAT_YCrCb_422_SP:
case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO: