From 2c300081c4fc4db6a345041cbf4942cb99cea793 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 2 Feb 2016 12:20:22 -0500 Subject: [PATCH] wayland: always return FALSE from begin_paint The client and compositor share access to the window pixel buffers. After the client hands off (commits) the buffer to the compositor it's not supposed to write to it again until it's released by the compositor. The code tries to deal with this contention by allocating a temporary buffer and using that in the mean time. This temporary buffer is allocated by a higher layer of the code when begin_paint returns TRUE. Unfortunately, that layer of the code has no idea when the buffer is released, so it ends up blitting the temporary buffer back to the shared buffer prematurely. This commit changes begin_paint to always return FALSE. A future commit will address the contention problem in a different way. https://bugzilla.gnome.org/show_bug.cgi?id=761312 --- gdk/wayland/gdkdisplay-wayland.c | 19 ------------------- gdk/wayland/gdkprivate-wayland.h | 2 -- gdk/wayland/gdkwindow-wayland.c | 9 +-------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index fcd3502274..500e211c5d 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -906,7 +906,6 @@ typedef struct _GdkWaylandCairoSurfaceData { struct wl_buffer *buffer; GdkWaylandDisplay *display; uint32_t scale; - gboolean busy; } GdkWaylandCairoSurfaceData; static void @@ -914,9 +913,7 @@ buffer_release_callback (void *_data, struct wl_buffer *wl_buffer) { cairo_surface_t *surface = _data; - GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key); - data->busy = FALSE; cairo_surface_destroy (surface); } @@ -1001,7 +998,6 @@ _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display, data->display = display; data->buffer = NULL; data->scale = scale; - data->busy = FALSE; stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width*scale); @@ -1043,21 +1039,6 @@ _gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface) return data->buffer; } -void -_gdk_wayland_shm_surface_set_busy (cairo_surface_t *surface) -{ - GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key); - data->busy = TRUE; - cairo_surface_reference (surface); -} - -gboolean -_gdk_wayland_shm_surface_get_busy (cairo_surface_t *surface) -{ - GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key); - return data->busy; -} - gboolean _gdk_wayland_is_shm_surface (cairo_surface_t *surface) { diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h index 9e5151702e..123a33b161 100644 --- a/gdk/wayland/gdkprivate-wayland.h +++ b/gdk/wayland/gdkprivate-wayland.h @@ -232,8 +232,6 @@ cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *di int height, guint scale); struct wl_buffer *_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface); -void _gdk_wayland_shm_surface_set_busy (cairo_surface_t *surface); -gboolean _gdk_wayland_shm_surface_get_busy (cairo_surface_t *surface); gboolean _gdk_wayland_is_shm_surface (cairo_surface_t *surface); GdkWaylandSelection * gdk_wayland_display_get_selection (GdkDisplay *display); diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index f5a0546c76..1c509e59cb 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -442,8 +442,6 @@ on_frame_clock_after_paint (GdkFrameClock *clock, _gdk_frame_clock_freeze (clock); wl_surface_commit (impl->display_server.wl_surface); - if (_gdk_wayland_is_shm_surface (impl->cairo_surface)) - _gdk_wayland_shm_surface_set_busy (impl->cairo_surface); g_signal_emit (impl, signals[COMMITTED], 0); } @@ -641,14 +639,9 @@ gdk_wayland_window_create_similar_image_surface (GdkWindow * window, static gboolean gdk_window_impl_wayland_begin_paint (GdkWindow *window) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); - gdk_wayland_window_ensure_cairo_surface (window); - if (_gdk_wayland_is_shm_surface (impl->cairo_surface)) - return _gdk_wayland_shm_surface_get_busy (impl->cairo_surface); - else - return FALSE; + return FALSE; } static void