diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-02-01 14:29:35 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-02-01 14:29:35 -0800 |
commit | 642db195d070785d797699118c20b3858527f148 (patch) | |
tree | 58732d7b7f72088507639f97d57de67bb723a86b /libgralloc/alloc_controller.cpp | |
parent | 523194c86f6b75229e4338c3645613bf7a40dd54 (diff) | |
parent | 071aca66e20161688d26066acde16feb100c9699 (diff) | |
download | android_hardware_qcom_display-642db195d070785d797699118c20b3858527f148.tar.gz android_hardware_qcom_display-642db195d070785d797699118c20b3858527f148.tar.bz2 android_hardware_qcom_display-642db195d070785d797699118c20b3858527f148.zip |
Merge "gralloc: Modify getYUVPlaneInfo"
Diffstat (limited to 'libgralloc/alloc_controller.cpp')
-rw-r--r-- | libgralloc/alloc_controller.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp index a7c4a9a19..01d0798eb 100644 --- a/libgralloc/alloc_controller.cpp +++ b/libgralloc/alloc_controller.cpp @@ -37,6 +37,7 @@ #include "gr.h" #include "comptype.h" #include "mdp_version.h" +#include <qdMetaData.h> #ifdef VENUS_COLOR_FORMAT #include <media/msm_media_info.h> @@ -623,9 +624,19 @@ void getBufferAttributes(int width, int height, int format, int usage, int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr) { int err = 0; + int width = hnd->width; + int height = hnd->height; unsigned int ystride, cstride; + memset(ycbcr->reserved, 0, sizeof(ycbcr->reserved)); + // Check metadata if the geometry has been updated. + MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; + if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) { + AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(metadata->bufferDim.sliceWidth, + metadata->bufferDim.sliceHeight, hnd->format, 0, width, height); + } + // Get the chroma offsets from the handle width/height. We take advantage // of the fact the width _is_ the stride switch (hnd->format) { @@ -634,10 +645,10 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr) case HAL_PIXEL_FORMAT_YCbCr_422_SP: case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS: case HAL_PIXEL_FORMAT_NV12_ENCODEABLE: //Same as YCbCr_420_SP_VENUS - ystride = cstride = hnd->width; + ystride = cstride = width; ycbcr->y = (void*)hnd->base; - ycbcr->cb = (void*)(hnd->base + ystride * hnd->height); - ycbcr->cr = (void*)(hnd->base + ystride * hnd->height + 1); + ycbcr->cb = (void*)(hnd->base + ystride * height); + ycbcr->cr = (void*)(hnd->base + ystride * height + 1); ycbcr->ystride = ystride; ycbcr->cstride = cstride; ycbcr->chroma_step = 2; @@ -648,10 +659,10 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr) case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO: case HAL_PIXEL_FORMAT_NV21_ZSL: case HAL_PIXEL_FORMAT_RAW_SENSOR: - ystride = cstride = hnd->width; + ystride = cstride = width; ycbcr->y = (void*)hnd->base; - ycbcr->cr = (void*)(hnd->base + ystride * hnd->height); - ycbcr->cb = (void*)(hnd->base + ystride * hnd->height + 1); + ycbcr->cr = (void*)(hnd->base + ystride * height); + ycbcr->cb = (void*)(hnd->base + ystride * height + 1); ycbcr->ystride = ystride; ycbcr->cstride = cstride; ycbcr->chroma_step = 2; @@ -659,16 +670,15 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr) //Planar case HAL_PIXEL_FORMAT_YV12: - ystride = hnd->width; - cstride = ALIGN(hnd->width/2, 16); + ystride = width; + cstride = ALIGN(width/2, 16); ycbcr->y = (void*)hnd->base; - ycbcr->cr = (void*)(hnd->base + ystride * hnd->height); - ycbcr->cb = (void*)(hnd->base + ystride * hnd->height + - cstride * hnd->height/2); + ycbcr->cr = (void*)(hnd->base + ystride * height); + ycbcr->cb = (void*)(hnd->base + ystride * height + + cstride * height/2); ycbcr->ystride = ystride; ycbcr->cstride = cstride; ycbcr->chroma_step = 1; - break; //Unsupported formats case HAL_PIXEL_FORMAT_YCbCr_422_I: |