summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2020-07-14 09:40:34 -0400
committerRay Strode <rstrode@redhat.com>2020-07-14 09:50:35 -0400
commit7bd39e19b8c63f96aac63fcbf234dfddfd3b9626 (patch)
treebbf98b986199b8d6ae66d2eaa33821b8b0d0836e
parentf05f5ec554a146cf4e1df71af05a3f3d909091ad (diff)
downloadgtk+-wip/moar-vendor-nvidia-driver-flicker.tar.gz
x11: don't set up frame sync fence on unsupported compositorswip/moar-vendor-nvidia-driver-flicker
Not all compositors support _NET_WM_FRAME_DRAWN. In cases where teh compositor doesn't support _NET_WM_FRAME_DRAWN we don't need to do all the fancy damage tracking and fence watching. Furthermore, if the compositor doesn't support frame drawn, it's possible that one frame will start before the previous frame has made it through the pipeline, leading to a blown assertion. This commit side steps the unnecessary code an associated assertion when _NET_WM_FRAME_DRAWN isn't supported. May help with https://gitlab.gnome.org/GNOME/gtk/-/issues/2927
-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 37efcf6c10..56d8eff1ea 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__ */