tpl_wayland_egl_thread: Changed to use wl_tbm event queue to use flusher in thread. 93/167793/2
authorjoonbum.ko <joonbum.ko@samsung.com>
Fri, 19 Jan 2018 04:13:36 +0000 (13:13 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Mon, 22 Jan 2018 06:20:41 +0000 (15:20 +0900)
Change-Id: I2e15a77caa1356b51532a66b9f75d6df44ddb2e8
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index 965e5fd..48e37db 100644 (file)
@@ -822,10 +822,10 @@ _twe_display_shm_init(twe_wl_disp_source *disp_source)
                goto fini;
        }
 
-       /* set tizen_surface_shm's queue as client's default queue */
+       /* set tizen_surface_shm's queue as client's private queue */
        if (disp_source->tss)
                wl_proxy_set_queue((struct wl_proxy *)disp_source->tss,
-                                                  NULL);
+                                                  disp_source->ev_queue);
 
        TPL_LOG_T(BACKEND, "tizen_surface_shm(%p) init.", disp_source->tss);
 
@@ -1196,80 +1196,30 @@ static void __cb_tss_flusher_flush_callback(void *data,
                struct tizen_surface_shm_flusher *tss_flusher)
 {
        twe_wl_surf_source *surf_source = (twe_wl_surf_source *)data;
-       twe_wl_disp_source *disp_source = surf_source->disp_source;
-       int ret;
+       tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE;
 
        TPL_LOG_T(BACKEND, "[FLUSH_CB] surf_source(%p)", surf_source);
 
-       /*First distach pending queue for TPL
-               - dispatch buffer-release
-               - dispatch queue flush
-       */
-       TPL_OBJECT_LOCK(&disp_source->obj);
-       ret = wl_display_dispatch_queue_pending(disp_source->disp,
-                                                                                       disp_source->ev_queue);
-       if (ret == -1) {
-               _twe_display_print_err(disp_source, "dispatch_queue_pending");
-               TPL_OBJECT_UNLOCK(&disp_source->obj);
+       tsq_err = tbm_surface_queue_flush(surf_source->tbm_queue);
+       if (tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE) {
+               TPL_ERR("Failed to free flush tbm_queue(%p)", surf_source->tbm_queue);
                return;
        }
-
-       tbm_surface_queue_flush(surf_source->tbm_queue);
-
-       /* Only when client call tpl_surface_dequeue_buffer(), client can do
-        * unreference tbm_surface although there are release events in the event queue.
-        * After tbm_surface_queue_flush, queue has no tbm_surface, client can do
-        * unreference committed buffers using the list of committed_buffers.
-        * Then, client does not need to wait for release_callback to unreference
-        * committed buffers.
-        */
-       if (surf_source->committed_buffers) {
-               TPL_OBJECT_LOCK(&surf_source->obj);
-               while (!__tpl_list_is_empty(surf_source->committed_buffers)) {
-                       tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE;
-                       tbm_surface_h tbm_surface =
-                               __tpl_list_pop_front(surf_source->committed_buffers,
-                                       (tpl_free_func_t)__cb_buffer_remove_from_list);
-
-                       TRACE_ASYNC_END((int)tbm_surface, "[COMMIT ~ RELEASE] BO(%d)",
-                                                       tbm_bo_export(tbm_surface_internal_get_bo(
-                                                               tbm_surface, 0)));
-                       tsq_err = tbm_surface_queue_release(surf_source->tbm_queue, tbm_surface);
-                       if (tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE)
-                               TPL_ERR("Failed to release. tbm_surface(%p) tsq_err(%d)",
-                                               tbm_surface, tsq_err);
-               }
-               TPL_OBJECT_UNLOCK(&surf_source->obj);
-       }
-
-       TPL_OBJECT_UNLOCK(&disp_source->obj);
 }
 
 static void __cb_tss_flusher_free_flush_callback(void *data,
                struct tizen_surface_shm_flusher *tss_flusher)
 {
        twe_wl_surf_source *surf_source = (twe_wl_surf_source *)data;
-       twe_wl_disp_source *disp_source = surf_source->disp_source;
-       int ret;
+       tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_NONE;
 
        TPL_LOG_T(BACKEND, "[FREE_FLUSH_CB] surf_source(%p)", surf_source);
 
-       /* First distach panding queue for TPL
-               - dispatch buffer-release
-               - dispatch queue flush
-       */
-       TPL_OBJECT_LOCK(&disp_source->obj);
-       ret = wl_display_dispatch_queue_pending(disp_source->disp,
-                                                                                       disp_source->ev_queue);
-       if (ret == -1) {
-               _twe_display_print_err(disp_source, "dispatch_queue_pending");
-               TPL_OBJECT_UNLOCK(&disp_source->obj);
+       tsq_err = tbm_surface_queue_free_flush(surf_source->tbm_queue);
+       if (tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE) {
+               TPL_ERR("Failed to free flush tbm_queue(%p)", surf_source->tbm_queue);
                return;
        }
-
-       tbm_surface_queue_free_flush(surf_source->tbm_queue);
-
-       TPL_OBJECT_UNLOCK(&disp_source->obj);
 }