summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-01-28 16:37:28 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-01-28 18:10:31 +0100
commit2e34707b54825f2c16241273a0e80f29d573bb64 (patch)
tree0a1eb4ffb48141f5ffa84c5ddc832fea2c1ef190 /gst-libs/gst/vaapi
parent2183eb54c12f65767e3d20d38767b96ced97b470 (diff)
wayland: really wait until the pending redraw completed.
Introduce gst_vaapi_window_wayland_sync() helper function to wait for the completion of the redraw request. Use it in _render() function to actually block until the previous draw request is completed.
Diffstat (limited to 'gst-libs/gst/vaapi')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiwindow_wayland.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
index 850dae40..e475514f 100644
--- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
+++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
@@ -71,6 +71,26 @@ gst_vaapi_window_wayland_hide(GstVaapiWindow *window)
return TRUE;
}
+static gboolean
+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);
+ }
+ return success;
+}
+
static void
handle_ping(void *data, struct wl_shell_surface *shell_surface,
uint32_t serial)
@@ -256,11 +276,11 @@ gst_vaapi_window_wayland_render(
if (surface_id == VA_INVALID_ID)
return FALSE;
- GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
-
/* Wait for the previous frame to complete redraw */
- if (priv->redraw_pending)
- wl_display_dispatch(wl_display);
+ if (!gst_vaapi_window_wayland_sync(window))
+ return FALSE;
+
+ GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
/* XXX: use VA/VPP for other filters */
va_flags = from_GstVaapiSurfaceRenderFlags(flags);