After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 724968 - wayland: Fix gdk_window_wayland_resize_cairo_surface()
wayland: Fix gdk_window_wayland_resize_cairo_surface()
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-02-22 19:57 UTC by Rui Matos
Modified: 2014-02-23 17:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland: Fix gdk_window_wayland_resize_cairo_surface() (1.13 KB, patch)
2014-02-22 19:57 UTC, Rui Matos
none Details | Review
wayland: Fix gdk_window_wayland_resize_cairo_surface() (1.12 KB, patch)
2014-02-22 19:58 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2014-02-22 19:57:08 UTC
Company pointed me at this solution. See below for how I debugger the
issue:

GdkWindow keeps a pointer to the impl's cairo_surface which is the one
used to actually paint on. This pointer is retrieved by the painting
logic with _gdk_window_ref_cairo_surface() which gets it from the
backend if it's not cached yet else it re-uses the one it has.

When we clear the backend's cairo_surface on _update_size() we need to
clear GdkWindow's pointer as well. Otherwise we'd go on and commit a
new buffer to the compositor while the paint operation would be done
on the previous buffer and thus we'd get an empty buffer in the
compositor.

Depending on the compositor this issue could go unnoticed. For
instance, on weston's drm backend we get the release event for buffer
N very soon after buffer N's commit and since we destroy the cairo
surface at that point, the destruction handler installed by
_gdk_window_ref_cairo_surface() would run and clear GdkWindow's
cairo_surface pointer thus causing the correct new cairo_surface to be
fetched from the backend before paintint buffer N+1.

On weston's pixman backend, buffer N's release event arrives only
after buffer N+1 is commited. This means that for every odd new buffer
created while resizing, _gdk_window_ref_cairo_surface() would re-use
the cairo_surface for buffer N for painting and thus buffer N+1 was
commited blank to the compositor.
Comment 1 Rui Matos 2014-02-22 19:57:11 UTC
Created attachment 270007 [details] [review]
wayland: Fix gdk_window_wayland_resize_cairo_surface()

Like in other backends (except X) we can't resize cairo image surfaces
so let's sync the code here with what the other backends do.

This prevents the painting machinery above us to always paint on the
correct buffer.
Comment 2 Rui Matos 2014-02-22 19:58:53 UTC
Created attachment 270008 [details] [review]
wayland: Fix gdk_window_wayland_resize_cairo_surface()

Like in other backends (except X) we can't resize cairo image surfaces
so let's sync the code here with what the other backends do.

This prevents the painting machinery above us to paint on the wrong
buffer.
--

Oops, now with is a correct commit msg.
Comment 3 Matthias Clasen 2014-02-23 13:47:58 UTC
Makes sense to me
Comment 4 Benjamin Otte (Company) 2014-02-23 17:40:52 UTC
Attachment 270008 [details] pushed as 6ea4bf8 - wayland: Fix gdk_window_wayland_resize_cairo_surface()