[gnome-shell/wip/hadess/add-nvidia-other-gpu-support] shell-app: Add discrete GPU support for NVidia drivers



commit 38de1d37a66f585638d53877baf91274fcb627b7
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Oct 24 14:39:25 2019 +0200

    shell-app: Add discrete GPU support for NVidia drivers
    
    Add the necessary environment variables that would make offloading to
    the NVidia "secondary" drivers work as expected.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1810

 src/shell-app.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index 33d5ec3a7a..1e22c30cda 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -1290,7 +1290,11 @@ shell_app_launch (ShellApp     *app,
   global = shell_global_get ();
   context = shell_global_create_app_launch_context (global, timestamp, workspace);
   if (discrete_gpu)
-    g_app_launch_context_setenv (context, "DRI_PRIME", "1");
+    {
+      g_app_launch_context_setenv (context, "DRI_PRIME", "1");
+      g_app_launch_context_setenv (context, "__NV_PRIME_RENDER_OFFLOAD", "1");
+      g_app_launch_context_setenv (context, "__GLX_VENDOR_LIBRARY_NAME", "nvidia");
+    }
 
   /* Set LEAVE_DESCRIPTORS_OPEN in order to use an optimized gspawn
    * codepath. The shell's open file descriptors should be marked CLOEXEC


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]