mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 07:08:23 +00:00
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>
This commit is contained in:
parent
b03c7edfcf
commit
3bbd091bb4
1 changed files with 2 additions and 6 deletions
|
@ -409,10 +409,8 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit)
|
|||
|
||||
wl_subsurface_set_position (window->video_subsurface, res.x, res.y);
|
||||
|
||||
if (commit) {
|
||||
wl_surface_damage (window->video_surface_wrapper, 0, 0, res.w, res.h);
|
||||
if (commit)
|
||||
wl_surface_commit (window->video_surface_wrapper);
|
||||
}
|
||||
|
||||
/* this is saved for use in wl_surface_damage */
|
||||
window->video_rectangle = res;
|
||||
|
@ -468,8 +466,6 @@ gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
|
|||
if (G_UNLIKELY (info)) {
|
||||
/* commit also the parent (area_surface) in order to change
|
||||
* the position of the video_subsurface */
|
||||
wl_surface_damage (window->area_surface_wrapper, 0, 0,
|
||||
window->render_rectangle.w, window->render_rectangle.h);
|
||||
wl_surface_commit (window->area_surface_wrapper);
|
||||
wl_subsurface_set_desync (window->video_subsurface);
|
||||
}
|
||||
|
@ -517,6 +513,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, width, height);
|
||||
|
||||
/* at this point, the GstWlBuffer keeps the buffer
|
||||
* alive and will free it on wl_buffer::release */
|
||||
|
@ -553,7 +550,6 @@ gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
|
|||
gst_wl_window_resize_video_surface (window, TRUE);
|
||||
}
|
||||
|
||||
wl_surface_damage (window->area_surface_wrapper, 0, 0, w, h);
|
||||
wl_surface_commit (window->area_surface_wrapper);
|
||||
|
||||
if (window->video_width != 0)
|
||||
|
|
Loading…
Reference in a new issue