mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-29 06:51:10 +00:00
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
This commit is contained in:
parent
1cfa2f4134
commit
2c300081c4
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user