wayland: port to 1.0 version of the protocol.
authorRob Bradford <rob@linux.intel.com>
Fri, 2 Nov 2012 18:18:37 +0000 (18:18 +0000)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 15 Nov 2012 13:31:33 +0000 (14:31 +0100)
This patch updates to relect the 1.0 version of the protocol. The main
changes are the switch to wl_registry for global object notifications
and the way that the event queue and file descriptor is processed.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
configure.ac
gst-libs/gst/vaapi/gstvaapidisplay_wayland.c
gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h
gst-libs/gst/vaapi/gstvaapiwindow_wayland.c

index f38d9f9624f3cbc152a0bd21ec0eb2216e033663..20e193dc12617f49520a29caa7726d795c13a42c 100644 (file)
@@ -42,7 +42,7 @@ m4_define([gst_plugins_bad_version],
           [gst_plugins_bad_major_version.gst_plugins_bad_minor_version.gst_plugins_bad_micro_version])
 
 # Wayland minimum version number
-m4_define([wayland_api_version], [0.95.0])
+m4_define([wayland_api_version], [1.0.0])
 
 # VA-API minimum version number
 m4_define([va_api_version],     [0.30.4])
index 1ebeb3d3083fe7ae05c319c30394834d51672359..ec2c81a2267eefbe20d3177af00ea0f9bcc487d3 100644 (file)
@@ -253,34 +253,31 @@ static const struct wl_output_listener output_listener = {
 };
 
 static void
-display_handle_global(
-    struct wl_display *display,
-    uint32_t           id,
-    const char        *interface,
-    uint32_t           version,
-    void              *data
+registry_handle_global(
+    void               *data,
+    struct wl_registry *registry,
+    uint32_t            id,
+    const char         *interface,
+    uint32_t            version
 )
 {
     GstVaapiDisplayWaylandPrivate * const priv = data;
 
     if (strcmp(interface, "wl_compositor") == 0)
-        priv->compositor = wl_display_bind(display, id, &wl_compositor_interface);
+        priv->compositor =
+          wl_registry_bind(registry, id, &wl_compositor_interface, 1);
     else if (strcmp(interface, "wl_shell") == 0)
-        priv->shell = wl_display_bind(display, id, &wl_shell_interface);
+        priv->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
     else if (strcmp(interface, "wl_output") == 0) {
-        priv->output = wl_display_bind(display, id, &wl_output_interface);
+        priv->output = wl_registry_bind(registry, id, &wl_output_interface, 1);
         wl_output_add_listener(priv->output, &output_listener, priv);
     }
 }
 
-static int
-event_mask_update(uint32_t mask, void *data)
-{
-    GstVaapiDisplayWaylandPrivate * const priv = data;
-
-    priv->event_mask = mask;
-    return 0;
-}
+static const struct wl_registry_listener registry_listener = {
+    registry_handle_global,
+    NULL,
+};
 
 static gboolean
 gst_vaapi_display_wayland_open_display(GstVaapiDisplay * display)
@@ -296,9 +293,9 @@ gst_vaapi_display_wayland_open_display(GstVaapiDisplay * display)
         return FALSE;
 
     wl_display_set_user_data(priv->wl_display, priv);
-    wl_display_add_global_listener(priv->wl_display, display_handle_global, priv);
-    priv->event_fd = wl_display_get_fd(priv->wl_display, event_mask_update, priv);
-    wl_display_iterate(priv->wl_display, priv->event_mask);
+    priv->registry = wl_display_get_registry(priv->wl_display);
+    wl_registry_add_listener(priv->registry, &registry_listener, priv);
+    priv->event_fd = wl_display_get_fd(priv->wl_display);
     wl_display_roundtrip(priv->wl_display);
 
     if (!priv->compositor) {
@@ -477,7 +474,6 @@ gst_vaapi_display_wayland_init(GstVaapiDisplayWayland *display)
     priv->phys_width     = 0;
     priv->phys_height    = 0;
     priv->event_fd       = -1;
-    priv->event_mask     = 0;
 }
 
 /**
index 429de3682cab7df11963ea70d3f1b68006a7b753..1fff45860442ce44ed020c21dbc1d62935b4c0c7 100644 (file)
@@ -51,12 +51,12 @@ struct _GstVaapiDisplayWaylandPrivate {
     struct wl_compositor       *compositor;
     struct wl_shell            *shell;
     struct wl_output           *output;
+    struct wl_registry         *registry;
     guint                       width;
     guint                       height;
     guint                       phys_width;
     guint                       phys_height;
     gint                        event_fd;
-    guint32                     event_mask;
     guint                       create_display  : 1;
 };
 
index 8e04f2d7f541493b9dc1b01af7a8226e8a286802..c22c6787939cbec6b162e0fb1e431efaa3e69e17 100644 (file)
@@ -260,7 +260,7 @@ gst_vaapi_window_wayland_render(
 
     /* Wait for the previous frame to complete redraw */
     if (priv->redraw_pending) 
-        wl_display_iterate(wl_display, WL_DISPLAY_READABLE);
+        wl_display_dispatch(wl_display);
 
     /* XXX: use VA/VPP for other filters */
     va_flags = from_GstVaapiSurfaceRenderFlags(flags);
@@ -292,7 +292,9 @@ gst_vaapi_window_wayland_render(
         priv->opaque_region = NULL;
     }
 
-    wl_display_iterate(wl_display, WL_DISPLAY_WRITABLE);
+    wl_surface_commit(priv->surface);
+
+    wl_display_flush(wl_display);
     priv->redraw_pending = TRUE;
     priv->buffer = buffer;