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 <gwenole.beauchesne@intel.com>
This commit is contained in:
Rob Bradford 2012-11-02 18:18:37 +00:00 committed by Gwenole Beauchesne
parent 1e506ad6ee
commit b794f6cb92
4 changed files with 23 additions and 25 deletions

View 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])

View 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;
}
/**

View 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;
};

View 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;