From 144d8cf6c1de851d033bbb267657b9478a0169d5 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 1 Nov 2024 14:49:27 +0900 Subject: [PATCH] wl_egl: make sure the destruction of gsource is complete - In case of wayland protocol error, gsource is deleted but there is a problem where display_fini stops at cond_wait because disp_source is not initialized to null in finalize. Change-Id: I0a1fd4c850da5d843dd674d54364936e749b6950 Signed-off-by: Joonbum Ko --- src/tpl_wl_egl_thread.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 03b1cd6..b4886ff 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -530,8 +530,6 @@ __thread_func_tdm_dispatch(tpl_gsource *gsource, uint64_t message) tpl_gsource_destroy(gsource, TPL_FALSE); - wl_egl_display->tdm.tdm_source = NULL; - return TPL_FALSE; } @@ -561,12 +559,12 @@ __thread_func_tdm_finalize(tpl_gsource *gsource) tdm_client_destroy(wl_egl_display->tdm.tdm_client); wl_egl_display->tdm.tdm_client = NULL; wl_egl_display->tdm.tdm_display_fd = -1; - wl_egl_display->tdm.tdm_source = NULL; } wl_egl_display->use_wait_vblank = TPL_FALSE; wl_egl_display->tdm.tdm_initialized = TPL_FALSE; wl_egl_display->tdm.gsource_finalized = TPL_TRUE; + wl_egl_display->tdm.tdm_source = NULL; tpl_gcond_signal(&wl_egl_display->tdm.tdm_cond); tpl_gmutex_unlock(&wl_egl_display->tdm.tdm_mutex); @@ -876,7 +874,6 @@ _thread_wl_display_fini(tpl_wl_egl_display_t *wl_egl_display) wl_event_queue_destroy(wl_egl_display->ev_queue); wl_egl_display->ev_queue = NULL; - wl_egl_display->wl_initialized = TPL_FALSE; TPL_INFO("[DISPLAY_FINI]", "wl_egl_display(%p) wl_display(%p)", wl_egl_display, wl_egl_display->wl_display); @@ -1004,7 +1001,9 @@ __thread_func_disp_finalize(tpl_gsource *gsource) if (wl_egl_display->wl_initialized) _thread_wl_display_fini(wl_egl_display); + wl_egl_display->wl_initialized = TPL_FALSE; wl_egl_display->gsource_finalized = TPL_TRUE; + wl_egl_display->disp_source = NULL; tpl_gcond_signal(&wl_egl_display->disp_cond); tpl_gmutex_unlock(&wl_egl_display->disp_mutex); @@ -1197,7 +1196,6 @@ __tpl_wl_egl_display_fini(tpl_display_t *display) while (!wl_egl_display->tdm.gsource_finalized) { tpl_gcond_wait(&wl_egl_display->tdm.tdm_cond, &wl_egl_display->tdm.tdm_mutex); } - wl_egl_display->tdm.tdm_source = NULL; tpl_gmutex_unlock(&wl_egl_display->tdm.tdm_mutex); } @@ -1213,7 +1211,6 @@ __tpl_wl_egl_display_fini(tpl_display_t *display) while (!wl_egl_display->gsource_finalized) { tpl_gcond_wait(&wl_egl_display->disp_cond, &wl_egl_display->disp_mutex); } - wl_egl_display->disp_source = NULL; tpl_gmutex_unlock(&wl_egl_display->disp_mutex); } @@ -1880,6 +1877,7 @@ __thread_func_surf_finalize(tpl_gsource *gsource) _thread_wl_egl_surface_fini(wl_egl_surface); wl_egl_surface->gsource_finalized = TPL_TRUE; + wl_egl_surface->surf_source = NULL; tpl_gcond_signal(&wl_egl_surface->surf_cond); tpl_gmutex_unlock(&wl_egl_surface->surf_mutex); @@ -2500,7 +2498,6 @@ __tpl_wl_egl_surface_fini(tpl_surface_t *surface) while (!wl_egl_surface->gsource_finalized) { tpl_gcond_wait(&wl_egl_surface->surf_cond, &wl_egl_surface->surf_mutex); } - wl_egl_surface->surf_source = NULL; } tpl_gmutex_unlock(&wl_egl_surface->surf_mutex); -- 2.34.1