Add patch for GNOME #769835

This commit is contained in:
Michael Catanzaro 2017-01-10 20:58:28 -06:00
parent 2316f15e5a
commit 0afcab3b85
2 changed files with 111 additions and 1 deletions

View File

@ -0,0 +1,103 @@
From ab66c3d7bfaa316fc80a19e8aae32949b80068c1 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 22 Dec 2016 19:22:07 +0100
Subject: wayland: Disable EGL swap interval
We have a frame clock that ensures rendering is done as per the
output vsync. There is no need to have Mesa do the same for us.
This, most notably, ensures Mesa doesn't schedule frame callbacks
that will be left unattended if the compositor stops throttling
frames for its surface, this is eg. the case if the toplevel is
moved to another workspace.
Also, given a SwapInterval!=0 will always bring these unexpected
side effects, check that it's possible to disable it, and spew
a debug message if that isn't the case.
https://bugzilla.gnome.org/show_bug.cgi?id=769835
---
gdk/wayland/gdkdisplay-wayland.h | 1 +
gdk/wayland/gdkglcontext-wayland.c | 25 ++++++++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index a68940f..a9fd483 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -120,6 +120,7 @@ struct _GdkWaylandDisplay
guint have_egl_buffer_age : 1;
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_surfaceless_context : 1;
+ EGLint egl_min_swap_interval;
};
struct _GdkWaylandDisplayClass
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index 6573688..254900d 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -369,6 +369,7 @@ gdk_wayland_display_init_gl (GdkDisplay *display)
static gboolean
find_eglconfig_for_window (GdkWindow *window,
EGLConfig *egl_config_out,
+ EGLint *min_swap_interval_out,
GError **error)
{
GdkDisplay *display = gdk_window_get_display (window);
@@ -376,7 +377,7 @@ find_eglconfig_for_window (GdkWindow *window,
GdkVisual *visual = gdk_window_get_visual (window);
EGLint attrs[MAX_EGL_ATTRS];
EGLint count;
- EGLConfig *configs;
+ EGLConfig *configs, chosen_config;
gboolean use_rgba;
int i = 0;
@@ -429,9 +430,20 @@ find_eglconfig_for_window (GdkWindow *window,
}
/* Pick first valid configuration i guess? */
+ chosen_config = configs[0];
+
+ if (!eglGetConfigAttrib (display_wayland->egl_display, chosen_config,
+ EGL_MIN_SWAP_INTERVAL, min_swap_interval_out))
+ {
+ g_set_error_literal (error, GDK_GL_ERROR,
+ GDK_GL_ERROR_NOT_AVAILABLE,
+ "Could not retrieve the minimum swap interval");
+ g_free (configs);
+ return FALSE;
+ }
if (egl_config_out != NULL)
- *egl_config_out = configs[0];
+ *egl_config_out = chosen_config;
g_free (configs);
@@ -465,7 +477,9 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
return NULL;
}
- if (!find_eglconfig_for_window (window, &config, error))
+ if (!find_eglconfig_for_window (window, &config,
+ &display_wayland->egl_min_swap_interval,
+ error))
return NULL;
context = g_object_new (GDK_TYPE_WAYLAND_GL_CONTEXT,
@@ -543,5 +557,10 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display,
return FALSE;
}
+ if (display_wayland->egl_min_swap_interval == 0)
+ eglSwapInterval (display_wayland->egl_display, 0);
+ else
+ g_debug ("Can't disable GL swap interval");
+
return TRUE;
}
--
cgit v0.12

View File

@ -18,13 +18,16 @@
Name: gtk3 Name: gtk3
Version: 3.22.6 Version: 3.22.6
Release: 1%{?dist} Release: 2%{?dist}
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
License: LGPLv2+ License: LGPLv2+
URL: http://www.gtk.org URL: http://www.gtk.org
Source0: http://download.gnome.org/sources/gtk+/3.22/gtk+-%{version}.tar.xz Source0: http://download.gnome.org/sources/gtk+/3.22/gtk+-%{version}.tar.xz
# https://bugzilla.gnome.org/show_bug.cgi?id=769835
Patch0: disable-egl-swap-interval.patch
BuildRequires: pkgconfig(atk) >= %{atk_version} BuildRequires: pkgconfig(atk) >= %{atk_version}
BuildRequires: pkgconfig(atk-bridge-2.0) BuildRequires: pkgconfig(atk-bridge-2.0)
BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
@ -161,6 +164,7 @@ the functionality of the installed %{name} package.
%prep %prep
%setup -q -n gtk+-%{version} %setup -q -n gtk+-%{version}
%patch0 -p1 -b .egl-swap-interval
%build %build
(if ! test -x configure; then NOCONFIGURE=1 ./autogen.sh; CONFIGFLAGS=--enable-gtk-doc; fi; (if ! test -x configure; then NOCONFIGURE=1 ./autogen.sh; CONFIGFLAGS=--enable-gtk-doc; fi;
@ -333,6 +337,9 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache
%{_datadir}/installed-tests %{_datadir}/installed-tests
%changelog %changelog
* Tue Jan 10 2017 Michael Catanzaro <mcatanzaro@gnome.org> - 3.22.6-2
- Add patch for GNOME #769835
* Thu Jan 05 2017 Kalev Lember <klember@redhat.com> - 3.22.6-1 * Thu Jan 05 2017 Kalev Lember <klember@redhat.com> - 3.22.6-1
- Update to 3.22.6 - Update to 3.22.6