From e87e8ba5c636d06fafa4af19914dbdf450b33ecb Mon Sep 17 00:00:00 2001 From: Vladislav Andresov Date: Thu, 5 Oct 2017 17:12:21 +0300 Subject: YAGL: Add hardware conversion for YUV420 format Change-Id: Icf94edd832657527f940c0815653f0365e47d166 Signed-off-by: Vladislav Andresov --- EGL/yagl_onscreen_image_tizen_sfc.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/EGL/yagl_onscreen_image_tizen_sfc.c b/EGL/yagl_onscreen_image_tizen_sfc.c index 3a33a79..09e6c76 100644 --- a/EGL/yagl_onscreen_image_tizen_sfc.c +++ b/EGL/yagl_onscreen_image_tizen_sfc.c @@ -156,16 +156,20 @@ static void yagl_onscreen_image_tizen_sfc_update(struct yagl_image *image) struct yagl_onscreen_image_tizen_sfc *tizen_sfc_image = (struct yagl_onscreen_image_tizen_sfc *)image; + tbm_bo bo; + struct vigs_drm_surface *src; + int ret; + YAGL_LOG_FUNC_SET(yagl_onscreen_image_tizen_sfc_update); if (!tizen_sfc_image->need_convert) { return; } - if (tizen_sfc_image->format == TBM_FORMAT_ARGB8888) { - tbm_bo bo = tbm_surface_internal_get_bo(tizen_sfc_image->sfc, 0); - struct vigs_drm_surface *src = bo ? tbm_backend_get_bo_priv(bo) : NULL; - int ret; + switch (tizen_sfc_image->format) { + case TBM_FORMAT_ARGB8888: + bo = tbm_surface_internal_get_bo(tizen_sfc_image->sfc, 0); + src = bo ? tbm_backend_get_bo_priv(bo) : NULL; /* * No actual format conversion in ARGB8888 case. We just need to @@ -183,11 +187,30 @@ static void yagl_onscreen_image_tizen_sfc_update(struct yagl_image *image) YAGL_LOG_ERROR("vigs_drm_surface_convert failed %s\n", strerror(-ret)); - /* - * Fallback to software converson in case of error. - */ + break; + case TBM_FORMAT_YUV420: + bo = tbm_surface_internal_get_bo(tizen_sfc_image->sfc, 0); + src = bo ? tbm_backend_get_bo_priv(bo) : NULL; + + ret = vigs_drm_surface_convert(src, + DRM_FORMAT_YUV420, + tizen_sfc_image->drm_sfc, + DRM_FORMAT_ARGB8888, + false); + + if (ret == 0) { + return; + } + + YAGL_LOG_ERROR("vigs_drm_surface_convert failed %s\n", strerror(-ret)); + + break; } + /* + * Fallback to software converson in case of error or unsupported format + */ + yagl_onscreen_image_tizen_sfc_convert(tizen_sfc_image); } -- cgit v1.2.3