From f028a6fc0dcfe5df2d0e09aba2ccf90c1ee70061 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Fri, 2 Dec 2016 17:54:09 -0800 Subject: [PATCH] minigbm: mediatek: add support HAL_PIXEL_FORMAT_YV12 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For some reason, we use HAL_PIXEL_FORMAT_YV12 instead of HAL_PIXEL_FORMAT_YCbCr_420_888 as our YUV format on mediatek based boards. We also pass down a different use flags. Since mediatek only supports linear buffers the moment, just lump all the flags together for our YUV supported combination. BUG=chromium:616275 TEST=Played Youtube video in Oak ARC++ container CQ-DEPEND=CL:416292 Change-Id: Iac4797517048981235cd17ad464eb1e3852c4072 Reviewed-on: https://chromium-review.googlesource.com/416396 Commit-Ready: Gurchetan Singh Tested-by: Gurchetan Singh Reviewed-by: Stéphane Marchesin --- cros_gralloc/cros_gralloc_module.cc | 8 +++++--- mediatek.c | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cros_gralloc/cros_gralloc_module.cc b/cros_gralloc/cros_gralloc_module.cc index db30f95..220e772 100644 --- a/cros_gralloc/cros_gralloc_module.cc +++ b/cros_gralloc/cros_gralloc_module.cc @@ -169,8 +169,9 @@ static int cros_gralloc_lock(struct gralloc_module_t const* module, return CROS_GRALLOC_ERROR_BAD_HANDLE; } - if (hnd->droid_format == HAL_PIXEL_FORMAT_YCbCr_420_888) { - cros_gralloc_error("YUV format not compatible."); + if ((hnd->droid_format == HAL_PIXEL_FORMAT_YCbCr_420_888)) { + cros_gralloc_error("HAL_PIXEL_FORMAT_YCbCr_*_888 format not " + "compatible."); return CROS_GRALLOC_ERROR_BAD_HANDLE; } @@ -298,7 +299,8 @@ static int cros_gralloc_lock_ycbcr(struct gralloc_module_t const* module, return CROS_GRALLOC_ERROR_BAD_HANDLE; } - if ((hnd->droid_format != HAL_PIXEL_FORMAT_YCbCr_420_888)) { + if ((hnd->droid_format != HAL_PIXEL_FORMAT_YCbCr_420_888) && + (hnd->droid_format != HAL_PIXEL_FORMAT_YV12)) { cros_gralloc_error("Non-YUV format not compatible."); return CROS_GRALLOC_ERROR_BAD_HANDLE; } diff --git a/mediatek.c b/mediatek.c index 307af84..d4206be 100644 --- a/mediatek.c +++ b/mediatek.c @@ -34,7 +34,8 @@ static struct supported_combination combos[8] = { {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_YVU420, DRM_FORMAT_MOD_NONE, - BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | + BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, }; static int mediatek_init(struct driver *drv) -- 2.11.0