diff options
author | Vladislav Andresov <v.andresov@partner.samsung.com> | 2017-08-16 16:15:56 +0300 |
---|---|---|
committer | Jinhyung Jo <jinhyung.jo@samsung.com> | 2017-09-13 06:26:38 +0000 |
commit | 441a018b79cf9fdb39bc042acca32f153b95b896 (patch) | |
tree | 798b9b14b528567e98ee2e0a35961c5e6c099175 | |
parent | 56b89b2e3d9d703af2ab845825fae9da1357bfe4 (diff) | |
download | emulator-yagl-accepted/tizen/4.0/unified/20170922.064446.tar.gz emulator-yagl-accepted/tizen/4.0/unified/20170922.064446.tar.bz2 emulator-yagl-accepted/tizen/4.0/unified/20170922.064446.zip |
Add hw y-inverting for ARGB imagestizen_4.0.m2_releasetizen_4.0.IoT.p1_releasesubmit/tizen_4.0/20170921.074600submit/tizen_4.0/20170913.082240accepted/tizen/4.0/unified/20170922.064446
Change-Id: I9ee0fd94cb773d326a18074aa99d4576d5ac9639
Signed-off-by: Vladislav Andresov <v.andresov@partner.samsung.com>
Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
-rw-r--r-- | EGL/yagl_onscreen_image_tizen_sfc.c | 39 | ||||
-rw-r--r-- | EGL/yagl_onscreen_image_tizen_sfc.h | 2 |
2 files changed, 36 insertions, 5 deletions
diff --git a/EGL/yagl_onscreen_image_tizen_sfc.c b/EGL/yagl_onscreen_image_tizen_sfc.c index 031d4a0..3a33a79 100644 --- a/EGL/yagl_onscreen_image_tizen_sfc.c +++ b/EGL/yagl_onscreen_image_tizen_sfc.c @@ -41,6 +41,7 @@ #include "yagl_state.h" #include "yagl_client_interface.h" #include "yagl_client_image.h" +#include "drm_fourcc.h" #include "vigs.h" #include <tbm_bufmgr.h> #include <tbm_bufmgr_backend.h> @@ -68,7 +69,6 @@ static inline uint32_t yuv2argb(float y, float u, float v) return (0xff000000 | (r << 16) | (g << 8) | b); } -/* TODO need to think about HW convertion */ static bool yagl_onscreen_image_tizen_sfc_convert(struct yagl_onscreen_image_tizen_sfc *image) { uint32_t *dst; @@ -79,10 +79,6 @@ static bool yagl_onscreen_image_tizen_sfc_convert(struct yagl_onscreen_image_tiz YAGL_LOG_FUNC_SET(yagl_onscreen_image_tizen_sfc_convert); - if (!image->need_convert) { - return true; - } - ret = tbm_surface_map(image->sfc, TBM_SURF_OPTION_READ, &info); if (ret != TBM_SURFACE_ERROR_NONE) { @@ -160,6 +156,38 @@ 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; + 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; + + /* + * No actual format conversion in ARGB8888 case. We just need to + * y-invert the image. + */ + ret = vigs_drm_surface_convert(src, + DRM_FORMAT_ARGB8888, + tizen_sfc_image->drm_sfc, + DRM_FORMAT_ARGB8888, + true); + + if (ret == 0) { + return; + } + + YAGL_LOG_ERROR("vigs_drm_surface_convert failed %s\n", strerror(-ret)); + + /* + * Fallback to software converson in case of error. + */ + } + yagl_onscreen_image_tizen_sfc_convert(tizen_sfc_image); } @@ -297,6 +325,7 @@ struct yagl_onscreen_image_tizen_sfc image->sfc = sfc; image->need_convert = need_convert; image->drm_sfc = drm_sfc; + image->format = info.format; YAGL_LOG_DEBUG("%ux%u/%u, sfc_id = %u, need_convert = %d (0x%X), num_planes = %u, size = %u", info.width, diff --git a/EGL/yagl_onscreen_image_tizen_sfc.h b/EGL/yagl_onscreen_image_tizen_sfc.h index 7da39fe..e7af41b 100644 --- a/EGL/yagl_onscreen_image_tizen_sfc.h +++ b/EGL/yagl_onscreen_image_tizen_sfc.h @@ -50,6 +50,8 @@ struct yagl_onscreen_image_tizen_sfc bool need_convert; struct vigs_drm_surface *drm_sfc; + + uint32_t format; }; struct yagl_onscreen_image_tizen_sfc |