e_comp_wl: add call to dispatch the requests of binding wayland global interfaces 50/38450/2
authorDuna Oh <duna.oh@samsung.com>
Tue, 21 Apr 2015 03:34:44 +0000 (12:34 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 21 Apr 2015 04:59:09 +0000 (21:59 -0700)
Summary:
- Add call to dispatch the requests of creating a wayldand client, getting the registry, and binding global interfaces, because we need global objects immediately after we request.
- Load desktop shell module while initting e_comp, not idle time.

Test Plan:
(1) Run enlightenment on wayland
(2) If e_module attemps to make the "Error loading Module" popup window, you will see deadlock waiting for the wayland sync "done" event to be received.
This means the wayland global interfaces including wl.compositor is not ready.

below is the mainloop we are blocked
---------------------------------------------------------------
_ecore_wl_init_wait(void)
{
   while (!_ecore_wl_disp->init_done)
     wl_display_dispatch(_ecore_wl_disp->wl.display);
}

Change-Id: I9e3e960264ea87af4a20ec214db73bc05ef6fc73

src/bin/e_comp.c
src/bin/e_comp_wl.c

index 74cb15c..6a6f507 100644 (file)
@@ -1047,16 +1047,17 @@ e_comp_init(void)
 #ifdef HAVE_WL_FM
            "wl_fb",
 #endif
+           "wl_desktop_shell",
            NULL
         };
 
         e_util_env_set("HYBRIS_EGLPLATFORM", "wayland");
         for (test = eng; *test; test++)
           {
-             if (e_module_enable(e_module_new(*test)))
-               goto out;
+             if (!e_module_enable(e_module_new(*test)))
+               return EINA_FALSE;
           }
-        return EINA_FALSE;
+        goto out;
      }
 #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
    e_comp_wl_init();
index efd9650..42921fb 100644 (file)
@@ -2657,6 +2657,17 @@ e_comp_wl_init(void)
         return EINA_FALSE;
      }
 
+   wl_event_loop_dispatch(e_comp->wl_comp_data->wl.loop, -1); //server calls wl_client_create()
+
+   ecore_wl_flush(); // client sendmsg wl_display.get_registry request
+   wl_event_loop_dispatch(e_comp->wl_comp_data->wl.loop, -1); //server calls display_get_registry()
+   wl_display_flush_clients(e_comp->wl_comp_data->wl.disp); //server flushes wl_registry.global events
+
+   ecore_wl_display_iterate(); //client handles global events and make 'bind' requests to each global interfaces
+
+   ecore_wl_flush(); //client sendmsg wl_registry.bind requests
+   wl_event_loop_dispatch(e_comp->wl_comp_data->wl.loop, -1); //server calls registry_bind() using given interfaces' name
+
    /* create hash to store clients */
    /* clients_win_hash = eina_hash_int64_new(NULL); */
    clients_buffer_hash = eina_hash_int32_new(NULL);