From: Hoyub Lee Date: Tue, 21 Nov 2017 11:00:12 +0000 (+0900) Subject: tpl_wayland_egl: Modify creating event queue for multi-threaded usage X-Git-Tag: accepted/tizen/4.0/unified/20171129.090427~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F161093%2F2;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git tpl_wayland_egl: Modify creating event queue for multi-threaded usage In multi-threaded wayland, below is guided on creating own event queue: Create a wl_interface object with a specified event queue, instead of creating an object and then changing it’s queue. This patch applies this guideline on where creating own event queue. Change-Id: Ieee31c9544af12c1c31aa807423b9a3eb972f5bf Signed-off-by: Hoyub Lee --- diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 689665b..35cb53f 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -1550,6 +1550,7 @@ __tpl_wayland_egl_display_buffer_flusher_init( { struct wl_registry *registry = NULL; struct wl_event_queue *queue = NULL; + struct wl_display *display_wrapper = NULL; int ret; queue = wl_display_create_queue(wayland_egl_display->wl_dpy); @@ -1558,13 +1559,23 @@ __tpl_wayland_egl_display_buffer_flusher_init( goto fini; } - registry = wl_display_get_registry(wayland_egl_display->wl_dpy); + display_wrapper = wl_proxy_create_wrapper(wayland_egl_display->wl_dpy); + if (!display_wrapper) { + TPL_ERR("Failed to create a proxy wrapper of wl_display"); + goto fini; + } + + wl_proxy_set_queue((struct wl_proxy *)display_wrapper, queue); + + registry = wl_display_get_registry(display_wrapper); if (!registry) { TPL_ERR("Failed to create wl_registry"); goto fini; } - wl_proxy_set_queue((struct wl_proxy *)registry, queue); + wl_proxy_wrapper_destroy(display_wrapper); + display_wrapper = NULL; + if (wl_registry_add_listener(registry, ®istry_listener, wayland_egl_display)) { TPL_ERR("Failed to wl_registry_add_listener"); @@ -1585,6 +1596,8 @@ __tpl_wayland_egl_display_buffer_flusher_init( fini: if (queue) wl_event_queue_destroy(queue); + if (display_wrapper) + wl_proxy_wrapper_destroy(display_wrapper); if (registry) wl_registry_destroy(registry); }