From 752b1df6596fde6ce9b30fbea5af80f454216da1 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 24 Oct 2019 14:39:25 +0200 Subject: [PATCH] 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 b9ceac34b..663873cde 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -1309,7 +1309,11 @@ shell_app_launch (ShellApp *app, context = shell_global_create_app_launch_context (global, timestamp, workspace); /* FIXME: this should probably check whether we're on a dual-GPU system */ if (get_with_discrete_gpu (app, 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