Fix some order of printing logs. 96/254996/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 11 Mar 2021 06:30:21 +0000 (15:30 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Thu, 11 Mar 2021 06:49:00 +0000 (15:49 +0900)
Change-Id: Ie0830c48474305fc61f12f571bd5911109e17cd3
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_surface.c
src/tpl_wl_egl_thread.c

index b41534b..e05009e 100755 (executable)
@@ -13,9 +13,10 @@ static void
 __tpl_surface_free(void *data)
 {
        TPL_ASSERT(data);
-       TPL_LOG_F("tpl_surface_t(%p)", data);
 
        __tpl_surface_fini((tpl_surface_t *) data);
+
+       TPL_LOG_F("tpl_surface_t(%p) free", data);
        free(data);
 }
 
index da85a82..fdc70d6 100755 (executable)
@@ -1846,10 +1846,6 @@ _tpl_wl_egl_surface_buffer_clear(tpl_wl_egl_surface_t *wl_egl_surface)
                wl_egl_buffer = wl_egl_surface->buffers[idx];
 
                if (wl_egl_buffer) {
-                       TPL_DEBUG("[idx:%d] wl_egl_buffer(%p) tbm_surface(%p) status(%s)",
-                                         idx, wl_egl_buffer,
-                                         wl_egl_buffer->tbm_surface,
-                                         status_to_string[wl_egl_buffer->status]);
                        wl_egl_surface->buffers[idx] = NULL;
                        wl_egl_surface->buffer_cnt--;
                } else {
@@ -1863,6 +1859,11 @@ _tpl_wl_egl_surface_buffer_clear(tpl_wl_egl_surface_t *wl_egl_surface)
 
                tpl_gmutex_lock(&wl_egl_buffer->mutex);
 
+               TPL_DEBUG("[idx:%d] wl_egl_buffer(%p) tbm_surface(%p) status(%s)",
+                                 idx, wl_egl_buffer,
+                                 wl_egl_buffer->tbm_surface,
+                                 status_to_string[wl_egl_buffer->status]);
+
                /* ACQUIRED, WAITING_SIGNALED, WAITING_VBLANK, COMMITTED */
                /* It has been acquired but has not yet been released, so this
                 * buffer must be released. */
@@ -2422,11 +2423,8 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface,
 
        TRACE_MARK("[ENQ] BO_NAME:%d", bo_name);
 
-       TPL_LOG_T("WL_EGL",
-                         "[ENQ] wl_egl_surface(%p) tbm_surface(%p) bo(%d) fence(%d)",
-                         wl_egl_surface, tbm_surface, bo_name, acquire_fence);
-
        wl_egl_buffer = _get_wl_egl_buffer(tbm_surface);
+
        tpl_gmutex_lock(&wl_egl_buffer->mutex);
 
        /* If there are received region information, save it to wl_egl_buffer */
@@ -2480,7 +2478,6 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface,
                close(wl_egl_buffer->acquire_fence_fd);
 
        wl_egl_buffer->acquire_fence_fd = acquire_fence;
-       wl_egl_buffer->status = ENQUEUED;
 
        tpl_gmutex_lock(&wl_egl_surface->presentation_sync.mutex);
        if (wl_egl_surface->presentation_sync.fd != -1) {
@@ -2498,6 +2495,11 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface,
        }
        tpl_gmutex_unlock(&wl_egl_surface->commit_sync.mutex);
 
+       wl_egl_buffer->status = ENQUEUED;
+       TPL_LOG_T("WL_EGL",
+                         "[ENQ] wl_egl_buffer(%p) tbm_surface(%p) bo(%d) fence(%d)",
+                         wl_egl_buffer, tbm_surface, bo_name, acquire_fence);
+
        tpl_gmutex_unlock(&wl_egl_buffer->mutex);
 
        tsq_err = tbm_surface_queue_enqueue(wl_egl_surface->tbm_queue,
@@ -2602,6 +2604,10 @@ _thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface)
 
                wl_egl_buffer->status = ACQUIRED;
 
+               TPL_LOG_T("WL_EGL", "[ACQ] wl_egl_buffer(%p) tbm_surface(%p) bo(%d)",
+                                 wl_egl_buffer, tbm_surface,
+                                 _get_tbm_surface_bo_name(tbm_surface));
+
                if (wl_egl_buffer->wl_buffer == NULL) {
                        tpl_wl_egl_display_t *wl_egl_display = wl_egl_surface->wl_egl_display;
                        wl_egl_buffer->wl_buffer =
@@ -3240,6 +3246,11 @@ __cb_wl_egl_buffer_free(tpl_wl_egl_buffer_t *wl_egl_buffer)
                wayland_tbm_client_destroy_buffer(wl_egl_display->wl_tbm_client,
                                                                                  (void *)wl_egl_buffer->wl_buffer);
 
+       if (wl_egl_buffer->waiting_source) {
+               tpl_gsource_destroy(wl_egl_buffer->waiting_source, TPL_FALSE);
+               wl_egl_buffer->waiting_source = NULL;
+       }
+
        if (wl_egl_buffer->commit_sync_fd != -1) {
                int ret = _write_to_eventfd(wl_egl_buffer->commit_sync_fd);
                if (ret == -1)