From 6493734d014df3351d6502f66003faea229b388e Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Tue, 24 Jan 2012 18:19:41 -0800 Subject: [PATCH] libgralloc: Check if w and h are odd only for the YV12 format. The mandate for the width and height to be even is only for the YV12 format. Add this check only for the YV12 format. Change-Id: I1e8d2de174ecf2e62cd33cc40dfd8e97d70a3a59 --- libgralloc/gpu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp index 8909b95..9130b17 100755 --- a/libgralloc/gpu.cpp +++ b/libgralloc/gpu.cpp @@ -247,8 +247,8 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage, case HAL_PIXEL_FORMAT_YCbCr_420_SP: case HAL_PIXEL_FORMAT_YCrCb_420_SP: case HAL_PIXEL_FORMAT_YV12: - if ((w&1) || (h&1)) { - LOGE("w or h is odd for the YUV format"); + if ((format == HAL_PIXEL_FORMAT_YV12) && ((w&1) || (h&1))) { + LOGE("w or h is odd for the YV12 format"); return -EINVAL; } alignedw = ALIGN(w, 16);