From a6434ecae66f8dfe76651a11b8225a1cfea0ca38 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 20 Nov 2018 15:52:52 +0900 Subject: [PATCH 01/16] tpl_wl_vk_thread: Fixed bug related to buffer_count to prevent heap-overflow. Change-Id: I5cbc98bd787711336b2386e7e007e16dbd9f3ee8 Signed-off-by: Joonbum Ko --- src/tpl_wl_vk_thread.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/tpl_wl_vk_thread.c b/src/tpl_wl_vk_thread.c index 43f5a84..cb4f549 100644 --- a/src/tpl_wl_vk_thread.c +++ b/src/tpl_wl_vk_thread.c @@ -540,18 +540,28 @@ __tpl_wl_vk_wsi_surface_get_swapchain_buffers(tpl_surface_t *surface, TPL_ASSERT(buffer_count); wayland_vk_wsi_surface = (tpl_wayland_vk_wsi_surface_t *)surface->backend.data; - wayland_vk_wsi_surface->swapchain_buffers = (tbm_surface_h *)calloc( - wayland_vk_wsi_surface->buffer_count, - sizeof(tbm_surface_h)); - if (!wayland_vk_wsi_surface->swapchain_buffers) { - TPL_ERR("Failed to allocate memory for buffers."); - return TPL_ERROR_OUT_OF_MEMORY; - } - wayland_vk_wsi_display = (tpl_wayland_vk_wsi_display_t *)surface->display->backend.data; if (twe_display_lock(wayland_vk_wsi_display->twe_display) == TPL_ERROR_NONE) { ret = twe_surface_get_swapchain_buffers(wayland_vk_wsi_surface->twe_surface, + NULL, buffer_count); + if (ret != TPL_ERROR_NONE) { + TPL_ERR("Failed to get buffer_count. twe_surface(%p)", + wayland_vk_wsi_surface->twe_surface); + twe_display_unlock(wayland_vk_wsi_display->twe_display); + return ret; + } + + wayland_vk_wsi_surface->swapchain_buffers = (tbm_surface_h *)calloc( + *buffer_count, + sizeof(tbm_surface_h)); + if (!wayland_vk_wsi_surface->swapchain_buffers) { + TPL_ERR("Failed to allocate memory for buffers."); + twe_display_unlock(wayland_vk_wsi_display->twe_display); + return TPL_ERROR_OUT_OF_MEMORY; + } + + ret = twe_surface_get_swapchain_buffers(wayland_vk_wsi_surface->twe_surface, wayland_vk_wsi_surface->swapchain_buffers, buffer_count); if (ret != TPL_ERROR_NONE) { @@ -564,14 +574,15 @@ __tpl_wl_vk_wsi_surface_get_swapchain_buffers(tpl_surface_t *surface, } for (i = 0; i < *buffer_count; i++) { - TPL_DEBUG("swapchain_buffers[%d] = tbm_surface(%p) bo(%d)", - i, wayland_vk_wsi_surface->swapchain_buffers[i], - tbm_bo_export(tbm_surface_internal_get_bo( - wayland_vk_wsi_surface->swapchain_buffers[i], 0))); - tbm_surface_internal_ref(wayland_vk_wsi_surface->swapchain_buffers[i]); + if (wayland_vk_wsi_surface->swapchain_buffers[i]) { + TPL_DEBUG("swapchain_buffers[%d] = tbm_surface(%p) bo(%d)", + i, wayland_vk_wsi_surface->swapchain_buffers[i], + tbm_bo_export(tbm_surface_internal_get_bo( + wayland_vk_wsi_surface->swapchain_buffers[i], 0))); + tbm_surface_internal_ref(wayland_vk_wsi_surface->swapchain_buffers[i]); + } } - *buffers = wayland_vk_wsi_surface->swapchain_buffers; twe_display_unlock(wayland_vk_wsi_display->twe_display); -- 2.7.4 From e6a7d3e4fd1781f4b2e7f9c12b06f70554990315 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 20 Nov 2018 19:58:59 +0900 Subject: [PATCH 02/16] tpl_wl_egl_thread: Added missed mutex_lock to prevent locking problem. Change-Id: Ia52ca1ec8d4feb0e66fb378fe7c32ab1fac93e25 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index f8fd4f1..6f7f4a4 100644 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -660,6 +660,7 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, TPL_OBJECT_UNLOCK(surface); if (!tbm_surface_queue_can_dequeue(wayland_egl_surface->tbm_queue, 1)) { TPL_ERR("Failed to query can_dequeue. tbm_queue(%p)", wayland_egl_surface->tbm_queue); + TPL_OBJECT_LOCK(surface); return NULL; } TPL_OBJECT_LOCK(surface); -- 2.7.4 From 80024ebbc3eee5fdbd3b59ca93386059fb4e2824 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Wed, 21 Nov 2018 14:27:43 +0900 Subject: [PATCH 03/16] Package version up to 1.5.24 Change-Id: Ic924e64d3e73844650e2e266aab9a9784ab7996e Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index 773d1ad..0a271fe 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 5 -%define TPL_VERSION_PATCH 24 +%define TPL_VERSION_PATCH 25 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From a8060332c39061fcf98a41e2faed6b5764c2227d Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 30 Nov 2018 13:52:23 +0900 Subject: [PATCH 04/16] tpl_wayland_egl_thread: Fixed to send signal when tdm_source already detroyed. - If there was an error when processing tdm_client_handle_events(), tdm_source would have been destroyed before the process terminated. - In this case, when Main thread terminate its twe_thread, main thread will have to wait for the tdm_source destroy signal. Change-Id: If2a8afb8dc801e5313e33298d9b320d4976e1480 Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 87c54a7..56e28bd 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -448,13 +448,15 @@ _twe_thread_tdm_source_destroy(void *source) { twe_tdm_source *tdm_source = (twe_tdm_source *)source; + g_mutex_lock(&_twe_ctx->thread_mutex); + if (!tdm_source || g_source_is_destroyed(&tdm_source->gsource)) { TPL_ERR("TDM source(%p) already destroyed.", tdm_source); + g_cond_signal(&_twe_ctx->thread_cond); + g_mutex_unlock(&_twe_ctx->thread_mutex); return; } - g_mutex_lock(&_twe_ctx->thread_mutex); - g_source_remove_unix_fd(&tdm_source->gsource, tdm_source->tag); g_source_destroy(&tdm_source->gsource); g_source_unref(&tdm_source->gsource); -- 2.7.4 From 289009fd2271ea2e4488f0770dd3b8f8bec1875f Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 30 Nov 2018 14:24:46 +0900 Subject: [PATCH 05/16] tpl_wayland_egl_thread: Moved tdm_del_source to twe context. Change-Id: I6309134e87bee43ad93a2035b296e9755e50f795 Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 56e28bd..bdb2f01 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -40,6 +40,7 @@ struct _twe_thread_context { int ref_cnt; twe_tdm_source *tdm_source; + twe_del_source *tdm_del_source; GMutex thread_mutex; GCond thread_cond; @@ -55,7 +56,6 @@ struct _twe_tdm_source { gpointer tag; tdm_client *tdm_client; int tdm_fd; - twe_del_source *tdm_del_source; }; struct _twe_wl_disp_source { @@ -457,6 +457,8 @@ _twe_thread_tdm_source_destroy(void *source) return; } + _twe_ctx->tdm_source = NULL; + g_source_remove_unix_fd(&tdm_source->gsource, tdm_source->tag); g_source_destroy(&tdm_source->gsource); g_source_unref(&tdm_source->gsource); @@ -503,9 +505,9 @@ twe_thread_create(void) if (_twe_ctx->tdm_source) { twe_tdm_source *tdm_source = _twe_ctx->tdm_source; - tdm_source->tdm_del_source = _twe_del_source_init(_twe_ctx, tdm_source); - if (tdm_source->tdm_del_source) - tdm_source->tdm_del_source->destroy_target_source_func + _twe_ctx->tdm_del_source = _twe_del_source_init(_twe_ctx, tdm_source); + if (_twe_ctx->tdm_del_source) + _twe_ctx->tdm_del_source->destroy_target_source_func = _twe_thread_tdm_source_destroy; } @@ -527,21 +529,22 @@ twe_thread_destroy(twe_thread* thread) thread->ctx->ref_cnt--; if (thread->ctx->ref_cnt == 0) { - if (_twe_ctx->tdm_source) { - twe_del_source *tdm_del_source = _twe_ctx->tdm_source->tdm_del_source; - _twe_ctx->tdm_source->tdm_del_source = NULL; + twe_del_source *tdm_del_source = _twe_ctx->tdm_del_source; + if (_twe_ctx->tdm_source) { g_mutex_lock(&_twe_ctx->thread_mutex); - _twe_thread_del_source_trigger(tdm_del_source); + if (tdm_del_source) + _twe_thread_del_source_trigger(tdm_del_source); g_cond_wait(&_twe_ctx->thread_cond, &_twe_ctx->thread_mutex); g_mutex_unlock(&_twe_ctx->thread_mutex); + } - _twe_ctx->tdm_source = NULL; - + if (tdm_del_source) _twe_del_source_fini(tdm_del_source); - } + + _twe_ctx->tdm_del_source = NULL; g_main_loop_quit(thread->ctx->twe_loop); g_thread_join(thread->ctx->twe_thread); -- 2.7.4 From aac49a92e6a5278177461d76f7d9f9ad6efc9971 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 30 Nov 2018 15:55:53 +0900 Subject: [PATCH 06/16] tpl_wayland_egl_thread: Printed warning to notice tdm_error_timeout. Change-Id: I94d8e5bd7424f921a68cc4a68f70373e580da838 Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index bdb2f01..dbdf3b6 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -1625,6 +1625,10 @@ __cb_tdm_client_wait_vblank(tdm_client_vblank *vblank, tdm_error error, TRACE_ASYNC_END((int)surf_source, "WAIT_VBLANK"); + if (error == TDM_ERROR_TIMEOUT) + TPL_WARN("[TDM_ERROR_TIMEOUT] It will keep going. surf_source(%p)", + surf_source); + disp_source = surf_source->disp_source; surf_source->vblank_done = TPL_TRUE; -- 2.7.4 From e7cda051435c924df01e318e0225e86062c48de4 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 30 Nov 2018 17:47:27 +0900 Subject: [PATCH 07/16] tpl_wayland_egl_thread: Changed the result of handle_events() to assert checking. - If tdm_source is destroyed when the result of tdm_client_handle_events() is not TDM_ERROR_NONE, tdm releated functions can not be recovered. - Unless error is unexpected, tdm_client_handle_events() should always return ERROR_NONE, otherwise it should be checked with assert to make debugging easier for unknown ERROR. Change-Id: I6681fc396772e7e4d692145cc702257b42a57fde Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index dbdf3b6..6cdbbd2 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -368,11 +368,7 @@ _twe_thread_tdm_source_dispatch(GSource *source, GSourceFunc cb, gpointer data) if (cond & G_IO_IN) { tdm_err = tdm_client_handle_events(tdm_source->tdm_client); - if (tdm_err != TDM_ERROR_NONE) { - TPL_ERR("TDM_ERROR:%d tdm_client:%p\n", - tdm_err, tdm_source->tdm_client); - return G_SOURCE_REMOVE; - } + TPL_ASSERT(tdm_err == TDM_ERROR_NONE); } return G_SOURCE_CONTINUE; -- 2.7.4 From 76de5fa2752ad13a4404c6d3d7f74e255c7c9453 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 30 Nov 2018 17:53:56 +0900 Subject: [PATCH 08/16] Package version up to 1.5.26 Change-Id: I051e5b49704f92ec941076c81ca8d3cb91c9e24a Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index 0a271fe..b94a34a 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 5 -%define TPL_VERSION_PATCH 25 +%define TPL_VERSION_PATCH 26 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 497be89fe5ed0b7003c913ab3a70cdafcdb3ab47 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 27 Dec 2018 16:59:18 +0900 Subject: [PATCH 09/16] tpl_wayland_egl_thread: Added assert case to detect abnomalies. - In the twe thread, the event fd being poll must be woken up only with G_IO_IN. - However, if some problem occurs in fd, it can wake up with G_IO_ERR, G_IO_HUP, G_IO_NVAL, and try dispatch. In this case, it is difficult to predict the situation after G_SOURCE_REMOVE, so ASSERT should be used to find the time when the problem occurs. - If there is no ASSERT () or remove, g_main_loop will repeatedly wake up and try to dispatch the source, causing a problem of making CPU usage high. Change-Id: I678119c192c7ab52acd11965e54dfa9a890fa8e7 Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 6cdbbd2..ce5f854 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -258,6 +258,10 @@ _twe_thread_del_source_dispatch(GSource *source, GSourceFunc cb, gpointer data) if (del_source->destroy_target_source_func) del_source->destroy_target_source_func(del_source->target_source); + } else { + TPL_ERR("eventfd(%d) cannot wake up with other condition. cond(%d)", + del_source->event_fd, cond); + TPL_ASSERT((cond & G_IO_IN)); } return G_SOURCE_CONTINUE; @@ -2040,6 +2044,10 @@ _twe_thread_wl_surface_dispatch(GSource *source, GSourceFunc cb, gpointer data) } else { _twe_thread_wl_surface_acquire_and_commit(surf_source); } + } else { + TPL_ERR("eventfd(%d) cannot wake up with other condition. cond(%d)", + surf_source->event_fd, cond); + TPL_ASSERT((cond & G_IO_IN)); } return G_SOURCE_CONTINUE; -- 2.7.4 From 046bd77d08dfebd800bc1df1b5678ab88d74abb1 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 28 Dec 2018 16:37:25 +0900 Subject: [PATCH 10/16] tpl_wl_egl_thread: Implemented force_flush to use can_dequeue_wait_timeout. - This is a patch to solve the problem of blocking in tbm_surface_queue_can_dequeue() if release_event is missing due to wayland socket or server logic problem. - If TBM_SURFACE_QUEUE_ERROR_TIMEOUT occurs, new buffers are allocated to escape blocking without waiting for buffer release events. Change-Id: I883c65b3af3cfa66336f4301628614ede0b421a7 Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 35 +++++++++++++++++++++++++++++++++++ src/tpl_wayland_egl_thread.h | 3 +++ src/tpl_wl_egl_thread.c | 30 +++++++++++++++++++++++++----- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index ce5f854..3e9a913 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -3169,6 +3169,41 @@ twe_surface_wait_dequeueable(twe_surface_h twe_surface, uint64_t timeout_ns) return TPL_ERROR_NONE; } +tpl_result_t +twe_surface_queue_force_flush(twe_surface_h twe_surface) +{ + twe_wl_surf_source *surf_source = (twe_wl_surf_source *)twe_surface; + tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE; + + if ((tsq_err = tbm_surface_queue_flush(surf_source->tbm_queue)) + != TBM_SURFACE_QUEUE_ERROR_NONE) { + TPL_ERR("[TIMEOUT_RESET] Failed to flush tbm_surface_queue(%p) tsq_err(%d)", + surf_source->tbm_queue, tsq_err); + return TPL_ERROR_INVALID_OPERATION; + } + + if (surf_source->committed_buffers) { + while (!__tpl_list_is_empty(surf_source->committed_buffers)) { + tbm_surface_h tbm_surface = + __tpl_list_pop_front(surf_source->committed_buffers, + (tpl_free_func_t)__cb_buffer_remove_from_list); + TRACE_ASYNC_END((int)tbm_surface, "[COMMIT ~ RELEASE] BO(%d)", + tbm_bo_export(tbm_surface_internal_get_bo( + tbm_surface, 0))); + tsq_err = tbm_surface_queue_release(surf_source->tbm_queue, tbm_surface); + if (tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE) + TPL_ERR("Failed to release. tbm_surface(%p) tsq_err(%d)", + tbm_surface, tsq_err); + } + } + + TPL_LOG_T(BACKEND, + "[FORCE_FLUSH] surf_source(%p) tbm_queue(%p)", + surf_source, surf_source->tbm_queue); + + return TPL_ERROR_NONE; +} + tpl_bool_t twe_check_native_handle_is_wl_display(tpl_handle_t display) diff --git a/src/tpl_wayland_egl_thread.h b/src/tpl_wayland_egl_thread.h index 4f7ba97..dfe6f6f 100644 --- a/src/tpl_wayland_egl_thread.h +++ b/src/tpl_wayland_egl_thread.h @@ -98,6 +98,9 @@ twe_surface_create_sync_fd(tbm_surface_h tbm_surface); tpl_result_t twe_surface_wait_dequeueable(twe_surface_h twe_surface, uint64_t timeout_ns); +tpl_result_t +twe_surface_queue_force_flush(twe_surface_h twe_surface); + tpl_bool_t twe_check_native_handle_is_wl_display(tpl_handle_t display); diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 6f7f4a4..f819b45 100644 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -634,6 +634,8 @@ __tpl_wl_egl_surface_cancel_dequeued_buffer(tpl_surface_t *surface, return TPL_ERROR_NONE; } +#define CAN_DEQUEUE_TIMEOUT_MS 5000 + static tbm_surface_h __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, tbm_fd *sync_fence) @@ -658,11 +660,8 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, *sync_fence = -1; TPL_OBJECT_UNLOCK(surface); - if (!tbm_surface_queue_can_dequeue(wayland_egl_surface->tbm_queue, 1)) { - TPL_ERR("Failed to query can_dequeue. tbm_queue(%p)", wayland_egl_surface->tbm_queue); - TPL_OBJECT_LOCK(surface); - return NULL; - } + tsq_err = tbm_surface_queue_can_dequeue_wait_timeout( + wayland_egl_surface->tbm_queue, CAN_DEQUEUE_TIMEOUT_MS); TPL_OBJECT_LOCK(surface); /* After the can dequeue state, call twe_display_lock to prevent other @@ -670,6 +669,27 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, * during below dequeue procedure. */ lock_ret = twe_display_lock(wayland_egl_display->twe_display); + if (tsq_err == TBM_SURFACE_QUEUE_ERROR_TIMEOUT) { + TPL_ERR("[CAN_DEQUEUE_TIMEOUT] queue(%p) will be reset", + wayland_egl_surface->tbm_queue); + if (twe_surface_queue_force_flush(wayland_egl_surface->twe_surface) + != TPL_ERROR_NONE) { + TPL_ERR("Failed to timeout reset. tbm_queue(%p)", wayland_egl_surface->tbm_queue); + if (lock_ret == TPL_ERROR_NONE) + twe_display_unlock(wayland_egl_display->twe_display); + return NULL; + } else { + tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE; + } + } + + if (tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE) { + TPL_ERR("Failed to query can_dequeue. tbm_queue(%p)", wayland_egl_surface->tbm_queue); + if (lock_ret == TPL_ERROR_NONE) + twe_display_unlock(wayland_egl_display->twe_display); + return NULL; + } + /* wayland client can check their states (ACTIVATED or DEACTIVATED) with * below function [wayland_tbm_client_queue_check_activate()]. * This function has to be called before tbm_surface_queue_dequeue() -- 2.7.4 From 017786d0c793ec882b9359cfd79d7b870752287b Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 28 Dec 2018 18:06:47 +0900 Subject: [PATCH 11/16] Package version up to 1.5.27 - API dependency ( libtbm-3.0.9 ) tbm_surface_queue_can_dequeue_wait_timeout() Change-Id: I457145607f227118b5723653098f676d0b8a80e9 Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index b94a34a..09dbab6 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 5 -%define TPL_VERSION_PATCH 26 +%define TPL_VERSION_PATCH 27 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 75ff4e2251d0fdf4c525b9d7e046d6ca1189a333 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 8 Jan 2019 16:20:10 +0900 Subject: [PATCH 12/16] tpl_wayland_egl(_thread): Initialized the callbacks of wl_egl_window to NULL when destroy. Change-Id: I288df9cb513fea71f615f66068b4109b4677fbb9 Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl.c | 5 +++++ src/tpl_wayland_egl_thread.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 5b2431f..387882d 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -674,6 +674,11 @@ __tpl_wayland_egl_surface_fini(tpl_surface_t *surface) /* TPL_ASSERT(wl_egl_window->surface); */ /* to be enabled once evas/gl patch is in place */ wl_egl_window->private = NULL; + wl_egl_window->resize_callback = NULL; + wl_egl_window->rotate_callback = NULL; + wl_egl_window->get_rotation_capability = NULL; + wl_egl_window->set_frontbuffer_callback = NULL; + wl_egl_window->set_window_serial_callback = NULL; __tpl_wayland_egl_surface_buffer_flusher_fini(surface); diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 3e9a913..1b7cb84 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -2318,9 +2318,11 @@ _twe_thread_wl_surf_source_destroy(void *source) if (surf_source->wl_egl_window) { TPL_LOG_T(BACKEND, "twe_surface(%p) wl_egl_window(%p) wl_surface(%p)", surf_source, surf_source->wl_egl_window, surf_source->surf); + surf_source->wl_egl_window->set_window_serial_callback = NULL; surf_source->wl_egl_window->destroy_window_callback = NULL; surf_source->wl_egl_window->resize_callback = NULL; surf_source->wl_egl_window->rotate_callback = NULL; + surf_source->wl_egl_window->get_rotation_capability = NULL; surf_source->wl_egl_window->private = NULL; surf_source->wl_egl_window = NULL; surf_source->surf = NULL; -- 2.7.4 From e52b73e2a2f6dac6be5e2675292ea333a1e84bbe Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 14 Jan 2019 13:28:47 +0900 Subject: [PATCH 13/16] Package version up to 1.5.28 Change-Id: I1c65cedf0c2c91ba411cd849b5525be8bf50744a Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index 09dbab6..f12db99 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 5 -%define TPL_VERSION_PATCH 27 +%define TPL_VERSION_PATCH 28 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From d3320be930b9e8bcaadeb1cf3e811c641f3c55af Mon Sep 17 00:00:00 2001 From: Zhaowei Yuan Date: Mon, 28 Jan 2019 15:56:44 +0800 Subject: [PATCH 14/16] Fix a typo Change-Id: Id6a01bb111ff0ea00aa38a4f10fafc96d1203651 Signed-off-by: Zhaowei Yuan --- src/tpl_wl_egl_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index f819b45..faf8d13 100644 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -542,7 +542,7 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface, "[ENQ_SKIP][F] Client already uses frontbuffer(%p)", surface->frontbuffer); - /* The first buffer to be activated in frontbuffer mode muse be + /* The first buffer to be activated in frontbuffer mode must be * committed. Subsequence frames do not need to be committed because * the buffer is already displayed. */ -- 2.7.4 From 42820fad94344eed662b79053ac3aac0a2eb4111 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 29 Jan 2019 15:59:17 +0900 Subject: [PATCH 15/16] tpl_wl_egl_thread: Fixed a bug related to frontbuffer mode. Change-Id: I160d5c6002fef08d9e66e6b030dba87ab7d1016f Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index faf8d13..40f1f28 100644 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -32,6 +32,7 @@ struct _tpl_wayland_egl_surface { tbm_surface_queue_h tbm_queue; tpl_bool_t is_activated; tpl_bool_t reset; /* TRUE if queue reseted by external */ + tpl_bool_t need_to_enqueue; }; static tpl_result_t @@ -374,6 +375,7 @@ __tpl_wl_egl_surface_init(tpl_surface_t *surface) wayland_egl_surface->twe_surface = twe_surface; wayland_egl_surface->tbm_queue = tbm_queue; wayland_egl_surface->is_activated = TPL_FALSE; + wayland_egl_surface->need_to_enqueue = TPL_TRUE; surface->width = tbm_surface_queue_get_width(tbm_queue); surface->height = tbm_surface_queue_get_height(tbm_queue); @@ -537,21 +539,26 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface, * commit if surface->frontbuffer that is already set and the tbm_surface * client want to enqueue are the same. */ - if (surface->is_frontbuffer_mode && surface->frontbuffer == tbm_surface) { - TPL_LOG_T("WL_EGL", - "[ENQ_SKIP][F] Client already uses frontbuffer(%p)", - surface->frontbuffer); - + if (surface->is_frontbuffer_mode) { /* The first buffer to be activated in frontbuffer mode must be * 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)) { + + if (!wayland_egl_surface->need_to_enqueue || + (surface->frontbuffer == tbm_surface && + !twe_surface_check_commit_needed(wayland_egl_surface->twe_surface, + surface->frontbuffer))) { + TPL_LOG_T("WL_EGL", + "[ENQ_SKIP][F] Client already uses frontbuffer(%p)", + 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; } + + if (surface->frontbuffer == tbm_surface) + wayland_egl_surface->need_to_enqueue = TPL_FALSE; } if (sync_fence != -1) { @@ -724,8 +731,10 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, if (lock_ret == TPL_ERROR_NONE) twe_display_unlock(wayland_egl_display->twe_display); return surface->frontbuffer; - } else + } else { surface->frontbuffer = NULL; + wayland_egl_surface->need_to_enqueue = TPL_TRUE; + } } else { surface->frontbuffer = NULL; } -- 2.7.4 From 386547df5f2056ee255dd4a5b91792fcffbe596f Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 31 Jan 2019 09:34:46 +0900 Subject: [PATCH 16/16] Package version up to 1.5.29 Change-Id: I6d35a800f2ea18fdaef343845f18da83d9132f51 Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index f12db99..2a80187 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 5 -%define TPL_VERSION_PATCH 28 +%define TPL_VERSION_PATCH 29 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4