From b794f6cb92d43b4ea41d60955bf62b83766dd64d Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 2 Nov 2012 18:18:37 +0000 Subject: [PATCH] wayland: port to 1.0 version of the protocol. 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 --- configure.ac | 2 +- gst-libs/gst/vaapi/gstvaapidisplay_wayland.c | 38 ++++++++++------------- gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h | 2 +- gst-libs/gst/vaapi/gstvaapiwindow_wayland.c | 6 ++-- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index f38d9f9..20e193d 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c b/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c index 1ebeb3d..ec2c81a 100644 --- a/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c +++ b/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c @@ -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, ®istry_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; } /** diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h b/gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h index 429de36..1fff458 100644 --- a/gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h +++ b/gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h @@ -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; }; diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c index 8e04f2d..c22c678 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c @@ -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; -- 2.7.4