Skip to content
Snippets Groups Projects

Add multiple buffering to xwl_window

Merged Olivier Fourdan requested to merge ofourdan/xserver:issue835 into master
1 file
+ 17
2
Compare changes
  • Side-by-side
  • Inline
  • ce4465a8
    Xwayland takes care of not attaching a new buffer if a frame callback is
    pending.
    
    Yet, the existing buffer (which was previously attached) may still be
    updated from the X11 side, causing unexpected visual glitches to the
    buffer.
    
    Request a detached buffer when updating damages and free the buffer
    when released so that the buffer sent to the compositor always remains
    untouched until released.
    
    !316
    Closes: #835
    
    
    Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
+ 17
2
@@ -1065,6 +1065,17 @@ void xwl_surface_damage(struct xwl_screen *xwl_screen,
wl_surface_damage(surface, x, y, width, height);
}
static void
buffer_release_callback (void *data,
struct wl_buffer *wl_buffer)
{
wl_buffer_destroy(wl_buffer);
}
static const struct wl_buffer_listener buffer_listener = {
.release = buffer_release_callback,
};
static void
xwl_window_post_damage(struct xwl_window *xwl_window)
{
@@ -1073,6 +1084,7 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
BoxPtr box;
struct wl_buffer *buffer;
PixmapPtr pixmap;
Bool new_buffer = FALSE;
int i;
assert(!xwl_window->frame_callback);
@@ -1083,8 +1095,8 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
#ifdef XWL_HAS_GLAMOR
if (xwl_screen->glamor)
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap,
FALSE,
NULL);
TRUE, /* detached mode */
&new_buffer);
else
#endif
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
@@ -1116,6 +1128,9 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, xwl_window);
if (new_buffer)
wl_buffer_add_listener(buffer, &buffer_listener, NULL);
wl_surface_commit(xwl_window->surface);
DamageEmpty(window_get_damage(xwl_window->window));
Loading