wl_vk: change the event message processing
authorJoonbum Ko <joonbum.ko@samsung.com>
Mon, 10 Jul 2023 08:24:02 +0000 (17:24 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Mon, 10 Jul 2023 08:24:02 +0000 (17:24 +0900)
Change-Id: I6d3b6c7aa7b5289fb1b91a9c3f9cb563499fabd4
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wl_vk_thread.c

index a339349..0592063 100644 (file)
@@ -104,10 +104,10 @@ struct _tpl_wl_vk_swapchain {
 
 typedef enum surf_message {
        NONE_MESSAGE = 0,
-       INIT_SURFACE,
-       CREATE_QUEUE,
-       DESTROY_QUEUE,
-       ACQUIRABLE,
+       INIT_SURFACE = 1,
+       ACQUIRABLE = 2,
+       CREATE_QUEUE = 4,
+       DESTROY_QUEUE = 8,
 } surf_message;
 
 struct _tpl_wl_vk_surface {
@@ -1213,13 +1213,25 @@ __thread_func_surf_dispatch(tpl_gsource *gsource, uint64_t message)
        wl_vk_surface = (tpl_wl_vk_surface_t *)tpl_gsource_get_data(gsource);
 
        tpl_gmutex_lock(&wl_vk_surface->surf_mutex);
-       if (message == INIT_SURFACE) { /* Initialize surface */
+       if (message & INIT_SURFACE) { /* Initialize surface */
                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 */
+       }
+       
+       if (message & ACQUIRABLE) { /* Acquirable message */
+               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) {
+                       TPL_ERR("Failed to acquire from tbm_queue. wl_vk_surface(%p)",
+                                       wl_vk_surface);
+               }
+       }
+
+       if (message & CREATE_QUEUE) { /* Create tbm_surface_queue */
                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)
@@ -1228,19 +1240,13 @@ __thread_func_surf_dispatch(tpl_gsource *gsource, uint64_t message)
                                        wl_vk_surface);
                }
                tpl_gcond_signal(&wl_vk_surface->surf_cond);
-       } else if (message == DESTROY_QUEUE) { /* swapchain destroy */
+       }
+       
+       if (message & DESTROY_QUEUE) { /* swapchain destroy */
                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_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) {
-                       TPL_ERR("Failed to acquire from tbm_queue. wl_vk_surface(%p)",
-                                       wl_vk_surface);
-               }
        }
 
        /* init to NONE_MESSAGE */