tpl_wayland_egl_thread: Modified backend name for printing debug logs. 79/161979/3
authorjoonbum.ko <joonbum.ko@samsung.com>
Tue, 28 Nov 2017 10:14:03 +0000 (19:14 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Tue, 28 Nov 2017 11:18:07 +0000 (20:18 +0900)
 - It will be optimized.

Change-Id: Iae60aa3a4e7d7f0b55c332b69a92d9e26c8ce69b
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
.vscode/settings.json [new file with mode: 0644]
src/tpl_wayland_egl_thread.c

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644 (file)
index 0000000..d10fd7e
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "files.associations": {
+        "tpl_utils.h": "c"
+    }
+}
\ No newline at end of file
index 2e345ab..d3116fd 100644 (file)
@@ -23,6 +23,9 @@ static int buffer_info_key;
 #define CLIENT_QUEUE_SIZE 3
 #define VK_CLIENT_QUEUE_SIZE 3
 
+/* backend name will be optimized */
+#define BACKEND "WL_VK_GL"
+
 typedef struct _twe_wl_disp_source             twe_wl_disp_source;
 typedef struct _twe_wl_surf_source             twe_wl_surf_source;
 typedef struct _twe_wl_buffer_info             twe_wl_buffer_info;
@@ -227,7 +230,7 @@ _twe_thread_del_source_finalize(GSource *source)
 {
        twe_del_source *del_source = (twe_del_source *)source;
 
-       TPL_LOG_T("WL_EGL", "gsource(%p) event_fd(%d)",
+       TPL_LOG_T(BACKEND, "gsource(%p) event_fd(%d)",
                          source, del_source->event_fd);
 
        close(del_source->event_fd);
@@ -342,7 +345,7 @@ _twe_thread_tdm_source_finalize(GSource *source)
 {
        twe_tdm_source *tdm_source = (twe_tdm_source *)source;
 
-       TPL_LOG_T("WL_EGL", "tdm_destroy| tdm_source(%p) tdm_client(%p)",
+       TPL_LOG_T(BACKEND, "tdm_destroy| tdm_source(%p) tdm_client(%p)",
                          tdm_source, tdm_source->tdm_client);
 
        if (tdm_source->tdm_client) {
@@ -395,8 +398,8 @@ _twe_thread_tdm_source_create(void)
                                                                                   tdm_fd,
                                                                                   G_IO_IN);
 
-       TPL_LOG_T("WL_EGL", "TPL_WAIT_VBLANK:DEFAULT_ENABLED");
-       TPL_LOG_T("WL_EGL", "tdm_source(%p) tdm_client(%p) tdm_fd(%d)",
+       TPL_LOG_T(BACKEND, "TPL_WAIT_VBLANK:DEFAULT_ENABLED");
+       TPL_LOG_T(BACKEND, "tdm_source(%p) tdm_client(%p) tdm_fd(%d)",
                          tdm_source, client, tdm_fd);
 
        return tdm_source;
@@ -474,7 +477,7 @@ twe_thread_create(void)
        thread->ctx = _twe_ctx;
        _twe_ctx->ref_cnt++;
 
-       TPL_LOG_T("WL_EGL", "_twe_ctx(%p) twe_thread(%p)", _twe_ctx, thread);
+       TPL_LOG_T(BACKEND, "_twe_ctx(%p) twe_thread(%p)", _twe_ctx, thread);
        return thread;
 }
 
@@ -511,7 +514,7 @@ twe_thread_destroy(twe_thread* thread)
                _twe_ctx = NULL;
        }
 
-       TPL_LOG_T("WL_EGL", "[THREAD DESTROY] twe_thread(%p)", thread);
+       TPL_LOG_T(BACKEND, "[THREAD DESTROY] twe_thread(%p)", thread);
 
        thread->ctx = NULL;
        free(thread);
@@ -621,7 +624,7 @@ _twe_thread_wl_disp_finalize(GSource *source)
 {
        twe_wl_disp_source *disp_source = (twe_wl_disp_source *)source;
 
-       TPL_LOG_T("WL_EGL", "finalize| disp_source(%p)", disp_source);
+       TPL_LOG_T(BACKEND, "finalize| disp_source(%p)", disp_source);
 
        __tpl_object_fini(&disp_source->obj);
 
@@ -657,7 +660,7 @@ _twe_display_init_wl_tbm_client(struct wl_display *display,
 
        wl_proxy_set_queue(wl_tbm, ev_queue);
 
-       TPL_LOG_T("WL_EGL", "wl_tbm_client init| wl_tbm_client(%p)", wl_tbm_client);
+       TPL_LOG_T(BACKEND, "wl_tbm_client init| wl_tbm_client(%p)", wl_tbm_client);
        return wl_tbm_client;
 }
 
@@ -671,7 +674,7 @@ _twe_display_fini_wl_tbm_client(struct wayland_tbm_client *wl_tbm_client)
                wl_proxy_set_queue(wl_tbm, NULL);
        }
 
-       TPL_LOG_T("WL_EGL", "wl_tbm_client deinit| wl_tbm_client(%p)", wl_tbm_client);
+       TPL_LOG_T(BACKEND, "wl_tbm_client deinit| wl_tbm_client(%p)", wl_tbm_client);
        wayland_tbm_client_deinit(wl_tbm_client);
 }
 
@@ -795,7 +798,7 @@ _twe_display_shm_init(twe_wl_disp_source *disp_source)
                wl_proxy_set_queue((struct wl_proxy *)disp_source->tss,
                                                   NULL);
 
-       TPL_LOG_T("WL_EGL", "tizen_surface_shm(%p) init.", disp_source->tss);
+       TPL_LOG_T(BACKEND, "tizen_surface_shm(%p) init.", disp_source->tss);
 
 fini:
        if (queue)
@@ -810,7 +813,7 @@ static void
 _twe_display_shm_fini(twe_wl_disp_source *disp_source)
 {
        if (disp_source->tss) {
-               TPL_LOG_T("WL_EGL", "tizen_surface_shm(%p) fini.", disp_source->tss);
+               TPL_LOG_T(BACKEND, "tizen_surface_shm(%p) fini.", disp_source->tss);
                tizen_surface_shm_destroy(disp_source->tss);
                disp_source->tss = NULL;
        }
@@ -870,7 +873,7 @@ static void
 _twe_display_vk_fini(twe_wl_disp_source *disp_source)
 {
        if (disp_source->wl_vk_client) {
-               TPL_LOG_T("WL_VK", "wl_vk_client(%p) fini.", disp_source->wl_vk_client);
+               TPL_LOG_T(BACKEND, "wl_vk_client(%p) fini.", disp_source->wl_vk_client);
                wayland_vulkan_destroy(disp_source->wl_vk_client);
        }
 }
@@ -901,7 +904,7 @@ _twe_thread_wl_disp_source_destroy(void *source)
        wl_event_queue_destroy(disp_source->ev_queue);
        TPL_OBJECT_UNLOCK(&disp_source->obj);
 
-       TPL_LOG_T("WL_EGL", "[DEL] twe_display(%p) wl_display(%p)",
+       TPL_LOG_T(BACKEND, "[DEL] twe_display(%p) wl_display(%p)",
                          disp_source, disp_source->disp);
 
        g_source_remove_poll(&disp_source->gsource, &disp_source->gfd);
@@ -975,7 +978,7 @@ twe_display_add(twe_thread* thread,
        g_source_add_poll(&source->gsource, &source->gfd);
        g_source_attach(&source->gsource, g_main_loop_get_context(ctx->twe_loop));
 
-       TPL_LOG_T("WL_EGL", "add| gsource(%p) ev_queue(%p) wl_display(%p)",
+       TPL_LOG_T(BACKEND, "add| gsource(%p) ev_queue(%p) wl_display(%p)",
                          source, source->ev_queue, display);
 
        return (twe_display_h)source;
@@ -1084,7 +1087,7 @@ __cb_destroy_callback(void *private)
        twe_wl_surf_source *surf_source = (twe_wl_surf_source *)private;
 
        if (surf_source) {
-               TPL_LOG_T("WL_EGL", "[DESTROY_CB] wl_egl_window(%p) surf_source(%p)",
+               TPL_LOG_T(BACKEND, "[DESTROY_CB] wl_egl_window(%p) surf_source(%p)",
                                  surf_source->wl_egl_window, surf_source);
                TPL_OBJECT_LOCK(&surf_source->obj);
                surf_source->wl_egl_window->private = NULL;
@@ -1110,7 +1113,7 @@ __cb_resize_callback(struct wl_egl_window *wl_egl_window, void *private)
        req_w = wl_egl_window->width;
        req_h = wl_egl_window->height;
 
-       TPL_LOG_T("WL_EGL", "[RESIZE_CB] wl_egl_window(%p) (%dx%d) -> (%dx%d)",
+       TPL_LOG_T(BACKEND, "[RESIZE_CB] wl_egl_window(%p) (%dx%d) -> (%dx%d)",
                        wl_egl_window, cur_w, cur_h, req_w, req_h);
 
        if (tbm_surface_queue_reset(source->tbm_queue, req_w, req_h, format)
@@ -1129,7 +1132,7 @@ __cb_rotate_callback(struct wl_egl_window *wl_egl_window, void *private)
        int rotation = wl_egl_window->rotation;
        twe_wl_surf_source *source = (twe_wl_surf_source *)private;
 
-       TPL_LOG_T("WL_EGL", "[ROTATE_CB] wl_egl_window(%p) (%d) -> (%d)",
+       TPL_LOG_T(BACKEND, "[ROTATE_CB] wl_egl_window(%p) (%d) -> (%d)",
                          wl_egl_window, source->rotation, rotation);
 
        source->rotation = rotation;
@@ -1162,7 +1165,7 @@ static void __cb_tss_flusher_flush_callback(void *data,
        twe_wl_disp_source *disp_source = surf_source->disp_source;
        int ret;
 
-       TPL_LOG_T("WL_EGL", "[FLUSH_CB] surf_source(%p)", surf_source);
+       TPL_LOG_T(BACKEND, "[FLUSH_CB] surf_source(%p)", surf_source);
 
        /*First distach pending queue for TPL
                - dispatch buffer-release
@@ -1203,7 +1206,7 @@ static void __cb_tss_flusher_free_flush_callback(void *data,
        twe_wl_disp_source *disp_source = surf_source->disp_source;
        int ret;
 
-       TPL_LOG_T("WL_EGL", "[FREE_FLUSH_CB] surf_source(%p)", surf_source);
+       TPL_LOG_T(BACKEND, "[FREE_FLUSH_CB] surf_source(%p)", surf_source);
 
        /* First distach panding queue for TPL
                - dispatch buffer-release
@@ -1236,7 +1239,7 @@ __cb_twe_buffer_free_callback(twe_wl_buffer_info *buf_info)
        twe_wl_surf_source *surf_source = buf_info->surf_source;
        twe_wl_disp_source *disp_source = surf_source->disp_source;
 
-       TPL_LOG_T("WL_EGL", "[FREE] twe_buffer(%p) wl_buffer(%p)",
+       TPL_LOG_T(BACKEND, "[FREE] twe_buffer(%p) wl_buffer(%p)",
                          buf_info, buf_info->wl_buffer);
 
        wl_display_flush(disp_source->disp);
@@ -1294,7 +1297,7 @@ __cb_buffer_release_callback(void *data, struct wl_proxy *wl_buffer)
                                TPL_OBJECT_UNLOCK(&surf_source->obj);
                        }
 
-                       TPL_LOG_T("WL_EGL", "[REL] wl_buffer(%p) tbm_surface(%p) bo(%d)",
+                       TPL_LOG_T(BACKEND, "[REL] wl_buffer(%p) tbm_surface(%p) bo(%d)",
                                          buf_info->wl_buffer, tbm_surface,
                                          tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
                        tbm_surface_internal_unref(tbm_surface);
@@ -1368,7 +1371,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                        TPL_OBJECT_UNLOCK(&surf_source->obj);
                }
 
-               TPL_LOG_T("WL_EGL",
+               TPL_LOG_T(BACKEND,
                                  "[REUSE_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) transform(%d)",
                                  buf_info, tbm_surface,
                                  tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)),
@@ -1452,7 +1455,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                TPL_OBJECT_UNLOCK(&surf_source->obj);
        }
 
-       TPL_LOG_T("WL_EGL",
+       TPL_LOG_T(BACKEND,
                          "[NEW_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) transform(%d)",
                          buf_info, tbm_surface,
                          tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)),
@@ -1478,7 +1481,7 @@ _twe_surface_cancel_dequeued_buffer(twe_wl_surf_source *surf_source,
                return;
        }
 
-       TPL_LOG_T("WL_EGL",
+       TPL_LOG_T(BACKEND,
                          "[CANCEL_BUFFER] Stop tracking of canceled tbm_surface(%p)",
                          tbm_surface);
 
@@ -1495,7 +1498,7 @@ static void
 __cb_tbm_queue_reset_callback(tbm_surface_queue_h tbm_queue,
                                                          void *data)
 {
-       TPL_LOG_T("WL_EGL", "tbm_queue(%p) has been reset!", tbm_queue);
+       TPL_LOG_T(BACKEND, "tbm_queue(%p) has been reset!", tbm_queue);
 }
 
 static void
@@ -1688,7 +1691,7 @@ _twe_thread_wl_vk_surface_commit(twe_wl_surf_source *surf_source,
 
        buf_info->sync_timestamp++;
 
-       TPL_LOG_T("WL_VK", "[COMMIT] wl_buffer(%p) tbm_surface(%p) bo(%d)",
+       TPL_LOG_T(BACKEND, "[COMMIT] wl_buffer(%p) tbm_surface(%p) bo(%d)",
                          buf_info->wl_buffer, tbm_surface,
                          tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
 
@@ -1780,7 +1783,7 @@ _twe_thread_wl_surface_commit(twe_wl_surf_source *surf_source,
 
        buf_info->need_to_commit = TPL_FALSE;
 
-       TPL_LOG_T("WL_EGL", "[COMMIT] wl_buffer(%p) tbm_surface(%p) bo(%d)",
+       TPL_LOG_T(BACKEND, "[COMMIT] wl_buffer(%p) tbm_surface(%p) bo(%d)",
                          buf_info->wl_buffer, tbm_surface,
                          tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
 
@@ -1821,7 +1824,7 @@ _twe_thread_wl_surface_acquire_and_commit(twe_wl_surf_source *surf_source)
        }
 
        if (!disp_source->is_vulkan_dpy && !surf_source->vblank_done) {
-               TPL_LOG_T("WL_EGL", "[ACQ_skip] It will be acquired next vblank.");
+               TPL_LOG_T(BACKEND, "[ACQ_skip] It will be acquired next vblank.");
                TPL_OBJECT_UNLOCK(&surf_source->obj);
                return;
        }
@@ -1847,7 +1850,7 @@ _twe_thread_wl_surface_acquire_and_commit(twe_wl_surf_source *surf_source)
                }
 
                if (!disp_source->is_vulkan_dpy) { /* wayland_egl */
-                       TPL_LOG_T("WL_EGL", "[ACQ] tbm_surface(%p) bo(%d)",
+                       TPL_LOG_T(BACKEND, "[ACQ] tbm_surface(%p) bo(%d)",
                                        tbm_surface,
                                        tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
 
@@ -1861,7 +1864,7 @@ _twe_thread_wl_surface_acquire_and_commit(twe_wl_surf_source *surf_source)
                        case TPL_DISPLAY_PRESENT_MODE_MAILBOX:
                                if (surf_source->draw_done_buffer) {
                                        g_mutex_lock(&surf_source->free_queue_mutex);
-                                       TPL_LOG_T("WL_VK", "[SKIP] tbm_surface(%p) bo(%d)",
+                                       TPL_LOG_T(BACKEND, "[SKIP] tbm_surface(%p) bo(%d)",
                                                          tbm_surface,
                                                          tbm_bo_export(tbm_surface_internal_get_bo(
                                                                          tbm_surface, 0)));
@@ -1943,7 +1946,7 @@ _twe_thread_wl_surface_finalize(GSource *source)
 {
        twe_wl_surf_source *surf_source = (twe_wl_surf_source *)source;
 
-       TPL_LOG_T("WL_EGL", "gsource(%p) event_fd(%d)",
+       TPL_LOG_T(BACKEND, "gsource(%p) event_fd(%d)",
                          source, surf_source->event_fd);
 
        close(surf_source->event_fd);
@@ -1975,7 +1978,7 @@ _twe_surface_buffer_flusher_init(twe_wl_surf_source *surf_source)
        tizen_surface_shm_flusher_add_listener(surf_source->tss_flusher,
                                                                                   &tss_flusher_listener,
                                                                                   surf_source);
-       TPL_LOG_T("WL_EGL",
+       TPL_LOG_T(BACKEND,
                          "tss_flusher init. surf_source(%p) tss_flusher(%p)",
                          surf_source, surf_source->tss_flusher);
 }
@@ -1984,7 +1987,7 @@ static void
 _twe_surface_buffer_flusher_fini(twe_wl_surf_source *surf_source)
 {
        if (surf_source->tss_flusher) {
-               TPL_LOG_T("WL_EGL",
+               TPL_LOG_T(BACKEND,
                                  "tss_flusher fini. surf_source(%p) tss_flusher(%p)",
                                  surf_source, surf_source->tss_flusher);
                tizen_surface_shm_flusher_destroy(surf_source->tss_flusher);
@@ -2019,7 +2022,7 @@ _twe_surface_create_vblank(tdm_client *tdm_client)
        tdm_client_vblank_set_enable_fake(vblank, 1);
        tdm_client_vblank_set_sync(vblank, 0);
 
-       TPL_LOG_T("WL_EGL", "[VBLANK INIT] vblank(%p)", vblank);
+       TPL_LOG_T(BACKEND, "[VBLANK INIT] vblank(%p)", vblank);
 
        return vblank;
 }
@@ -2165,7 +2168,7 @@ _twe_thread_wl_surf_source_destroy(void *source)
        }
 
        if (surf_source->vblank) {
-               TPL_LOG_T("WL_EGL", "[VBLANK FINI] twe_wl_surf_source(%p) vblank(%p)",
+               TPL_LOG_T(BACKEND, "[VBLANK FINI] twe_wl_surf_source(%p) vblank(%p)",
                                  surf_source, surf_source->vblank);
                tdm_client_vblank_destroy(surf_source->vblank);
        }
@@ -2174,7 +2177,7 @@ _twe_thread_wl_surf_source_destroy(void *source)
        surf_source->rotate_cb = NULL;
 
        if (surf_source->wl_egl_window) {
-               TPL_LOG_T("WL_EGL", "twe_surface(%p) wl_egl_window(%p) wl_surface(%p)",
+               TPL_LOG_T(BACKEND, "twe_surface(%p) wl_egl_window(%p) wl_surface(%p)",
                                  surf_source, surf_source->wl_egl_window, surf_source->surf);
                surf_source->wl_egl_window->destroy_window_callback = NULL;
                surf_source->wl_egl_window->resize_callback = NULL;
@@ -2298,7 +2301,7 @@ twe_surface_add(twe_thread* thread,
        g_mutex_init(&source->free_queue_mutex);
        g_cond_init(&source->free_queue_cond);
 
-       TPL_LOG_T("WL_EGL",
+       TPL_LOG_T(BACKEND,
                          "gsource(%p) native_handle(%p) wl_surface(%p) event_fd(%d)",
                          source, native_handle, source->surf, source->event_fd);
 
@@ -2328,7 +2331,7 @@ twe_surface_del(twe_surface_h twe_surface)
                return TPL_ERROR_INVALID_PARAMETER;
        }
 
-       TPL_LOG_T("WL_EGL", "twe_surface(%p) will be destroyed in thread",
+       TPL_LOG_T(BACKEND, "twe_surface(%p) will be destroyed in thread",
                          twe_surface);
        surf_del_source = surf_source->surf_del_source;
 
@@ -2428,9 +2431,9 @@ twe_surface_create_swapchain(twe_surface_h twe_surface,
        surf_source->swapchain_properties.present_mode = present_mode;
        surf_source->swapchain_properties.buffer_count = buffer_count;
 
-       TPL_LOG_T("WL_VK", "[SWAPCHAIN_CREATE][1/2] twe_surface(%p) tbm_queue(%p)",
+       TPL_LOG_T(BACKEND, "[SWAPCHAIN_CREATE][1/2] twe_surface(%p) tbm_queue(%p)",
                          twe_surface, surf_source->tbm_queue);
-       TPL_LOG_T("WL_VK",
+       TPL_LOG_T(BACKEND,
                          "[SWAPCHAIN_CREATE][2/2] w(%d) h(%d) f(%d) p(%d) b_cnt(%d)",
                          width, height, format, present_mode, buffer_count);
 
@@ -2447,7 +2450,7 @@ twe_surface_destroy_swapchain(twe_surface_h twe_surface)
                return TPL_ERROR_INVALID_PARAMETER;
        }
 
-       TPL_LOG_T("WL_VK", "[SWAPCHAIN_DESTROY] twe_surface(%p) tbm_queue(%p)",
+       TPL_LOG_T(BACKEND, "[SWAPCHAIN_DESTROY] twe_surface(%p) tbm_queue(%p)",
                          twe_surface, surf_source->tbm_queue);
 
        if (surf_source->tbm_queue) {
@@ -2502,7 +2505,7 @@ twe_surface_set_rotation_capablity(twe_surface_h twe_surface, tpl_bool_t set)
                return;
        }
 
-       TPL_LOG_T("WL_EGL", "twe_surface(%p) rotation capability set to [%s]",
+       TPL_LOG_T(BACKEND, "twe_surface(%p) rotation capability set to [%s]",
                          source, (set ? "TRUE" : "FALSE"));
 
        source->rotation_capability = set;