mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-02 16:52:42 +00:00
wayland: use a local event queue to avoid lock contention.
This improves performance when rendering several surfaces from within the same process. e.g. a tee of vaapidecode'd buffers to vaapisink.
This commit is contained in:
parent
96d12f9eb1
commit
1d16669aca
1 changed files with 19 additions and 6 deletions
|
@ -50,6 +50,7 @@ struct _GstVaapiWindowWaylandPrivate {
|
|||
struct wl_surface *surface;
|
||||
struct wl_buffer *buffer;
|
||||
struct wl_region *opaque_region;
|
||||
struct wl_event_queue *event_queue;
|
||||
guint redraw_pending : 1;
|
||||
guint is_shown : 1;
|
||||
guint fullscreen_on_show : 1;
|
||||
|
@ -76,19 +77,17 @@ gst_vaapi_window_wayland_sync(GstVaapiWindow *window)
|
|||
{
|
||||
GstVaapiWindowWaylandPrivate * const priv =
|
||||
GST_VAAPI_WINDOW_WAYLAND(window)->priv;
|
||||
gboolean success = TRUE;
|
||||
|
||||
if (priv->redraw_pending) {
|
||||
struct wl_display * const wl_display =
|
||||
GST_VAAPI_OBJECT_WL_DISPLAY(window);
|
||||
|
||||
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||
do {
|
||||
success = wl_display_dispatch(wl_display) >= 0;
|
||||
} while (success && priv->redraw_pending);
|
||||
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||
if (wl_display_dispatch_queue(wl_display, priv->event_queue) < 0)
|
||||
return FALSE;
|
||||
} while (priv->redraw_pending);
|
||||
}
|
||||
return success;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -157,11 +156,18 @@ gst_vaapi_window_wayland_create(
|
|||
g_return_val_if_fail(priv_display->compositor != NULL, FALSE);
|
||||
g_return_val_if_fail(priv_display->shell != NULL, FALSE);
|
||||
|
||||
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||
priv->event_queue = wl_display_create_queue(priv_display->wl_display);
|
||||
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||
if (!priv->event_queue)
|
||||
return FALSE;
|
||||
|
||||
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||
priv->surface = wl_compositor_create_surface(priv_display->compositor);
|
||||
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||
if (!priv->surface)
|
||||
return FALSE;
|
||||
wl_proxy_set_queue((struct wl_proxy *)priv->surface, priv->event_queue);
|
||||
|
||||
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
|
||||
priv->shell_surface =
|
||||
|
@ -169,6 +175,8 @@ gst_vaapi_window_wayland_create(
|
|||
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||
if (!priv->shell_surface)
|
||||
return FALSE;
|
||||
wl_proxy_set_queue((struct wl_proxy *)priv->shell_surface,
|
||||
priv->event_queue);
|
||||
|
||||
wl_shell_surface_add_listener(priv->shell_surface,
|
||||
&shell_surface_listener, priv);
|
||||
|
@ -203,6 +211,11 @@ gst_vaapi_window_wayland_destroy(GstVaapiWindow * window)
|
|||
wl_buffer_destroy(priv->buffer);
|
||||
priv->buffer = NULL;
|
||||
}
|
||||
|
||||
if (priv->event_queue) {
|
||||
wl_event_queue_destroy(priv->event_queue);
|
||||
priv->event_queue = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue