How to enable Wayland when original software support X?

Wang, Quanxian quanxian.wang at intel.com
Tue Feb 5 18:07:56 PST 2013


Hi, All

I like to get some comment from you.

I am planning to enable wayland webgl support in webkit-efl. Basically they support X. With the update, I will not change the original mechanism and just translate X operation to wayland operation.

I think more and more developers will come across such issue when they want to support Wayland.

Here are some code translation.

First part: open Display

+#if ENABLE(TIZEN_WAYLAND)
+        g_nativeDisplay = wl_display_connect(NULL);
+        assert(g_nativeDisplay);
+        struct wl_registry *registry = wl_display_get_registry(g_nativeDisplay);
+        wl_registry_add_listener(registry, NULL, NULL);
+        wl_display_dispatch(g_nativeDisplay);
+        m_window = (void *)wl_egl_window_create(NULL, 1, 1);
+#else
+        g_nativeDisplay = XOpenDisplay(0);
+        g_nativeWindow = XCreateSimpleWindow(g_nativeDisplay, XDefaultRootWindow(g_nativeDisplay),
                             0, 0, 1, 1, 0,
                             BlackPixel(g_nativeDisplay, 0), WhitePixel(g_nativeDisplay, 0));
+        XFlush(g_nativeDisplay);
+#endif

Second part: create surface

+#if ENABLE(TIZEN_WAYLAND)
+    m_window = (void *)wl_egl_window_create(NULL, 1, 1);
+    m_surface = eglCreateWindowSurface(m_display, surfaceConfig, (struct wl_egl_window *)m_window, NULL);
+#else
     m_pixmapID = XCreatePixmap(g_nativeDisplay, g_nativeWindow, 1, 1, 32);
     m_surface = eglCreatePixmapSurface(m_display, surfaceConfig, m_pixmapID, NULL);
+#endif

Wayland has no pixmap and wl_egl_pixmap has been moved out from mesa and wayland. Therefore I have to use window to replace them.

Currently with testing, it is fine. However I am afraid I miss something unexpected. Need Wayland expert like you to have a review of them.

Any suggestion for that?

Thanks

Regards

Quanxian Wang


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130206/2e126aa2/attachment.html>


More information about the wayland-devel mailing list