From 534d18b352d930c5dea62cda349d2e4b7e6a399d Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 13 Sep 2018 15:40:59 +0900 Subject: [PATCH 01/16] Package version up to 1.5.17 Change-Id: Ifca8d8586dfbf9f11c1e45bf9cbae52b25e3ef7f 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 3a510b5..67f33bb 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 16 +%define TPL_VERSION_PATCH 17 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From e142edc633335129f6d00b452a7cd3730c331d44 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 13 Sep 2018 18:47:35 +0900 Subject: [PATCH 02/16] tpl_vk_wsi_thread: Increased the ref_cnt of swapchain_buffers. - vulkan-wsi-tizen creates vkImage(s) from the swapchain_buffers obtained from the tpl_surface_get_swapchain_buffers() API. - If the queue_reset occurs in the event thread, then swapchain_buffers that have already been acquired by wsi will be destroyed, which can cause problems. - Therefore, even if queue_reset occurs in event_thread, TPL must increase ref_cnt of swapchain_buffers so that it is valid until swapchain is destroyed. Change-Id: Ibe41f212a64da89dbc30ea3f137f44dab187eb50 Signed-off-by: Joonbum Ko --- src/tpl_wl_vk_thread.c | 57 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/src/tpl_wl_vk_thread.c b/src/tpl_wl_vk_thread.c index 5db9ec7..96ac5da 100644 --- a/src/tpl_wl_vk_thread.c +++ b/src/tpl_wl_vk_thread.c @@ -23,6 +23,7 @@ struct _tpl_wayland_vk_wsi_display { struct _tpl_wayland_vk_wsi_surface { twe_surface_h twe_surface; tbm_surface_queue_h tbm_queue; + tbm_surface_h *swapchain_buffers; int buffer_count; tpl_bool_t is_activated; tpl_bool_t reset; @@ -287,6 +288,7 @@ __tpl_wl_vk_wsi_surface_init(tpl_surface_t *surface) wayland_vk_wsi_surface->twe_surface = twe_surface; wayland_vk_wsi_surface->is_activated = TPL_FALSE; + wayland_vk_wsi_surface->swapchain_buffers = NULL; TPL_LOG_T("WL_VK", "[INIT]tpl_surface(%p) tpl_wayland_vk_wsi_surface(%p) twe_surface(%p)", @@ -314,6 +316,11 @@ __tpl_wl_vk_wsi_surface_fini(tpl_surface_t *surface) if (wayland_vk_wsi_surface->tbm_queue) __tpl_wl_vk_wsi_surface_destroy_swapchain(surface); + if (wayland_vk_wsi_surface->swapchain_buffers) { + free(wayland_vk_wsi_surface->swapchain_buffers); + wayland_vk_wsi_surface->swapchain_buffers = NULL; + } + TPL_LOG_T("WL_VK", "[FINI] wayland_vk_wsi_surface(%p) native_surface(%p) twe_surface(%p)", wayland_vk_wsi_surface, surface->native_handle, @@ -520,7 +527,6 @@ __tpl_wl_vk_wsi_surface_get_swapchain_buffers(tpl_surface_t *surface, tbm_surface_h **buffers, int *buffer_count) { - tbm_surface_h *swapchain_buffers = NULL; tpl_wayland_vk_wsi_surface_t *wayland_vk_wsi_surface = NULL; tpl_wayland_vk_wsi_display_t *wayland_vk_wsi_display = NULL; int i; @@ -534,9 +540,10 @@ __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; - swapchain_buffers = (tbm_surface_h *)calloc( - wayland_vk_wsi_surface->buffer_count, sizeof(tbm_surface_h)); - if (!swapchain_buffers) { + 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; } @@ -545,22 +552,27 @@ __tpl_wl_vk_wsi_surface_get_swapchain_buffers(tpl_surface_t *surface, 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, - swapchain_buffers, buffer_count); + wayland_vk_wsi_surface->swapchain_buffers, + buffer_count); if (ret != TPL_ERROR_NONE) { TPL_ERR("Failed to get swapchain_buffers. wayland_vk_wsi_surface(%p) twe_surface(%p)", wayland_vk_wsi_surface, wayland_vk_wsi_surface->twe_surface); - free(swapchain_buffers); - swapchain_buffers = NULL; + free(wayland_vk_wsi_surface->swapchain_buffers); + wayland_vk_wsi_surface->swapchain_buffers = NULL; + twe_display_unlock(wayland_vk_wsi_display->twe_display); return ret; } for (i = 0; i < *buffer_count; i++) { TPL_DEBUG("swapchain_buffers[%d] = tbm_surface(%p) bo(%d)", - i, swapchain_buffers[i], - tbm_bo_export(tbm_surface_internal_get_bo(swapchain_buffers[i], 0))); + 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 = swapchain_buffers; + + *buffers = wayland_vk_wsi_surface->swapchain_buffers; twe_display_unlock(wayland_vk_wsi_display->twe_display); } @@ -645,6 +657,18 @@ __tpl_wl_vk_wsi_surface_create_swapchain(tpl_surface_t *surface, __tpl_util_atomic_inc(&wayland_vk_wsi_surface->swapchain_reference); + if (wayland_vk_wsi_surface->swapchain_buffers) { + int i; + for (i = 0; i < wayland_vk_wsi_surface->buffer_count; i++) { + TPL_DEBUG("unref tbm_surface(%p)", wayland_vk_wsi_surface->swapchain_buffers[i]); + tbm_surface_internal_unref(wayland_vk_wsi_surface->swapchain_buffers[i]); + wayland_vk_wsi_surface->swapchain_buffers[i] = NULL; + } + + free(wayland_vk_wsi_surface->swapchain_buffers); + wayland_vk_wsi_surface->swapchain_buffers = NULL; + } + TPL_LOG_T("WL_VK", "[REUSE] wayland_vk_wsi_surface(%p) tbm_queue(%p) size(%d)", wayland_vk_wsi_surface, wayland_vk_wsi_surface->tbm_queue, wayland_vk_wsi_surface->buffer_count); @@ -715,6 +739,19 @@ __tpl_wl_vk_wsi_surface_destroy_swapchain(tpl_surface_t *surface) return TPL_ERROR_NONE; } + if (wayland_vk_wsi_surface->swapchain_buffers) { + int i; + for (i = 0; i < wayland_vk_wsi_surface->buffer_count; i++) { + TPL_DEBUG("Stop tracking tbm_surface(%p)", + wayland_vk_wsi_surface->swapchain_buffers[i]); + tbm_surface_internal_unref(wayland_vk_wsi_surface->swapchain_buffers[i]); + wayland_vk_wsi_surface->swapchain_buffers[i] = NULL; + } + + free(wayland_vk_wsi_surface->swapchain_buffers); + wayland_vk_wsi_surface->swapchain_buffers = NULL; + } + res = twe_surface_destroy_swapchain(wayland_vk_wsi_surface->twe_surface); if (res != TPL_ERROR_NONE) { TPL_ERR("Failed to destroy swapchain. twe_surface(%p)", -- 2.7.4 From 6b0a749c498be3408e987b1039e9606d99d3c374 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 14 Sep 2018 11:00:06 +0900 Subject: [PATCH 03/16] Package version up to 1.5.18 Change-Id: I3d315a58c125dce96d061f245dbd93a8ad00fd72 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 67f33bb..fb772ee 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 17 +%define TPL_VERSION_PATCH 18 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 2362cc838a6548e10eeb5a3bf0a62673a2d315a3 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Wed, 19 Sep 2018 14:45:48 +0900 Subject: [PATCH 04/16] tpl_wayland_egl_thread: Modified wait_vblank handling of PRESENT_MODE_FIFO. - PRESENT_MODE_FIFO has been modified to be dependent on the behavior of the display server which can use HW vblank. (Therefore, PRESENT_MODE_IMMEDIATE and PRESENT_MODE_FIFO_RELAXED are not meaningful because client can not control HW vblank.) - If the client sends a commit only once per one vblank, the display server will perform pageflip on the HW vsync, so the latency of PRESENT_MODE_FIFO can be reduced. Change-Id: Ie3802e0a7b93515827e93c6712bb8cf3160640ce Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 12b7315..62061b4 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -1644,24 +1644,6 @@ __cb_tdm_client_wait_vblank(tdm_client_vblank *vblank, tdm_error error, break; case TPL_DISPLAY_PRESENT_MODE_FIFO: - if (surf_source->vblank_waiting_buffers) { - tbm_surface_h tbm_surface = NULL; - tbm_surface = (tbm_surface_h)__tpl_list_pop_front( - surf_source->vblank_waiting_buffers, - NULL); - if (tbm_surface) - _twe_thread_wl_vk_surface_commit(surf_source, tbm_surface); - } - - if (!__tpl_list_is_empty(surf_source->vblank_waiting_buffers)) { - tpl_result_t res = TPL_ERROR_NONE; - res = _twe_surface_wait_vblank(surf_source); - if (res != TPL_ERROR_NONE) - TPL_ERR("Failed to set wait vblank. surf_source(%p)", - surf_source); - } - break; - case TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED: if (surf_source->vblank_waiting_buffers) { tbm_surface_h tbm_surface = NULL; @@ -1780,7 +1762,9 @@ _twe_thread_wl_vk_surface_commit(twe_wl_surf_source *surf_source, tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0))); if (surf_source->swapchain_properties.present_mode - == TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED) { + == TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED || + surf_source->swapchain_properties.present_mode + == TPL_DISPLAY_PRESENT_MODE_FIFO) { if (_twe_surface_wait_vblank(surf_source) != TPL_ERROR_NONE) TPL_ERR("Failed to set wait vblank"); } @@ -2002,21 +1986,6 @@ _twe_thread_wl_surface_acquire_and_commit(twe_wl_surf_source *surf_source) break; case TPL_DISPLAY_PRESENT_MODE_FIFO: - if (surf_source->vblank_done) { - if (_twe_surface_wait_vblank(surf_source) != TPL_ERROR_NONE) { - TPL_WARN("Failed to set wait vblank. Falling back to IMMEDIATE_MODE."); - _twe_thread_wl_vk_surface_commit(surf_source, tbm_surface); - } - } - if (surf_source->vblank_waiting_buffers) { - __tpl_list_push_back(surf_source->vblank_waiting_buffers, - (void *)tbm_surface); - - } else { - TPL_ERR("Invalid list. vblank_waiting_buffers is NULL."); - } - break; - case TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED: if (surf_source->vblank_done) { _twe_thread_wl_vk_surface_commit(surf_source, tbm_surface); -- 2.7.4 From f9d222f05c060c5a33f41a8238edbb9c7727e7f1 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Wed, 19 Sep 2018 15:09:19 +0900 Subject: [PATCH 05/16] Package version up to 1.5.19 Change-Id: I9478b93838f55a6df38aa8ea1b84a6b5767c925f 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 fb772ee..c158978 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 18 +%define TPL_VERSION_PATCH 19 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 664670a535f1ae755f028ce05e974a0c354124b1 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 21 Sep 2018 10:20:42 +0900 Subject: [PATCH 06/16] tpl_wayland_egl: Modified to update the transform information of newly created buffers. Change-Id: If2cca56e29f79b4ca3bf7cb6a755959d4e2c134d Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 490518f..1dbdf49 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -1340,6 +1340,7 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wayland_egl_buffer->bo = tbm_surface_internal_get_bo(tbm_surface, 0); wayland_egl_buffer->wayland_egl_surface = wayland_egl_surface; wayland_egl_buffer->transform = wl_egl_window->transform; + wayland_egl_buffer->rotated = TPL_TRUE; if (wayland_egl_buffer->window_transform != wl_egl_window->window_transform) { wayland_egl_buffer->window_transform = wl_egl_window->window_transform; -- 2.7.4 From 25371946cd9f39ebf467eaf49677ea36a3135200 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 21 Sep 2018 10:22:44 +0900 Subject: [PATCH 07/16] Package version up to 1.5.20 Change-Id: I87c74ae438518db4464e764da6e8e08a8bb45a8f 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 c158978..f7bd94d 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 19 +%define TPL_VERSION_PATCH 20 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 6eaf4578beac21b511d632844ef60d9cc48e3947 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 26 Oct 2018 08:53:44 +0900 Subject: [PATCH 08/16] tpl_wl_egl_thread: Changed the wait flag to enable waiting in can_dequeue. - Using the while loop with can_dequeue(wait=0) can occur high cpu usage problem. Change-Id: Ic7645b336eeeb0088354838ae9b3c32259dbe9ec Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index e9e463b..07ba6cc 100644 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -661,8 +661,9 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, *sync_fence = -1; TPL_OBJECT_UNLOCK(surface); - while (!tbm_surface_queue_can_dequeue(wayland_egl_surface->tbm_queue, 0)) { - /* waiting for dequeueable */ + 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); + return NULL; } TPL_OBJECT_LOCK(surface); -- 2.7.4 From b5baebd1971fcf5f2052b7754932da8896435d89 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 26 Oct 2018 08:59:52 +0900 Subject: [PATCH 09/16] Package version up to 1.5.21 Change-Id: I9ba3e4b2404259f4be4d89cf8d9256959f3146ee Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index f7bd94d..6416509 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,14 +4,14 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 5 -%define TPL_VERSION_PATCH 20 +%define TPL_VERSION_PATCH 21 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION %define TPL_WINSYS WL #TPL FEATURE OPTION -%define ENABLE_TTRACE 0 +%define ENABLE_TTRACE 1 %define ENABLE_DLOG 1 %define ENABLE_DEFAULT_LOG 0 %define ENABLE_DEFAULT_DUMP 0 -- 2.7.4 From 24c67d9bb1059885a9536a4244dbcba0416194f3 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 29 Oct 2018 19:31:00 +0900 Subject: [PATCH 10/16] tpl_wayland_egl_thread: Enabled vblank pending list. Change-Id: I706d67a9b1fb9859782c0cc6c1894bd8e73e830c Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 62061b4..cb02e46 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -2434,6 +2434,8 @@ twe_surface_add(twe_thread* thread, source->surf = wl_egl_window->surface; source->latest_transform = wl_egl_window->transform; + source->vblank_waiting_buffers = __tpl_list_alloc(); + } else { struct wl_surface *wl_surf = (struct wl_surface *)native_handle; -- 2.7.4 From a2170068237bbb13448a6f866393fab2bf1e2d46 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 29 Oct 2018 19:39:33 +0900 Subject: [PATCH 11/16] tpl_wayland_egl_thread: Added an exception checking to prevent blocking issue. Change-Id: I3fce4d6db3e4f4a4dd7446b3946edc523c31e148 Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index cb02e46..ef1675c 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -612,6 +612,8 @@ _twe_thread_wl_disp_check(GSource *source) gboolean ret = FALSE; if (g_source_is_destroyed(source)) { + if (disp_source && disp_source->disp && disp_source->prepared) + wl_display_cancel_read(disp_source->disp); TPL_ERR("display source(%p) already destroyed.", source); return ret; } -- 2.7.4 From 9203082348cfc22098fdf1d80fd60d522e053997 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 29 Oct 2018 19:40:21 +0900 Subject: [PATCH 12/16] Package version up to 1.5.22 Change-Id: I307e28cb09f251722725ad426f8a1be783ad2f38 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 6416509..db13f9e 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 21 +%define TPL_VERSION_PATCH 22 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From d3eff2423c9a371490664d85f97083c7e12066de Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Wed, 31 Oct 2018 13:57:07 +0900 Subject: [PATCH 13/16] tpl_wl_vk_thread: Fixed bug to prevent heap-buffer-overflow. Change-Id: I991585fd99975196715d98a23b83603f4f20bf62 Signed-off-by: Joonbum Ko --- src/tpl_wl_vk_thread.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/tpl_wl_vk_thread.c b/src/tpl_wl_vk_thread.c index 96ac5da..43f5a84 100644 --- a/src/tpl_wl_vk_thread.c +++ b/src/tpl_wl_vk_thread.c @@ -651,24 +651,26 @@ __tpl_wl_vk_wsi_surface_create_swapchain(tpl_surface_t *surface, old_width, old_height, width, height); } - wayland_vk_wsi_surface->buffer_count = - tbm_surface_queue_get_size(wayland_vk_wsi_surface->tbm_queue); - wayland_vk_wsi_surface->reset = TPL_FALSE; - - __tpl_util_atomic_inc(&wayland_vk_wsi_surface->swapchain_reference); - if (wayland_vk_wsi_surface->swapchain_buffers) { int i; for (i = 0; i < wayland_vk_wsi_surface->buffer_count; i++) { - TPL_DEBUG("unref tbm_surface(%p)", wayland_vk_wsi_surface->swapchain_buffers[i]); - tbm_surface_internal_unref(wayland_vk_wsi_surface->swapchain_buffers[i]); - wayland_vk_wsi_surface->swapchain_buffers[i] = NULL; + if (wayland_vk_wsi_surface->swapchain_buffers[i]) { + TPL_DEBUG("unref tbm_surface(%p)", wayland_vk_wsi_surface->swapchain_buffers[i]); + tbm_surface_internal_unref(wayland_vk_wsi_surface->swapchain_buffers[i]); + wayland_vk_wsi_surface->swapchain_buffers[i] = NULL; + } } free(wayland_vk_wsi_surface->swapchain_buffers); wayland_vk_wsi_surface->swapchain_buffers = NULL; } + wayland_vk_wsi_surface->buffer_count = + tbm_surface_queue_get_size(wayland_vk_wsi_surface->tbm_queue); + wayland_vk_wsi_surface->reset = TPL_FALSE; + + __tpl_util_atomic_inc(&wayland_vk_wsi_surface->swapchain_reference); + TPL_LOG_T("WL_VK", "[REUSE] wayland_vk_wsi_surface(%p) tbm_queue(%p) size(%d)", wayland_vk_wsi_surface, wayland_vk_wsi_surface->tbm_queue, wayland_vk_wsi_surface->buffer_count); -- 2.7.4 From 751ee152711fd2fbb3b9dc5aa8874e40d0ca09d0 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Wed, 7 Nov 2018 11:15:08 +0900 Subject: [PATCH 14/16] Package version up to 1.5.23 Change-Id: Iefdebf43d8f7ba9cbfbe7cf975473edbddcbd4b1 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 db13f9e..87ca744 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 22 +%define TPL_VERSION_PATCH 23 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From a6ac9378c340d47fe92ec5620ff87579d6f06107 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 8 Nov 2018 14:39:38 +0900 Subject: [PATCH 15/16] 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 From e8e648478d1bca94d45897b1447d2bd0f66d5e45 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 8 Nov 2018 19:12:06 +0900 Subject: [PATCH 16/16] Package version up to 1.5.24 Change-Id: Ic9ea9c802d8e2b831e6207c52cae35b8f49b0a80 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 87ca744..773d1ad 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 23 +%define TPL_VERSION_PATCH 24 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4