diff options
author | Christian Hergert <christian@hergert.me> | 2015-09-30 18:33:08 -0700 |
---|---|---|
committer | Ignacio Casal Quinteiro <qignacio@amazon.com> | 2019-04-11 17:59:02 +0200 |
commit | f0d50c57c969697df2b0088244a6dbfd5fe4a2b9 (patch) | |
tree | 3c2314f4df677f078508583bda92244c5c0a8066 | |
parent | eb919fb5e6e12a221337e42fc90d06906a45cbb4 (diff) | |
download | gtk+-f0d50c57c969697df2b0088244a6dbfd5fe4a2b9.tar.gz |
quartz: drop beam sync penalty code
Now that we have a frame clock in place, we should be able to drop
the beam-sync penalty prevention code as we should be aligning our
draws with CVDisplayLink.
-rw-r--r-- | gdk/quartz/gdkwindow-quartz.c | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 440c9112fc..24503fdca9 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -45,8 +45,6 @@ static gboolean in_process_all_updates = FALSE; static GSList *main_window_stack; -void _gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl); - typedef struct { gint x, y; @@ -193,7 +191,7 @@ gdk_window_impl_quartz_release_context (GdkWindowImplQuartz *window_impl, /* See comment in gdk_quartz_window_get_context(). */ if (window_impl->in_paint_rect_count == 0) { - _gdk_quartz_window_flush (window_impl); + [window_impl->toplevel flushWindow]; [window_impl->view unlockFocus]; } } @@ -218,52 +216,6 @@ gdk_window_impl_quartz_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } -/* Help preventing "beam sync penalty" where CG makes all graphics code - * block until the next vsync if we try to flush (including call display on - * a view) too often. We do this by limiting the manual flushing done - * outside of expose calls to less than some frequency when measured over - * the last 4 flushes. This is a bit arbitray, but seems to make it possible - * for some quick manual flushes (such as gtkruler or gimp’s marching ants) - * without hitting the max flush frequency. - * - * If drawable NULL, no flushing is done, only registering that a flush was - * done externally. - * - * Note: As of MacOS 10.14 NSWindow flushWindow is deprecated because - * Quartz has the ability to handle deferred drawing on its own. - */ -void -_gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl) -{ -#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400 - static struct timeval prev_tv; - static gint intervals[4]; - static gint index; - struct timeval tv; - gint ms; - - gettimeofday (&tv, NULL); - ms = (tv.tv_sec - prev_tv.tv_sec) * 1000 + (tv.tv_usec - prev_tv.tv_usec) / 1000; - intervals[index++ % 4] = ms; - - if (window_impl) - { - ms = intervals[0] + intervals[1] + intervals[2] + intervals[3]; - - /* ~25Hz on average. */ - if (ms > 4*40) - { - if (window_impl) - [window_impl->toplevel flushWindow]; - - prev_tv = tv; - } - } - else - prev_tv = tv; -#endif -} - static cairo_user_data_key_t gdk_quartz_cairo_key; typedef struct { @@ -447,7 +399,6 @@ _gdk_quartz_display_after_process_all_updates (GdkDisplay *display) [[nswindow contentView] displayIfNeeded]; - _gdk_quartz_window_flush (NULL); #if MAC_OS_X_VERSION_MIN_REQUIRED < 101400 [nswindow enableFlushWindow]; [nswindow flushWindow]; |