From be51392311d4a004ed5484ee64a3d88e7bbd4b36 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 7 Jul 2023 13:09:29 +0900 Subject: [PATCH] log: add & apply TPL_LOG_D instead of TPL_DEBUG - TPL_LOG_D can print the tag manually. - The prefix of almost all logs is modified to print wl_egl_surface to distinguish each wl_egl_surface. Change-Id: I68a5b450693ed0d9422a9ba72e119f56235d7a32 Signed-off-by: Joonbum Ko --- src/tpl.c | 3 +- src/tpl_utils.h | 7 ++-- src/tpl_utils_gthread.c | 12 ++++--- src/tpl_wayland_egl.c | 2 +- src/tpl_wl_egl_thread.c | 95 +++++++++++++++++++++++++------------------------ src/tpl_wl_vk_thread.c | 54 +++++++++++++++------------- 6 files changed, 93 insertions(+), 80 deletions(-) diff --git a/src/tpl.c b/src/tpl.c index 1f2bd4e..90e5807 100644 --- a/src/tpl.c +++ b/src/tpl.c @@ -41,7 +41,7 @@ __tpl_init(void) tpl_getenv_initialized = 1; } - TPL_DEBUG("[libtpl-egl] loaded"); + TPL_LOG_D("[libtpl-egl][constructor]", "loaded"); #ifdef OBJECT_HASH_CHECK __tpl_object_hash_init(); #endif @@ -67,6 +67,7 @@ __tpl_runtime_fini(void) pthread_mutex_unlock(&runtime_mutex); } + TPL_LOG_D("[libtpl-egl][destructor]", "finished"); #ifdef OBJECT_HASH_CHECK __tpl_object_hash_shutdown(); #endif diff --git a/src/tpl_utils.h b/src/tpl_utils.h index b7dfa1c..08d7ab6 100644 --- a/src/tpl_utils.h +++ b/src/tpl_utils.h @@ -119,6 +119,7 @@ inline char *tpl_getenv(const char *name) #ifdef LOG_DEFAULT_ENABLE #define TPL_LOG_F(f, x...) tpl_log_f("[TPL_F]", f, ##x) #define TPL_LOG_B(b, f, x...) tpl_log_b("[TPL_" b "]", f, ##x) +#define TPL_LOG_D(t, f, x...) tpl_log_d(t, f, ##x) #define TPL_DEBUG(f, x...) tpl_log_d("[TPL_DEBUG]", f, ##x) #define TPL_LOG_T(b, f, x...) \ { \ @@ -176,16 +177,18 @@ inline char *tpl_getenv(const char *name) } \ } -#define TPL_DEBUG(f, x...) \ +#define TPL_LOG_D(t, f, x...) \ { \ LOG_INIT(); \ if (tpl_log_lvl > 2) \ - tpl_log_d("[TPL_DEBUG]", f, ##x); \ + tpl_log_d(t, f, ##x); \ } + #endif /* LOG_DEFAULT_ENABLE */ #else /* NDEBUG */ #define TPL_LOG_F(f, x...) #define TPL_LOG_B(b, f, x...) +#define TPL_LOG_D(t, f, x...) #define TPL_DEBUG(f, x...) #define TPL_ERR(f, x...) #define TPL_WARN(f, x...) diff --git a/src/tpl_utils_gthread.c b/src/tpl_utils_gthread.c index 68c2faf..4b17598 100644 --- a/src/tpl_utils_gthread.c +++ b/src/tpl_utils_gthread.c @@ -308,7 +308,7 @@ tpl_gsource_create(tpl_gthread *thread, void *data, int fd, g_source_attach(&new_gsource->gsource, g_main_loop_get_context(thread->loop)); - TPL_DEBUG("[GSOURCE_CREATE] tpl_gsource(%p) thread(%p) data(%p) fd(%d) type(%d)", + TPL_LOG_D("[GSOURCE][CREATE]", "tpl_gsource(%p) thread(%p) data(%p) fd(%d) type(%d)", new_gsource, thread, data, new_gsource->fd, type); return new_gsource; @@ -320,7 +320,7 @@ __gsource_remove_and_destroy(tpl_gsource *source) if (g_source_is_destroyed(&source->gsource)) return; - TPL_DEBUG("[GSOURCE_DESTROY] tpl_gsource(%p) type(%d)", + TPL_LOG_D("[GSOURCE][DESTROY]", "tpl_gsource(%p) type(%d)", source, source->type); g_source_remove_unix_fd(&source->gsource, source->tag); @@ -471,7 +471,7 @@ _thread_idle_cb(gpointer data) { tpl_gthread *gthread = (tpl_gthread *)data; - TPL_DEBUG("THREAD IDLE CALLBACK"); + TPL_LOG_D("[WAIT_IDLE]", "THREAD IDLE CALLBACK"); g_mutex_lock(>hread->idle_mutex); gthread->is_idle = TPL_TRUE; @@ -480,9 +480,11 @@ _thread_idle_cb(gpointer data) /* If the caller thread of tpl_gthread_wait_idle locked the pause_mutex, * thread will be paused here until unlock */ + TPL_LOG_D("[THREAD_PAUSE]", "try to lock pause_mutex"); g_mutex_lock(>hread->pause_mutex); gthread->paused = TPL_FALSE; g_mutex_unlock(>hread->pause_mutex); + TPL_LOG_D("[THREAD_RESUME]", "thread resumes"); return G_SOURCE_REMOVE; } @@ -495,7 +497,7 @@ tpl_gthread_wait_idle(tpl_gthread *gthread) gboolean ret = TRUE; tpl_result_t res = TPL_ERROR_NONE; - TPL_DEBUG("[WAIT IDLE] BEGIN"); + TPL_LOG_D("[WAIT_IDLE]", "BEGIN"); g_mutex_lock(>hread->idle_mutex); @@ -532,7 +534,7 @@ tpl_gthread_wait_idle(tpl_gthread *gthread) g_mutex_unlock(>hread->idle_mutex); - TPL_DEBUG("[WAIT IDLE] END"); + TPL_LOG_D("[WAIT_IDLE]", "END"); return res; } diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index b8b24da..38c2f39 100755 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -1068,7 +1068,7 @@ __tpl_wayland_egl_surface_enqueue_buffer(tpl_surface_t *surface, * the buffer is already displayed. */ if (wayland_egl_buffer->is_new) { - TPL_DEBUG("[FRONTBUFFER RENDERING MODE] tbm_surface(%p) bo(%d)", + TPL_LOG_D("[FRONTBUFFER RENDERING MODE]", "tbm_surface(%p) bo(%d)", tbm_surface, tbm_bo_export(wayland_egl_buffer->bo)); } else { TPL_LOG_B("WL_EGL", diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index d305ec0..84e8d08 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -467,7 +467,9 @@ __cb_wl_resistry_global_callback(void *data, struct wl_registry *wl_registry, wl_egl_display->presentation = wl_registry_bind(wl_registry, name, &wp_presentation_interface, 1); - TPL_DEBUG("bind wp_presentation_interface"); + TPL_LOG_D("[REGISTRY_BIND]", + "wl_egl_display(%p) bind wp_presentation_interface", + wl_egl_display); } else if (strcmp(interface, "zwp_linux_explicit_synchronization_v1") == 0) { char *env = tpl_getenv("TPL_EFS"); if (env && !atoi(env)) { @@ -477,7 +479,9 @@ __cb_wl_resistry_global_callback(void *data, struct wl_registry *wl_registry, wl_registry_bind(wl_registry, name, &zwp_linux_explicit_synchronization_v1_interface, 1); wl_egl_display->use_explicit_sync = TPL_TRUE; - TPL_DEBUG("bind zwp_linux_explicit_synchronization_v1_interface"); + TPL_LOG_D("[REGISTRY_BIND]", + "wl_egl_display(%p) bind zwp_linux_explicit_synchronization_v1_interface", + wl_egl_display); } } #endif @@ -829,7 +833,7 @@ __thread_func_disp_finalize(tpl_gsource *gsource) (tpl_wl_egl_display_t *)tpl_gsource_get_data(gsource); tpl_gmutex_lock(&wl_egl_display->disp_mutex); - TPL_DEBUG("[FINALIZE] wl_egl_display(%p) tpl_gsource(%p)", + TPL_LOG_D("[D_FINALIZE]", "wl_egl_display(%p) tpl_gsource(%p)", wl_egl_display, gsource); if (wl_egl_display->wl_initialized) @@ -1216,7 +1220,7 @@ __cb_destroy_callback(void *private) tpl_wl_egl_surface_t *wl_egl_surface = NULL; if (!tizen_private) { - TPL_LOG_B("WL_EGL", "[DESTROY_CB] Already destroyed surface"); + TPL_LOG_D("[WL_EGL_WINDOW_DESTROY_CALLBACK]", "Already destroyed surface"); return; } @@ -1377,7 +1381,7 @@ __cb_create_commit_sync_fd(struct wl_egl_window *wl_egl_window, void *private) commit_sync_fd = dup(wl_egl_surface->commit_sync.fd); TRACE_MARK("[ONLY_DUP] commit_sync_fd(%d) dup(%d)", wl_egl_surface->commit_sync.fd, commit_sync_fd); - TPL_DEBUG("[DUP_COMMIT_SYNC] wl_egl_surface(%p) commit_sync_fd(%d) dup(%d)", + TPL_LOG_D("[COMMIT_SYNC][DUP]", "wl_egl_surface(%p) commit_sync_fd(%d) dup(%d)", wl_egl_surface, wl_egl_surface->commit_sync.fd, commit_sync_fd); tpl_gmutex_unlock(&wl_egl_surface->commit_sync.mutex); return commit_sync_fd; @@ -1395,7 +1399,7 @@ __cb_create_commit_sync_fd(struct wl_egl_window *wl_egl_window, void *private) TRACE_MARK("[CREATE] commit_sync_fd(%d) dup(%d)", wl_egl_surface->commit_sync.fd, commit_sync_fd); - TPL_DEBUG("[CREATE_COMMIT_SYNC] wl_egl_surface(%p) commit_sync_fd(%d)", + TPL_LOG_D("[COMMIT_SYNC][CREATE]", "wl_egl_surface(%p) commit_sync_fd(%d)", wl_egl_surface, commit_sync_fd); tpl_gmutex_unlock(&wl_egl_surface->commit_sync.mutex); @@ -1456,7 +1460,7 @@ __cb_create_presentation_sync_fd(struct wl_egl_window *wl_egl_window, void *priv presentation_sync_fd = dup(wl_egl_surface->presentation_sync.fd); TRACE_MARK("[ONLY_DUP] presentation_sync_fd(%d) dup(%d)", wl_egl_surface->presentation_sync.fd, presentation_sync_fd); - TPL_DEBUG("[DUP_PRESENTATION_SYNC] wl_egl_surface(%p) presentation_sync_fd(%d) dup(%d)", + TPL_LOG_D("[PRESENTATION_SYNC][DUP]", "wl_egl_surface(%p) presentation_sync_fd(%d) dup(%d)", wl_egl_surface, wl_egl_surface->presentation_sync.fd, presentation_sync_fd); tpl_gmutex_unlock(&wl_egl_surface->presentation_sync.mutex); return presentation_sync_fd; @@ -1473,7 +1477,7 @@ __cb_create_presentation_sync_fd(struct wl_egl_window *wl_egl_window, void *priv presentation_sync_fd = dup(wl_egl_surface->presentation_sync.fd); TRACE_MARK("[CREATE] presentation_sync_fd(%d) dup(%d)", wl_egl_surface->presentation_sync.fd, presentation_sync_fd); - TPL_DEBUG("[CREATE_PRESENTATION_SYNC] wl_egl_surface(%p) presentation_sync_fd(%d) dup(%d)", + TPL_LOG_D("[PRESENTATION_SYNC][CREATE]", "wl_egl_surface(%p) presentation_sync_fd(%d) dup(%d)", wl_egl_surface, wl_egl_surface->presentation_sync.fd, presentation_sync_fd); tpl_gmutex_unlock(&wl_egl_surface->presentation_sync.mutex); @@ -1569,9 +1573,9 @@ __cb_tbm_queue_reset_callback(tbm_surface_queue_h tbm_queue, "wl_egl_surface(%p) wl_surface(%p) tbm_queue(%p)", wl_egl_surface, wl_egl_surface->wl_surface, tbm_queue); } else { - TPL_LOG_T("[DEACTIVATED]", - " wl_egl_surface(%p) wl_surface(%p) tbm_queue(%p)", - wl_egl_surface, wl_egl_surface->wl_surface, tbm_queue); + TPL_INFO("[DEACTIVATED]", + " wl_egl_surface(%p) wl_surface(%p) tbm_queue(%p)", + wl_egl_surface, wl_egl_surface->wl_surface, tbm_queue); } } @@ -1691,13 +1695,13 @@ __thread_func_surf_dispatch(tpl_gsource *gsource, uint64_t message) tpl_gmutex_lock(&wl_egl_surface->surf_mutex); if (message == INIT_SURFACE) { /* Initialize surface */ - TPL_DEBUG("wl_egl_surface(%p) initialize message received!", + TPL_LOG_D("[MSG_RECEIVED]", "wl_egl_surface(%p) initialize message received!", wl_egl_surface); _thread_wl_egl_surface_init(wl_egl_surface); wl_egl_surface->initialized_in_thread = TPL_TRUE; tpl_gcond_signal(&wl_egl_surface->surf_cond); } else if (message == ACQUIRABLE) { /* Acquirable */ - TPL_DEBUG("wl_egl_surface(%p) acquirable message received!", + TPL_LOG_D("[MSG_RECEIVED]", "wl_egl_surface(%p) acquirable message received!", wl_egl_surface); _thread_surface_queue_acquire(wl_egl_surface); } @@ -1718,7 +1722,7 @@ __thread_func_surf_finalize(tpl_gsource *gsource) TPL_CHECK_ON_NULL_RETURN(wl_egl_surface); tpl_gmutex_lock(&wl_egl_surface->surf_mutex); - TPL_DEBUG("[FINALIZE] wl_egl_surface(%p) tpl_gsource(%p)", + TPL_LOG_D("[S_FINALIZE]", "wl_egl_surface(%p) tpl_gsource(%p)", wl_egl_surface, gsource); _thread_wl_egl_surface_fini(wl_egl_surface); @@ -2037,12 +2041,13 @@ _thread_wl_egl_surface_init(tpl_wl_egl_surface_t *wl_egl_surface) return; } - TPL_INFO("[QUEUE_CREATION]", + TPL_INFO("[QUEUE_CREATION][1/2]", "wl_egl_surface(%p) wl_surface(%p) wl_tbm_client(%p)", wl_egl_surface, wl_egl_surface->wl_surface, wl_egl_display->wl_tbm_client); - TPL_INFO("[QUEUE_CREATION]", - "tbm_queue(%p) size(%d x %d) X %d format(%d)", + TPL_INFO("[QUEUE_CREATION][2/2]", + "wl_egl_surface(%p) tbm_queue(%p) size(%d x %d) X %d format(%d)", + wl_egl_surface, wl_egl_surface->tbm_queue, wl_egl_surface->width, wl_egl_surface->height, @@ -2125,8 +2130,6 @@ _tpl_wl_egl_surface_buffer_clear(tpl_wl_egl_surface_t *wl_egl_surface) tpl_gthread_pause_in_idle(wl_egl_display->thread); buffer_cnt = __tpl_list_get_count(wl_egl_surface->buffers); - TPL_INFO("[BUFFER_CLEAR]", "BEGIN | wl_egl_surface(%p) buffer_cnt(%d)", - wl_egl_surface, buffer_cnt); while (!__tpl_list_is_empty(wl_egl_surface->buffers)) { wl_egl_buffer = (tpl_wl_egl_buffer_t *)__tpl_list_pop_front(wl_egl_surface->buffers, @@ -2136,8 +2139,9 @@ _tpl_wl_egl_surface_buffer_clear(tpl_wl_egl_surface_t *wl_egl_surface) status = wl_egl_buffer->status; - TPL_INFO("[BUFFER]","[%d/%d]| wl_egl_buffer(%p) tbm_surface(%p) status(%s)", - ++idx, buffer_cnt, wl_egl_buffer, + TPL_INFO("[BUFFER_CLEAR]", + "[%d/%d] wl_egl_surface(%p) wl_egl_buffer(%p) tbm_surface(%p) status(%s)", + ++idx, buffer_cnt, wl_egl_surface, wl_egl_buffer, wl_egl_buffer->tbm_surface, status_to_string[status]); @@ -2191,7 +2195,6 @@ _tpl_wl_egl_surface_buffer_clear(tpl_wl_egl_surface_t *wl_egl_surface) if (need_to_release || need_to_cancel) tbm_surface_internal_unref(wl_egl_buffer->tbm_surface); } - TPL_INFO("[BUFFER_CLEAR]", "END | wl_egl_surface(%p)", wl_egl_surface); tpl_gthread_continue(wl_egl_display->thread); } @@ -2561,8 +2564,8 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, enqueued_buffer->status < COMMITTED) { tpl_result_t wait_result; TPL_INFO("[DEQ_AFTER_RESET]", - "waiting for previous wl_egl_buffer(%p) commit", - enqueued_buffer); + "wl_egl_surface(%p) waiting for previous wl_egl_buffer(%p) commit", + wl_egl_surface, enqueued_buffer); wait_result = tpl_gcond_timed_wait(&enqueued_buffer->cond, &enqueued_buffer->mutex, @@ -2652,7 +2655,7 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, surface->frontbuffer = NULL; wl_egl_surface->need_to_enqueue = TPL_TRUE; wl_egl_surface->frontbuffer_activated = TPL_FALSE; - TPL_INFO("[FRONTBUFFER RENDERING STOP]", + TPL_INFO("[FRONTBUFFER_RENDERING_STOP]", "wl_egl_surface(%p) wl_egl_window(%p)", wl_egl_surface, wl_egl_surface->wl_egl_window); } else { @@ -2693,7 +2696,7 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, #if TIZEN_FEATURE_ENABLE if (wl_egl_display->use_explicit_sync) { *release_fence = wl_egl_buffer->release_fence_fd; - TPL_DEBUG("wl_egl_surface(%p) wl_egl_buffer(%p) release_fence_fd(%d)", + TPL_LOG_D("[EXPLICIT_FENCE]", "wl_egl_surface(%p) wl_egl_buffer(%p) release_fence_fd(%d)", wl_egl_surface, wl_egl_buffer, *release_fence); wl_egl_buffer->release_fence_fd = -1; @@ -2706,7 +2709,7 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, if (surface->is_frontbuffer_mode && wl_egl_surface->is_activated) { if (surface->frontbuffer == NULL) { - TPL_INFO("[FRONTBUFFER RENDERING START]", + TPL_INFO("[FRONTBUFFER_RENDERING_START]", "wl_egl_surface(%p) wl_egl_window(%p) bo(%d)", wl_egl_surface, wl_egl_surface->wl_egl_window, _get_tbm_surface_bo_name(tbm_surface)); @@ -2914,14 +2917,14 @@ __thread_func_waiting_source_dispatch(tpl_gsource *gsource, uint64_t message) TRACE_ASYNC_END(wl_egl_buffer->acquire_fence_fd, "FENCE WAIT fd(%d)", wl_egl_buffer->acquire_fence_fd); - TPL_DEBUG("[RENDER DONE] wl_egl_buffer(%p) tbm_surface(%p)", - wl_egl_buffer, tbm_surface); + TPL_LOG_D("[RENDER DONE]", "wl_egl_surface(%p) wl_egl_buffer(%p) tbm_surface(%p)", + wl_egl_surface, wl_egl_buffer, tbm_surface); 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, + TPL_LOG_D("[FINALIZE]", "wl_egl_surface(%p) wl_egl_buffer(%p) wait_source(%p) fence_fd(%d)", + wl_egl_surface, wl_egl_buffer, wl_egl_buffer->waiting_source, wl_egl_buffer->acquire_fence_fd); close(wl_egl_buffer->acquire_fence_fd); @@ -3049,7 +3052,7 @@ __cb_tdm_client_vblank(tdm_client_vblank *vblank, tdm_error error, tpl_wl_egl_buffer_t *wl_egl_buffer = NULL; TRACE_ASYNC_END((intptr_t)wl_egl_surface, "WAIT_VBLANK"); - TPL_DEBUG("[VBLANK] wl_egl_surface(%p)", wl_egl_surface); + TPL_LOG_D("[VBLANK_DONE]", "wl_egl_surface(%p)", wl_egl_surface); if (error == TDM_ERROR_TIMEOUT) TPL_WARN("[TDM_ERROR_TIMEOUT] It will keep going. wl_egl_surface(%p)", @@ -3274,7 +3277,7 @@ __cb_presentation_feedback_presented(void *data, tpl_gmutex_lock(&wl_egl_surface->presentation_sync.mutex); - TPL_DEBUG("[FEEDBACK][PRESENTED] pst_feedback(%p) presentation_feedback(%p) bo(%d)", + TPL_LOG_D("[PRESENTED]", "pst_feedback(%p) presentation_feedback(%p) bo(%d)", pst_feedback, presentation_feedback, pst_feedback->bo_name); if (pst_feedback->pst_sync_fd != -1) { @@ -3315,7 +3318,7 @@ __cb_presentation_feedback_discarded(void *data, tpl_gmutex_lock(&wl_egl_surface->presentation_sync.mutex); - TPL_DEBUG("[FEEDBACK][DISCARDED] pst_feedback(%p) presentation_feedback(%p) bo(%d)", + TPL_LOG_D("[DISCARDED]", "pst_feedback(%p) presentation_feedback(%p) bo(%d)", pst_feedback, presentation_feedback, pst_feedback->bo_name); if (pst_feedback->pst_sync_fd != -1) { @@ -3398,8 +3401,8 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, "[FATAL] Failed to create wl_buffer"); TPL_INFO("[WL_BUFFER_CREATE]", - "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", - wl_egl_buffer, wl_egl_buffer->wl_buffer, + "wl_egl_surface(%p) wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", + wl_egl_surface, wl_egl_buffer, wl_egl_buffer->wl_buffer, wl_egl_buffer->tbm_surface); #if TIZEN_FEATURE_ENABLE @@ -3523,7 +3526,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, zwp_linux_surface_synchronization_v1_set_acquire_fence(wl_egl_surface->surface_sync, wl_egl_buffer->acquire_fence_fd); - TPL_DEBUG("[SET_ACQUIRE_FENCE] wl_egl_surface(%p) tbm_surface(%p) acquire_fence(%d)", + TPL_LOG_D("[SET_ACQUIRE_FENCE][1/2]", "wl_egl_surface(%p) tbm_surface(%p) acquire_fence(%d)", wl_egl_surface, wl_egl_buffer->tbm_surface, wl_egl_buffer->acquire_fence_fd); close(wl_egl_buffer->acquire_fence_fd); wl_egl_buffer->acquire_fence_fd = -1; @@ -3535,7 +3538,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, } else { zwp_linux_buffer_release_v1_add_listener( wl_egl_buffer->buffer_release, &zwp_release_listner, wl_egl_buffer); - TPL_DEBUG("add explicit_sync_release_listener."); + TPL_LOG_D("[SET_ACQUIRE_FENCE][2/2]", "add explicit_sync_release_listener."); } } #endif @@ -3577,7 +3580,7 @@ _thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface, TRACE_ASYNC_END(wl_egl_buffer->commit_sync_fd, "[COMMIT_SYNC] bo(%d)", wl_egl_buffer->bo_name); - TPL_DEBUG("[COMMIT_SYNC][SEND] wl_egl_surface(%p) commit_sync_fd(%d)", + TPL_LOG_D("[COMMIT_SYNC][SEND]", "wl_egl_surface(%p) commit_sync_fd(%d)", wl_egl_surface, wl_egl_buffer->commit_sync_fd); close(wl_egl_buffer->commit_sync_fd); @@ -3656,8 +3659,8 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer) tpl_wl_egl_surface_t *wl_egl_surface = wl_egl_buffer->wl_egl_surface; tpl_wl_egl_display_t *wl_egl_display = wl_egl_surface->wl_egl_display; - TPL_INFO("[BUFFER_FREE]", "wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p)", - wl_egl_buffer, wl_egl_buffer->wl_buffer, wl_egl_buffer->tbm_surface); + TPL_INFO("[BUFFER_FREE]", "wl_egl_surface(%p) wl_egl_buffer(%p) tbm_surface(%p) bo(%d)", + wl_egl_surface, wl_egl_buffer, wl_egl_buffer->tbm_surface, wl_egl_buffer->bo_name); tpl_gmutex_lock(&wl_egl_surface->buffers_mutex); if (wl_egl_surface->buffers) { @@ -3752,17 +3755,15 @@ _print_buffer_lists(tpl_wl_egl_surface_t *wl_egl_surface) tpl_gmutex_lock(&wl_egl_surface->buffers_mutex); buffer_cnt = __tpl_list_get_count(wl_egl_surface->buffers); - TPL_INFO("[BUFFERS_INFO]", "wl_egl_surface(%p) buffer_cnt(%d)", - wl_egl_surface, buffer_cnt); node = __tpl_list_get_front_node(wl_egl_surface->buffers); do { if (!node) break; wl_egl_buffer = (tpl_wl_egl_buffer_t *)__tpl_list_node_get_data(node); - TPL_INFO("[INFO]", - "[%d/%d] | wl_egl_buffer(%p) tbm_surface(%p) bo(%d) | status(%s)", - ++idx, buffer_cnt, wl_egl_buffer, wl_egl_buffer->tbm_surface, - wl_egl_buffer->bo_name, + TPL_INFO("[BUFFERS_INFO]", + "[%d/%d] wl_egl_surface(%p), wl_egl_buffer(%p) tbm_surface(%p) bo(%d) | status(%s)", + ++idx, buffer_cnt, wl_egl_surface, wl_egl_buffer, + wl_egl_buffer->tbm_surface, wl_egl_buffer->bo_name, status_to_string[wl_egl_buffer->status]); } while ((node = __tpl_list_node_next(node))); tpl_gmutex_unlock(&wl_egl_surface->buffers_mutex); diff --git a/src/tpl_wl_vk_thread.c b/src/tpl_wl_vk_thread.c index 317d005..a339349 100644 --- a/src/tpl_wl_vk_thread.c +++ b/src/tpl_wl_vk_thread.c @@ -372,7 +372,9 @@ __cb_wl_resistry_global_callback(void *data, struct wl_registry *wl_registry, wl_registry_bind(wl_registry, name, &zwp_linux_explicit_synchronization_v1_interface, 1); wl_vk_display->use_explicit_sync = TPL_TRUE; - TPL_DEBUG("bind zwp_linux_explicit_synchronization_v1_interface"); + TPL_LOG_D("[REGISTRY_BIND]", + "wl_vk_display(%p) bind zwp_linux_explicit_synchronization_v1_interface", + wl_vk_display); } } #endif @@ -693,7 +695,7 @@ __thread_func_disp_finalize(tpl_gsource *gsource) (tpl_wl_vk_display_t *)tpl_gsource_get_data(gsource); tpl_gmutex_lock(&wl_vk_display->disp_mutex); - TPL_DEBUG("[FINALIZE] wl_vk_display(%p) tpl_gsource(%p)", + TPL_LOG_D("[D_FINALIZE]", "wl_vk_display(%p) tpl_gsource(%p)", wl_vk_display, gsource); if (wl_vk_display->wl_initialized) @@ -1029,10 +1031,11 @@ _tpl_wl_vk_surface_buffer_clear(tpl_wl_vk_surface_t *wl_vk_surface) status = wl_vk_buffer->status; - TPL_DEBUG("[idx:%d] wl_vk_buffer(%p) tbm_surface(%p) status(%s)", - idx, wl_vk_buffer, - wl_vk_buffer->tbm_surface, - status_to_string[status]); + TPL_INFO("[BUFFER_CLEAR]", + "[%d] wl_vk_surface(%p) wl_vk_buffer(%p) tbm_surface(%p) status(%s)", + idx, wl_vk_surface, wl_vk_buffer, + wl_vk_buffer->tbm_surface, + status_to_string[status]); if (status >= ENQUEUED) { tpl_bool_t need_to_wait = TPL_FALSE; @@ -1211,13 +1214,13 @@ __thread_func_surf_dispatch(tpl_gsource *gsource, uint64_t message) tpl_gmutex_lock(&wl_vk_surface->surf_mutex); if (message == INIT_SURFACE) { /* Initialize surface */ - TPL_DEBUG("wl_vk_surface(%p) initialize message received!", + TPL_LOG_D("[MSG_RECEIVED]", "wl_vk_surface(%p) initialize message received!", wl_vk_surface); _thread_wl_vk_surface_init(wl_vk_surface); wl_vk_surface->initialized_in_thread = TPL_TRUE; tpl_gcond_signal(&wl_vk_surface->surf_cond); } else if (message == CREATE_QUEUE) { /* Create tbm_surface_queue */ - TPL_DEBUG("wl_vk_surface(%p) queue creation message received!", + TPL_LOG_D("[MSG_RECEIVED]", "wl_vk_surface(%p) queue creation message received!", wl_vk_surface); if (_thread_swapchain_create_tbm_queue(wl_vk_surface) != TPL_ERROR_NONE) { @@ -1226,12 +1229,12 @@ __thread_func_surf_dispatch(tpl_gsource *gsource, uint64_t message) } tpl_gcond_signal(&wl_vk_surface->surf_cond); } else if (message == DESTROY_QUEUE) { /* swapchain destroy */ - TPL_DEBUG("wl_vk_surface(%p) swapchain destroy message received!", + TPL_LOG_D("[MSG_RECEIVED]", "wl_vk_surface(%p) swapchain destroy message received!", wl_vk_surface); _thread_swapchain_destroy_tbm_queue(wl_vk_surface); tpl_gcond_signal(&wl_vk_surface->surf_cond); } else if (message == ACQUIRABLE) { /* Acquirable message */ - TPL_DEBUG("wl_vk_surface(%p) acquirable message received!", + TPL_LOG_D("[MSG_RECEIVED]", "wl_vk_surface(%p) acquirable message received!", wl_vk_surface); if (_thread_surface_queue_acquire(wl_vk_surface) != TPL_ERROR_NONE) { @@ -1257,7 +1260,7 @@ __thread_func_surf_finalize(tpl_gsource *gsource) TPL_CHECK_ON_NULL_RETURN(wl_vk_surface); tpl_gmutex_lock(&wl_vk_surface->surf_mutex); - TPL_DEBUG("[FINALIZE] wl_vk_surface(%p) tpl_gsource(%p)", + TPL_LOG_D("[S_FINALIZE]", "wl_vk_surface(%p) tpl_gsource(%p)", wl_vk_surface, gsource); _thread_wl_vk_surface_fini(wl_vk_surface); @@ -1498,9 +1501,9 @@ __cb_tbm_queue_reset_callback(tbm_surface_queue_h tbm_queue, "wl_vk_surface(%p) wl_surface(%p) tbm_queue(%p)", wl_vk_surface, wl_vk_surface->wl_surface, tbm_queue); } else { - TPL_LOG_T("[DEACTIVATED]", - " wl_vk_surface(%p) wl_surface(%p) tbm_queue(%p)", - wl_vk_surface, wl_vk_surface->wl_surface, tbm_queue); + TPL_INFO("[DEACTIVATED]", + " wl_vk_surface(%p) wl_surface(%p) tbm_queue(%p)", + wl_vk_surface, wl_vk_surface->wl_surface, tbm_queue); } } @@ -1573,7 +1576,9 @@ _thread_swapchain_create_tbm_queue(tpl_wl_vk_surface_t *wl_vk_surface) int i; for (i = 0; i < swapchain->properties.buffer_count; i++) { if (swapchain->swapchain_buffers[i]) { - TPL_DEBUG("unref tbm_surface(%p)", swapchain->swapchain_buffers[i]); + TPL_INFO("[UNTRACK_BUFFERS]", "[%d] wl_vk_surface(%p) sc(%p) tbm_surface(%p) bo(%d)", + i, wl_vk_surface, swapchain, swapchain->swapchain_buffers[i], + _get_tbm_surface_bo_name(swapchain->swapchain_buffers[i])); tbm_surface_internal_unref(swapchain->swapchain_buffers[i]); swapchain->swapchain_buffers[i] = NULL; } @@ -1678,7 +1683,7 @@ _thread_swapchain_create_tbm_queue(tpl_wl_vk_surface_t *wl_vk_surface) swapchain->create_done = TPL_TRUE; TPL_INFO("[TBM_QUEUE_CREATED]", - "wl_vk_surface(%p) wl_vk_swapchain(%p) tbm_queue(%p)", + "wl_vk_surface(%p) swapchain(%p) tbm_queue(%p)", wl_vk_surface, swapchain, tbm_queue); return TPL_ERROR_NONE; @@ -1805,8 +1810,9 @@ __tpl_wl_vk_surface_destroy_swapchain(tpl_surface_t *surface) if (swapchain->swapchain_buffers) { for (int i = 0; i < swapchain->properties.buffer_count; i++) { if (swapchain->swapchain_buffers[i]) { - TPL_DEBUG("Stop tracking tbm_surface(%p)", - swapchain->swapchain_buffers[i]); + TPL_INFO("[UNTRACK_BUFFERS]", "[%d] wl_vk_surface(%p) sc(%p) tbm_surface(%p) bo(%d)", + i, wl_vk_surface, swapchain, swapchain->swapchain_buffers[i], + _get_tbm_surface_bo_name(swapchain->swapchain_buffers[i])); tbm_surface_internal_unref(swapchain->swapchain_buffers[i]); swapchain->swapchain_buffers[i] = NULL; } @@ -1888,8 +1894,8 @@ __tpl_wl_vk_surface_get_swapchain_buffers(tpl_surface_t *surface, for (i = 0; i < *buffer_count; i++) { if (swapchain->swapchain_buffers[i]) { - TPL_DEBUG("swapchain_buffers[%d] = tbm_surface(%p) bo(%d)", - i, swapchain->swapchain_buffers[i], + TPL_INFO("[TRACK_BUFFERS]", "[%d] wl_vk_surface(%p) sc(%p) tbm_surface(%p) bo(%d)", + i, wl_vk_surface, swapchain, swapchain->swapchain_buffers[i], _get_tbm_surface_bo_name(swapchain->swapchain_buffers[i])); tbm_surface_internal_ref(swapchain->swapchain_buffers[i]); } @@ -2121,7 +2127,7 @@ __tpl_wl_vk_surface_dequeue_buffer(tpl_surface_t *surface, #if TIZEN_FEATURE_ENABLE if (wl_vk_surface->surface_sync) { *release_fence = wl_vk_buffer->release_fence_fd; - TPL_DEBUG("wl_vk_surface(%p) wl_vk_buffer(%p) release_fence_fd(%d)", + TPL_LOG_D("[EXPLICIT_FENCE]", "wl_vk_surface(%p) wl_vk_buffer(%p) release_fence_fd(%d)", wl_vk_surface, wl_vk_buffer, *release_fence); wl_vk_buffer->release_fence_fd = -1; } else @@ -2528,7 +2534,7 @@ __cb_tdm_client_vblank(tdm_client_vblank *vblank, tdm_error error, tpl_wl_vk_buffer_t *wl_vk_buffer = NULL; TRACE_ASYNC_END((intptr_t)wl_vk_surface, "WAIT_VBLANK"); - TPL_DEBUG("[VBLANK] wl_vk_surface(%p)", wl_vk_surface); + TPL_LOG_D("[VBLANK_DONE]", "wl_vk_surface(%p)", wl_vk_surface); if (error == TDM_ERROR_TIMEOUT) TPL_WARN("[TDM_ERROR_TIMEOUT] It will keep going. wl_vk_surface(%p)", @@ -2646,7 +2652,7 @@ _thread_wl_surface_commit(tpl_wl_vk_surface_t *wl_vk_surface, zwp_linux_surface_synchronization_v1_set_acquire_fence(wl_vk_surface->surface_sync, wl_vk_buffer->acquire_fence_fd); - TPL_DEBUG("[SET_ACQUIRE_FENCE] wl_vk_surface(%p) tbm_surface(%p) acquire_fence(%d)", + TPL_LOG_D("[SET_ACQUIRE_FENCE][1/2]", "wl_vk_surface(%p) tbm_surface(%p) acquire_fence(%d)", wl_vk_surface, wl_vk_buffer->tbm_surface, wl_vk_buffer->acquire_fence_fd); close(wl_vk_buffer->acquire_fence_fd); wl_vk_buffer->acquire_fence_fd = -1; @@ -2658,7 +2664,7 @@ _thread_wl_surface_commit(tpl_wl_vk_surface_t *wl_vk_surface, } else { zwp_linux_buffer_release_v1_add_listener( wl_vk_buffer->buffer_release, &zwp_release_listner, wl_vk_buffer); - TPL_DEBUG("add explicit_sync_release_listener."); + TPL_LOG_D("[SET_ACQUIRE_FENCE][2/2]", "add explicit_sync_release_listener."); } } #endif -- 2.7.4