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
This commit is contained in:
Naomi Luis 2012-01-24 18:19:41 -08:00 committed by Andrew Sutherland
parent 31e5714e87
commit 6493734d01

View File

@ -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);