mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
wayland: fix frame_redraw callback.
The redraw callback needs to be attached to the surface prior to the commit. Otherwise, the callback notifies the next surface repaint, which is not the desired behaviour. i.e. we want to be notified for the surface we have just filled. Another isse was the redraw_pending was reset before the actual completion of the frame redraw callback function, thus causing concurrency issues. e.g. the callback could have been called again, but with a NULL buffer.
This commit is contained in:
parent
087bf30c23
commit
23c6053b94
1 changed files with 4 additions and 5 deletions
|
@ -208,10 +208,10 @@ frame_redraw_callback(void *data, struct wl_callback *callback, uint32_t time)
|
|||
{
|
||||
GstVaapiWindowWaylandPrivate * const priv = data;
|
||||
|
||||
priv->redraw_pending = FALSE;
|
||||
wl_buffer_destroy(priv->buffer);
|
||||
priv->buffer = NULL;
|
||||
wl_callback_destroy(callback);
|
||||
priv->redraw_pending = FALSE;
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener frame_callback_listener = {
|
||||
|
@ -292,14 +292,13 @@ gst_vaapi_window_wayland_render(
|
|||
priv->opaque_region = NULL;
|
||||
}
|
||||
|
||||
wl_surface_commit(priv->surface);
|
||||
|
||||
wl_display_flush(wl_display);
|
||||
priv->redraw_pending = TRUE;
|
||||
priv->buffer = buffer;
|
||||
|
||||
callback = wl_surface_frame(priv->surface);
|
||||
wl_callback_add_listener(callback, &frame_callback_listener, priv);
|
||||
|
||||
wl_surface_commit(priv->surface);
|
||||
wl_display_flush(wl_display);
|
||||
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue