From: joonbum.ko Date: Wed, 2 May 2018 06:01:20 +0000 (+0900) Subject: tpl_wayland_egl_thread: Combined shm_init and vk_init. X-Git-Tag: submit/tizen/20180502.085710~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0532ef08cfe0b4f8af33ed7869764ad45e76157e;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git tpl_wayland_egl_thread: Combined shm_init and vk_init. Change-Id: I9e908494bf140486b5245fe6330d403ff8d15265 Signed-off-by: joonbum.ko --- diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index c2cebce..521ee94 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -776,7 +776,7 @@ static const struct wl_registry_listener registry_listener = { }; static void -_twe_display_shm_init(twe_wl_disp_source *disp_source) +_twe_display_wayland_init(twe_wl_disp_source *disp_source) { struct wl_registry *registry = NULL; struct wl_event_queue *queue = NULL; @@ -819,84 +819,45 @@ _twe_display_shm_init(twe_wl_disp_source *disp_source) } /* set tizen_surface_shm's queue as client's private queue */ - if (disp_source->tss) + if (disp_source->tss) { wl_proxy_set_queue((struct wl_proxy *)disp_source->tss, disp_source->ev_queue); - - TPL_LOG_T(BACKEND, "tizen_surface_shm(%p) init.", disp_source->tss); - -fini: - if (queue) - wl_event_queue_destroy(queue); - if (display_wrapper) - wl_proxy_wrapper_destroy(display_wrapper); - if (registry) - wl_registry_destroy(registry); -} - -static void -_twe_display_shm_fini(twe_wl_disp_source *disp_source) -{ - if (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; - } -} - -static void -_twe_display_vk_init(twe_wl_disp_source *disp_source) -{ - struct wl_registry *registry = NULL; - struct wl_event_queue *queue = NULL; - int ret; - - queue = wl_display_create_queue(disp_source->disp); - if (!queue) { - TPL_ERR("Failed to create wl_queue"); - goto fini; - } - - registry = wl_display_get_registry(disp_source->disp); - if (!registry) { - TPL_ERR("Failed to create wl_registry"); - goto fini; - } - - wl_proxy_set_queue((struct wl_proxy *)registry, queue); - if (wl_registry_add_listener(registry, ®istry_listener, - disp_source)) { - TPL_ERR("Failed to wl_registry_add_listener"); - goto fini; - } - - ret = wl_display_roundtrip_queue(disp_source->disp, queue); - if (ret == -1) { - _twe_display_print_err(disp_source, "roundtrip_queue"); - goto fini; + TPL_LOG_T(BACKEND, "tizen_surface_shm(%p) init.", disp_source->tss); } - /* set tizen_surface_shm's queue as client's default queue */ if (disp_source->wl_vk_client) { wayland_vulkan_add_listener(disp_source->wl_vk_client, &wl_vk_listener, disp_source); - wl_display_roundtrip_queue(disp_source->disp, queue); + ret = wl_display_roundtrip_queue(disp_source->disp, queue); + if (ret == -1) { + _twe_display_print_err(disp_source, "roundtrip_queue"); + goto fini; + } wl_proxy_set_queue((struct wl_proxy *)disp_source->wl_vk_client, - NULL); + disp_source->ev_queue); + TPL_LOG_T(BACKEND, "wl_vk_client(%p) init.", disp_source->wl_vk_client); } fini: if (queue) wl_event_queue_destroy(queue); + if (display_wrapper) + wl_proxy_wrapper_destroy(display_wrapper); if (registry) wl_registry_destroy(registry); } static void -_twe_display_vk_fini(twe_wl_disp_source *disp_source) +_twe_display_wayland_fini(twe_wl_disp_source *disp_source) { + if (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; + } + if (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); @@ -994,7 +955,7 @@ twe_display_add(twe_thread* thread, source->surface_capabilities.max_buffer = VK_CLIENT_QUEUE_SIZE; source->surface_capabilities.present_modes = TPL_DISPLAY_PRESENT_MODE_FIFO; - _twe_display_shm_init(source); + _twe_display_wayland_init(source); source->disp_del_source = _twe_del_source_init(ctx, source); source->disp_del_source->destroy_target_source_func @@ -1026,10 +987,7 @@ twe_display_del(twe_display_h twe_display) disp_del_source = source->disp_del_source; - if (source->is_vulkan_dpy) - _twe_display_vk_fini(source); - - _twe_display_shm_fini(source); + _twe_display_wayland_fini(source); _twe_display_fini_wl_tbm_client(source->wl_tbm_client); source->wl_tbm_client = NULL;