From a6ac9378c340d47fe92ec5620ff87579d6f06107 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 8 Nov 2018 14:39:38 +0900 Subject: [PATCH] tpl_wayland_egl: Modified to set the acquired buffer to frontbuffer. - Before this patch, tpl used dequeued buffer as frontbuffer. But using dequeued buffer as frontbuffer can cause sequential error of tbm_surface_queue with GUARANTEE_CYCLE_MODE when the frontbuffer mode is terminated by an external factor. Change-Id: I0fba84605de7f50a9968ca00c9e5c4cc54292d6d Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl.c | 17 ++++++++--------- src/tpl_wayland_egl_thread.c | 1 - src/tpl_wl_egl_thread.c | 13 +++++-------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 1dbdf49..5b2431f 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -954,26 +954,25 @@ __tpl_wayland_egl_surface_enqueue_buffer(tpl_surface_t *surface, * client want to enqueue are the same. */ if (surface->is_frontbuffer_mode && surface->frontbuffer == tbm_surface) { - TPL_LOG_B("WL_EGL", - "[ENQ_SKIP][F] Client already uses frontbuffer(%p)", - surface->frontbuffer); - /* The first buffer to be activated in frontbuffer mode muse be * committed. Subsequence frames do not need to be committed because * the buffer is already displayed. */ if (wayland_egl_buffer->is_new) { - __tpl_wayland_egl_surface_commit(surface, tbm_surface, - num_rects, rects); - wayland_egl_buffer->is_new = TPL_FALSE; + TPL_DEBUG("[FRONTBUFFER RENDERING MODE] tbm_surface(%p) bo(%d)", + tbm_surface, tbm_bo_export(wayland_egl_buffer->bo)); } else { + TPL_LOG_B("WL_EGL", + "[ENQ_SKIP][F] Client already uses frontbuffer(%p)", + surface->frontbuffer); TRACE_ASYNC_END((int)wayland_egl_buffer, "[DEQ]~[ENQ] BO_NAME:%d", tbm_bo_export(wayland_egl_buffer->bo)); + return TPL_ERROR_NONE; } - - return TPL_ERROR_NONE; } + wayland_egl_buffer->is_new = TPL_FALSE; + if (wayland_egl_surface->vblank_done == TPL_FALSE) __tpl_wayland_egl_surface_wait_vblank(surface); diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index ef1675c..aaa73d0 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -1348,7 +1348,6 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, buf_info->num_rects = 0; } - buf_info->need_to_commit = TPL_TRUE; buf_info->draw_done = TPL_FALSE; buf_info->sync_fd = -1; diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 07ba6cc..f8fd4f1 100644 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -546,15 +546,12 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface, * committed. Subsequence frames do not need to be committed because * the buffer is already displayed. */ - if (twe_surface_check_commit_needed(wayland_egl_surface->twe_surface, - surface->frontbuffer)) { - twe_surface_commit_without_enqueue(wayland_egl_surface->twe_surface, - surface->frontbuffer); + if (!twe_surface_check_commit_needed(wayland_egl_surface->twe_surface, + surface->frontbuffer)) { + TRACE_ASYNC_END((int)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", bo_name); + TPL_OBJECT_UNLOCK(wayland_egl_surface); + return TPL_ERROR_NONE; } - - TRACE_ASYNC_END((int)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", bo_name); - TPL_OBJECT_UNLOCK(wayland_egl_surface); - return TPL_ERROR_NONE; } if (sync_fence != -1) { -- 2.7.4