-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME #42846
Merged
matthewbauer
merged 1 commit into
NixOS:master
from
ambrop72:optimus-prime-config-master
Oct 4, 2018
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
pkgs/desktops/gnome-3/core/gdm/gdm-session-worker_forward-vars.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c | ||
index 9ef4c5b..94da834 100644 | ||
--- a/daemon/gdm-session-worker.c | ||
+++ b/daemon/gdm-session-worker.c | ||
@@ -1515,6 +1515,16 @@ gdm_session_worker_load_env_d (GdmSessionWorker *worker) | ||
g_object_unref (dir); | ||
} | ||
|
||
+static void | ||
+gdm_session_worker_forward_var (GdmSessionWorker *worker, char const *var) | ||
+{ | ||
+ char const *value = g_getenv(var); | ||
+ if (value != NULL) { | ||
+ g_debug ("forwarding %s= %s", var, value); | ||
+ gdm_session_worker_set_environment_variable(worker, var, value); | ||
+ } | ||
+} | ||
+ | ||
static gboolean | ||
gdm_session_worker_accredit_user (GdmSessionWorker *worker, | ||
GError **error) | ||
@@ -1559,6 +1569,9 @@ gdm_session_worker_accredit_user (GdmSessionWorker *worker, | ||
goto out; | ||
} | ||
|
||
+ gdm_session_worker_forward_var(worker, "GDM_X_SERVER_EXTRA_ARGS"); | ||
+ gdm_session_worker_forward_var(worker, "GDM_X_SESSION_WRAPPER"); | ||
+ | ||
gdm_session_worker_update_environment_from_passwd_info (worker, | ||
uid, | ||
gid, |
17 changes: 0 additions & 17 deletions
17
pkgs/desktops/gnome-3/core/gdm/gdm-session-worker_xserver-path.patch
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
pkgs/desktops/gnome-3/core/gdm/gdm-x-session_session-wrapper.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c | ||
index 88fe96f..b1b140a 100644 | ||
--- a/daemon/gdm-x-session.c | ||
+++ b/daemon/gdm-x-session.c | ||
@@ -664,18 +664,34 @@ spawn_session (State *state, | ||
state->session_command, | ||
NULL); | ||
} else { | ||
+ char const *session_wrapper; | ||
+ char *eff_session_command; | ||
int ret; | ||
char **argv; | ||
|
||
- ret = g_shell_parse_argv (state->session_command, | ||
+ session_wrapper = g_getenv("GDM_X_SESSION_WRAPPER"); | ||
+ if (session_wrapper != NULL) { | ||
+ char *quoted_wrapper = g_shell_quote(session_wrapper); | ||
+ eff_session_command = g_strjoin(" ", quoted_wrapper, state->session_command, NULL); | ||
+ g_free(quoted_wrapper); | ||
+ } else { | ||
+ eff_session_command = state->session_command; | ||
+ } | ||
+ | ||
+ ret = g_shell_parse_argv (eff_session_command, | ||
NULL, | ||
&argv, | ||
&error); | ||
|
||
+ if (session_wrapper != NULL) { | ||
+ g_free(eff_session_command); | ||
+ } | ||
+ | ||
if (!ret) { | ||
g_debug ("could not parse session arguments: %s", error->message); | ||
goto out; | ||
} | ||
+ | ||
subprocess = g_subprocess_launcher_spawnv (launcher, | ||
(const char * const *) argv, | ||
&error); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have
hardware.nvidiaOptimus
(currently only to disable optimus card). Perhaps you could combine namespaces into something likehardware.nvidia.optimus
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bumblebee might be worth integrating there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this, I put the three options into the
hardware.nvidia.optimus_prime
section because one enables the Optimus/PRIME feature and the other two define required parameters for using it (bus IDs). I wouldn't want to have this and the existing options likehardware.nvidiaOptimus.disable
(which I not familiar with) andhardware.bumblebee
all thrown in the same place. Maybe these two could be moved to somewhere underhardware.nvidia
since they are both NVidia related? Possibility:hardware.nvidia.disableOptimus
,hardware.nvidia.bumblebee
(also: Bumblebee is not a piece of hardware).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though we might indeed have an optimus subsection, ending up with:
hardware.nvidia.optimus.prime
hardware.nvidia.optimus.bumblebee
hardware.nvidia.optimus.disable
(but maybe there is a better name for this)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for hardware.nvidia.optimus.prime. And then eventually move hardware.nvidiaOptimus.disable to hardware.nvidia.optimus.disable, and hardware.bumblebee to hardware.nvidia.bumblebee. We can wait on the latter part though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at https://wiki.archlinux.org/index.php/NVIDIA_Optimus it appears there is another option where you use the proprietary NVIDIA drivers.