waylandsink: Only call wl_surface_damage() when buffer content changed
authorRobert Mader <robert.mader@collabora.com>
Thu, 30 Dec 2021 17:14:24 +0000 (18:14 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 13 Jan 2022 19:39:59 +0000 (19:39 +0000)
commit3bbd091bb43c95f589cfe25ff4dad78b5242338a
tree9f080ff9c5670802b6eed861567f28817ee25eea
parentb03c7edfcfba6585d4ef236118ae4f49afb1bedf
waylandsink: Only call wl_surface_damage() when buffer content changed

From the spec:
> This request is used to describe the regions where the pending
> buffer is different from the current surface contents

We currently also call `wl_surface_damage()` on surfaces without
new or still compositor-hold buffers, e.g. when resizing the window.
In that case we call it on `area_surface_wrapper`, even though it
gets resized via `wp_viewport_set_destination()`, in which case
the compositor is in charge of repainting the area on screen.

Doing so is currently not forbidden by the spec, however it might
be in the future, see
https://gitlab.freedesktop.org/wayland/wayland/-/issues/267

Thus lets stay close to the spec and only call `wl_surface_damage()`
when we just attached a buffer.

Right now this prevents runtime assertions in Mutter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1446>
subprojects/gst-plugins-bad/ext/wayland/wlwindow.c