wl_egl: Add logs for debuging 17/305917/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Tue, 13 Feb 2024 11:31:13 +0000 (20:31 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Tue, 13 Feb 2024 11:32:08 +0000 (20:32 +0900)
Change-Id: I18bf09a54d5075630c562cb6a652c0543e4a9ef0
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wl_egl_thread.c

index f77d7ad97ece2f77769e297fa187cb9ee25549a6..5d5b263131dac20f81ea52b07517828b3d9c29ce 100755 (executable)
@@ -702,6 +702,8 @@ _thread_wl_display_fini(tpl_wl_egl_display_t *wl_egl_display)
                                 wl_egl_display, wl_egl_display->wl_tbm_client);
                wayland_tbm_client_deinit(wl_egl_display->wl_tbm_client);
                wl_egl_display->wl_tbm_client = NULL;
+               TPL_INFO("[WL_TBM_DEINIT_DONE]",
+                                "wl_egl_display(%p)", wl_egl_display);
        }
 
        wl_event_queue_destroy(wl_egl_display->ev_queue);
@@ -836,8 +838,12 @@ __thread_func_disp_finalize(tpl_gsource *gsource)
        TPL_LOG_D("[D_FINALIZE]", "wl_egl_display(%p) tpl_gsource(%p)",
                          wl_egl_display, gsource);
 
+       TPL_INFO("[FINALIZE_BEGIN]", "wl_egl_display(%p) tpl_gsource(%p)",
+                         wl_egl_display, gsource);
        if (wl_egl_display->wl_initialized)
                _thread_wl_display_fini(wl_egl_display);
+       TPL_INFO("[FINALIZE_END]", "wl_egl_display(%p) tpl_gsource(%p)",
+                        wl_egl_display, gsource);
 
        wl_egl_display->gsource_finalized = TPL_TRUE;
 
@@ -1019,7 +1025,7 @@ __tpl_wl_egl_display_fini(tpl_display_t *display)
 
        wl_egl_display = (tpl_wl_egl_display_t *)display->backend.data;
        if (wl_egl_display) {
-               TPL_INFO("[DISPLAY_FINI]",
+               TPL_INFO("[DISPLAY_FINI_BEGIN]",
                                  "wl_egl_display(%p) tpl_gthread(%p) wl_display(%p)",
                                  wl_egl_display,
                                  wl_egl_display->thread,
@@ -1041,21 +1047,26 @@ __tpl_wl_egl_display_fini(tpl_display_t *display)
                        tpl_gmutex_unlock(&wl_egl_display->tdm.tdm_mutex);
                }
 
+               tpl_gmutex_lock(&wl_egl_display->disp_mutex);
+               TPL_INFO("[DISP_SOURCE_DESTROY_BEGIN]", "wl_egl_display(%p) disp_source(%p)",
+                                wl_egl_display, wl_egl_display->disp_source);
                if (wl_egl_display->disp_source) {
-                       tpl_gmutex_lock(&wl_egl_display->disp_mutex);
                        // Send destroy mesage to thread
                        tpl_gsource_destroy(wl_egl_display->disp_source, TPL_TRUE);
+
                        /* This is a protection to prevent problems that arise in unexpected situations
                         * that g_cond_wait cannot work normally.
                         * When calling tpl_gsource_destroy() with destroy_in_thread is TPL_TRUE,
                         * caller should use tpl_gcond_wait() in the loop with checking finalized flag
                         * */
-                       while (!wl_egl_display->gsource_finalized) {
+                       do {
                                tpl_gcond_wait(&wl_egl_display->disp_cond, &wl_egl_display->disp_mutex);
-                       }
+                       } while (!wl_egl_display->gsource_finalized);
+
                        wl_egl_display->disp_source = NULL;
-                       tpl_gmutex_unlock(&wl_egl_display->disp_mutex);
                }
+               TPL_INFO("[DISP_SOURCE_DESTROY_END]", "wl_egl_display(%p)", wl_egl_display);
+               tpl_gmutex_unlock(&wl_egl_display->disp_mutex);
 
                if (wl_egl_display->thread) {
                        tpl_gthread_destroy(wl_egl_display->thread);
@@ -1069,6 +1080,9 @@ __tpl_wl_egl_display_fini(tpl_display_t *display)
 
                tpl_gmutex_clear(&wl_egl_display->wl_event_mutex);
 
+               TPL_INFO("[DISPLAY_FINI_END]",
+                                 "wl_egl_display(%p)", wl_egl_display);
+
                free(wl_egl_display);
        }