waylandsink: Use wl_surface_damage_buffer() instead of wl_surface_damage()

The later, doing damage in surface coordinates instead of buffer
coordinates, has been deprecated. The reason for that is that it
is more prone to bugs, both on the client and the compositor side,
especially when paired with buffer scale, `wp_viewporter` or
buffer transforms.

Unfortunately, on Weston this risks running into
https://gitlab.freedesktop.org/wayland/weston/-/issues/446
(which causes trouble for several other projects as well). However,
that bug only affects cases where we run in sync mode, i.e. only
during resizes. In practise I haven't been able to observe the
issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1446>
This commit is contained in:
Robert Mader 2021-12-13 13:16:06 +01:00 committed by GStreamer Marge Bot
parent 1249362f96
commit f0b04f1ef1
2 changed files with 3 additions and 3 deletions

View file

@ -214,7 +214,7 @@ registry_handle_global (void *data, struct wl_registry *registry,
if (g_strcmp0 (interface, "wl_compositor") == 0) { if (g_strcmp0 (interface, "wl_compositor") == 0) {
self->compositor = wl_registry_bind (registry, id, &wl_compositor_interface, self->compositor = wl_registry_bind (registry, id, &wl_compositor_interface,
MIN (version, 3)); MIN (version, 4));
} else if (g_strcmp0 (interface, "wl_subcompositor") == 0) { } else if (g_strcmp0 (interface, "wl_subcompositor") == 0) {
self->subcompositor = self->subcompositor =
wl_registry_bind (registry, id, &wl_subcompositor_interface, 1); wl_registry_bind (registry, id, &wl_subcompositor_interface, 1);

View file

@ -451,7 +451,7 @@ gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
if (G_LIKELY (buffer)) { if (G_LIKELY (buffer)) {
gst_wl_buffer_attach (buffer, window->video_surface_wrapper); gst_wl_buffer_attach (buffer, window->video_surface_wrapper);
wl_surface_damage (window->video_surface_wrapper, 0, 0, G_MAXINT32, wl_surface_damage_buffer (window->video_surface_wrapper, 0, 0, G_MAXINT32,
G_MAXINT32); G_MAXINT32);
wl_surface_commit (window->video_surface_wrapper); wl_surface_commit (window->video_surface_wrapper);
} else { } else {
@ -512,7 +512,7 @@ gst_wl_window_update_borders (GstWlWindow * window)
window->display, &info); window->display, &info);
gwlbuf = gst_buffer_add_wl_buffer (buf, wlbuf, window->display); gwlbuf = gst_buffer_add_wl_buffer (buf, wlbuf, window->display);
gst_wl_buffer_attach (gwlbuf, window->area_surface_wrapper); gst_wl_buffer_attach (gwlbuf, window->area_surface_wrapper);
wl_surface_damage (window->area_surface_wrapper, 0, 0, G_MAXINT32, wl_surface_damage_buffer (window->area_surface_wrapper, 0, 0, G_MAXINT32,
G_MAXINT32); G_MAXINT32);
/* at this point, the GstWlBuffer keeps the buffer /* at this point, the GstWlBuffer keeps the buffer