[Xfce4-commits] [xfce/xfwm4] 05/06: compositor: Force "GL_MaxFramesAllowed" to 1
noreply at xfce.org
noreply at xfce.org
Thu May 23 21:50:57 CEST 2019
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfwm4.
commit d5222bcfee97f2924545eed1a524c3f1e8589511
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Thu May 23 21:35:28 2019 +0200
compositor: Force "GL_MaxFramesAllowed" to 1
Bug: 15453
NVIDIA proprietary/closed source driver queues up to 2 frames by default
before blocking in glXSwapBuffers(), whereas our compositor expects
`glXSwapBuffers()` to block until the next vblank.
To avoid that, our compositor is issuing a `glXWaitGL()` immediately
after the call to `glXSwapBuffers()` but that translates as a busy wait,
hence dramatically increasing CPU usage of xfwm4 with the NVIDIA
proprietary/closed source driver.
Instruct the NVIDIA proprietary/closed source driver to allow only 1
frame using the environment variable “__GL_MaxFramesAllowed” so that it
matches our expectations.
Taken from similar patch posted by NVIDIA developer for kwin:
https://phabricator.kde.org/D19867
Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
src/main.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/main.c b/src/main.c
index f1e7eb7..055c015 100644
--- a/src/main.c
+++ b/src/main.c
@@ -714,6 +714,28 @@ main (int argc, char **argv)
#endif /* DEBUG */
DBG ("xfwm4 starting");
+#ifdef HAVE_EPOXY
+ /* NVIDIA proprietary/closed source driver queues up to 2 frames by
+ * default before blocking in glXSwapBuffers(), whereas our compositor
+ * expects `glXSwapBuffers()` to block until the next vblank.
+ *
+ * To avoid that, our compositor was issuing a `glXWaitGL()` immediately
+ * after the call to `glXSwapBuffers()` but that translates as a busy
+ * wait, hence dramatically increasing CPU usage of xfwm4 with the
+ * NVIDIA proprietary/closed source driver.
+ *
+ * Instruct the NVIDIA proprietary/closed source driver to allow only
+ * 1 frame using the environment variable “__GL_MaxFramesAllowed” so
+ * that it matches our expectations.
+ *
+ * This must be set before libGL is loaded, hence before gtk_init().
+ *
+ * Taken from similar patch posted by NVIDIA developer for kwin:
+ * https://phabricator.kde.org/D19867
+ */
+ g_setenv("__GL_MaxFramesAllowed", "1", TRUE);
+#endif /* HAVE_EPOXY */
+
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
/* xfwm4 is an X11 window manager, no point in trying to connect to
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list