waylandsink: Use wl_surface_damage_buffer() instead of wl_surface_damage()
authorRobert Mader <robert.mader@collabora.com>
Mon, 13 Dec 2021 12:16:06 +0000 (13:16 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 13 Jan 2022 19:39:59 +0000 (19:39 +0000)
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>

subprojects/gst-plugins-bad/ext/wayland/wldisplay.c
subprojects/gst-plugins-bad/ext/wayland/wlwindow.c

index 0bb9dc7..f326091 100644 (file)
@@ -214,7 +214,7 @@ registry_handle_global (void *data, struct wl_registry *registry,
 
   if (g_strcmp0 (interface, "wl_compositor") == 0) {
     self->compositor = wl_registry_bind (registry, id, &wl_compositor_interface,
-        MIN (version, 3));
+        MIN (version, 4));
   } else if (g_strcmp0 (interface, "wl_subcompositor") == 0) {
     self->subcompositor =
         wl_registry_bind (registry, id, &wl_subcompositor_interface, 1);
index 152b94e..7abddd5 100644 (file)
@@ -451,7 +451,7 @@ gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
 
   if (G_LIKELY (buffer)) {
     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);
     wl_surface_commit (window->video_surface_wrapper);
   } else {
@@ -512,7 +512,7 @@ gst_wl_window_update_borders (GstWlWindow * window)
       window->display, &info);
   gwlbuf = gst_buffer_add_wl_buffer (buf, wlbuf, window->display);
   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);
 
   /* at this point, the GstWlBuffer keeps the buffer