summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-07-15 01:40:49 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-07-15 01:40:49 +0000
commitc12261a6ec1f48502c559bee1cd9f9dabd55e6d4 (patch)
tree476e8e340ba46ed5ab17f58debc49847cac0c385
parent5af7d6bff3d2920aca118a36f13b23cbb68c1641 (diff)
parentd0ec616fbae86b25009881804ddfdca3a966e945 (diff)
downloadgtk+-c12261a6ec1f48502c559bee1cd9f9dabd55e6d4.tar.gz
Merge branch 'wip/fix-picom-crasher' into 'master'
x11: Don't set up frame sync fence on unsupported compositors Closes #2927 See merge request GNOME/gtk!2245
-rw-r--r--gdk/x11/gdkglcontext-x11.c2
-rw-r--r--gdk/x11/gdksurface-x11.c8
-rw-r--r--gdk/x11/gdksurface-x11.h2
3 files changed, 7 insertions, 5 deletions
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 9fdbca9c89..0bd475908f 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -184,7 +184,7 @@ gdk_x11_gl_context_end_frame (GdkDrawContext *draw_context,
gdk_x11_surface_pre_damage (surface);
#ifdef HAVE_XDAMAGE
- if (context_x11->xdamage != 0)
+ if (context_x11->xdamage != 0 && _gdk_x11_surface_syncs_frames (surface))
{
g_assert (context_x11->frame_fence == 0);
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 54bf26aae6..2567d7e765 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -360,8 +360,8 @@ gdk_x11_surface_begin_frame (GdkSurface *surface,
}
}
-static gboolean
-should_sync_frame_drawing (GdkSurface *surface)
+gboolean
+_gdk_x11_surface_syncs_frames (GdkSurface *surface)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
@@ -395,7 +395,7 @@ static void
maybe_sync_counter_for_end_frame (GdkSurface *surface)
{
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
- gboolean frame_sync_negotiated = should_sync_frame_drawing (surface);
+ gboolean frame_sync_negotiated = _gdk_x11_surface_syncs_frames (surface);
gboolean frame_done_painting = !impl->toplevel->frame_pending;
#ifdef HAVE_XDAMAGE
@@ -478,7 +478,7 @@ gdk_x11_surface_end_frame (GdkSurface *surface)
maybe_sync_counter_for_end_frame (surface);
- if (should_sync_frame_drawing (surface))
+ if (_gdk_x11_surface_syncs_frames (surface))
{
impl->toplevel->frame_pending = TRUE;
gdk_surface_freeze_updates (surface);
diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h
index 5715c2f21d..6fc7afd07d 100644
--- a/gdk/x11/gdksurface-x11.h
+++ b/gdk/x11/gdksurface-x11.h
@@ -179,6 +179,7 @@ GdkCursor *_gdk_x11_surface_get_cursor (GdkSurface *window);
void _gdk_x11_surface_update_size (GdkX11Surface *impl);
void _gdk_x11_surface_set_surface_scale (GdkSurface *window,
int scale);
+gboolean _gdk_x11_surface_syncs_frames (GdkSurface *surface);
void gdk_x11_surface_pre_damage (GdkSurface *surface);
@@ -188,6 +189,7 @@ void gdk_x11_surface_move (GdkSurface *surface,
void gdk_x11_surface_check_monitor (GdkSurface *surface,
GdkMonitor *monitor);
+
G_END_DECLS
#endif /* __GDK_X11_SURFACE__ */