From 202e2f2249d3d02b58cc6a123f7e517a79239e95 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 14 Dec 2021 13:35:06 +0900 Subject: [PATCH] Initialize wl_egl_buffer->waiting_source in mutex protection. - the buffer_clear() of the main thread could occur thread conflict. - the pointer wl_egl_buffer->waiting_source must be protected. Change-Id: I4af88b06ff104a39c1fc0aa890d1cab74f589eb7 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 6fcce36..1a96557 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -2731,6 +2731,15 @@ __thread_func_waiting_source_dispatch(tpl_gsource *gsource, uint64_t message) tpl_gmutex_lock(&wl_egl_buffer->mutex); wl_egl_buffer->status = WAITING_VBLANK; + + TPL_DEBUG("[FINALIZE] wl_egl_buffer(%p) wait_source(%p) fence_fd(%d)", + wl_egl_buffer, wl_egl_buffer->waiting_source, + wl_egl_buffer->acquire_fence_fd); + + close(wl_egl_buffer->acquire_fence_fd); + wl_egl_buffer->acquire_fence_fd = -1; + wl_egl_buffer->waiting_source = NULL; + tpl_gmutex_unlock(&wl_egl_buffer->mutex); tpl_gmutex_lock(&wl_egl_surface->surf_mutex); @@ -2749,16 +2758,7 @@ __thread_func_waiting_source_dispatch(tpl_gsource *gsource, uint64_t message) static void __thread_func_waiting_source_finalize(tpl_gsource *gsource) { - tpl_wl_egl_buffer_t *wl_egl_buffer = - (tpl_wl_egl_buffer_t *)tpl_gsource_get_data(gsource); - - TPL_DEBUG("[FINALIZE] wl_egl_buffer(%p) wait_source(%p) fence_fd(%d)", - wl_egl_buffer, wl_egl_buffer->waiting_source, - wl_egl_buffer->acquire_fence_fd); - - close(wl_egl_buffer->acquire_fence_fd); - wl_egl_buffer->acquire_fence_fd = -1; - wl_egl_buffer->waiting_source = NULL; + TPL_IGNORE(gsource); } static tpl_gsource_functions buffer_funcs = { -- 2.34.1