summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2019-03-25 22:21:09 -0400
committerNicolas Dufresne <nicolas@ndufresne.ca>2019-04-03 18:20:58 +0000
commit3fea1fa50b633ce6603bfba67dbce40598a8af70 (patch)
treebc01fefd94953a8ee79ec4a732186d336306e3eb
parent0e89f2a6d9323c1f8ff4a2b03d8dcb713a8e8bab (diff)
downloadgstreamer-plugins-bad-3fea1fa50b633ce6603bfba67dbce40598a8af70.tar.gz
waylandsink: Wait for the surface to be configured
With latest XDG shell, we need to fait for the surface to have been configured before we can attach a buffer to it. This is being enforce by Weston with an error. Fixes #933
-rw-r--r--ext/wayland/wlwindow.c23
-rw-r--r--ext/wayland/wlwindow.h3
2 files changed, 23 insertions, 3 deletions
diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c
index afb598878..0a1c15601 100644
--- a/ext/wayland/wlwindow.c
+++ b/ext/wayland/wlwindow.c
@@ -87,7 +87,13 @@ static void
handle_xdg_surface_configure (void *data, struct xdg_surface *xdg_surface,
uint32_t serial)
{
+ GstWlWindow *window = data;
xdg_surface_ack_configure (xdg_surface, serial);
+
+ g_mutex_lock (&window->configure_mutex);
+ window->configured = TRUE;
+ g_cond_signal (&window->configure_cond);
+ g_mutex_unlock (&window->configure_mutex);
}
static const struct xdg_surface_listener xdg_surface_listener = {
@@ -141,6 +147,9 @@ gst_wl_window_class_init (GstWlWindowClass * klass)
static void
gst_wl_window_init (GstWlWindow * self)
{
+ self->configured = TRUE;
+ g_cond_init (&self->configure_cond);
+ g_mutex_init (&self->configure_mutex);
}
static void
@@ -185,6 +194,7 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock)
window = g_object_new (GST_TYPE_WL_WINDOW, NULL);
window->display = g_object_ref (display);
window->render_lock = render_lock;
+ g_cond_init (&window->configure_cond);
window->area_surface = wl_compositor_create_surface (display->compositor);
window->video_surface = wl_compositor_create_surface (display->compositor);
@@ -268,10 +278,17 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
xdg_toplevel_add_listener (window->xdg_toplevel,
&xdg_toplevel_listener, window);
- /* Finally, commit the xdg_surface state as toplevel */
- wl_surface_commit (window->area_surface);
-
gst_wl_window_ensure_fullscreen (window, fullscreen);
+
+ /* Finally, commit the xdg_surface state as toplevel */
+ window->configured = FALSE;
+ wl_surface_commit (window->video_surface);
+ wl_display_flush (display->display);
+
+ g_mutex_lock (&window->configure_mutex);
+ while (!window->configured)
+ g_cond_wait (&window->configure_cond, &window->configure_mutex);
+ g_mutex_unlock (&window->configure_mutex);
} else if (display->wl_shell) {
/* go toplevel */
window->wl_shell_surface = wl_shell_get_shell_surface (display->wl_shell,
diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h
index 861e324ad..c3f017216 100644
--- a/ext/wayland/wlwindow.h
+++ b/ext/wayland/wlwindow.h
@@ -55,6 +55,9 @@ struct _GstWlWindow
struct wl_shell_surface *wl_shell_surface;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
+ gboolean configured;
+ GCond configure_cond;
+ GMutex configure_mutex;
/* the size and position of the area_(sub)surface */
GstVideoRectangle render_rectangle;