diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-10-24 20:29:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-24 20:29:06 -0400 |
commit | d75ee3f9ce1e7143375252cc86aeccbbc752599b (patch) | |
tree | 4210724a73677c96984ab11c63a91a8aa2bb5f18 | |
parent | Merge pull request #1427 from ranisalt/patch-1 (diff) | |
parent | nvidia: Validate the nvidia_drm module options (diff) | |
download | sway-d75ee3f9ce1e7143375252cc86aeccbbc752599b.tar.gz sway-d75ee3f9ce1e7143375252cc86aeccbbc752599b.tar.zst sway-d75ee3f9ce1e7143375252cc86aeccbbc752599b.zip |
Merge pull request #1430 from dlrobertson/nvidia_drm
nvidia: Validate the nvidia_drm module options
-rw-r--r-- | sway/main.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sway/main.c b/sway/main.c index 6d13955c..cc9147b8 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -135,6 +135,29 @@ void detect_proprietary() { | |||
135 | "You need nvidia, nvidia_modeset, nvidia_uvm, and nvidia_drm." | 135 | "You need nvidia, nvidia_modeset, nvidia_uvm, and nvidia_drm." |
136 | "\x1B[0m\n"); | 136 | "\x1B[0m\n"); |
137 | } | 137 | } |
138 | #ifdef __linux__ | ||
139 | f = fopen("/sys/module/nvidia_drm/parameters/modeset", "r"); | ||
140 | if (f) { | ||
141 | char *line = read_line(f); | ||
142 | if (line && strstr(line, "Y")) { | ||
143 | // nvidia-drm.modeset is set to 0 | ||
144 | fprintf(stderr, "\x1B[1;31mWarning: You must load " | ||
145 | "nvidia-drm with the modeset option on to use " | ||
146 | "the proprietary driver. Consider adding " | ||
147 | "nvidia-drm.modeset=1 to your kernel command line " | ||
148 | "parameters.\x1B[0m\n"); | ||
149 | } | ||
150 | fclose(f); | ||
151 | free(line); | ||
152 | } else { | ||
153 | // nvidia-drm.modeset is not set | ||
154 | fprintf(stderr, "\x1B[1;31mWarning: You must load " | ||
155 | "nvidia-drm with the modeset option on to use " | ||
156 | "the proprietary driver. Consider adding " | ||
157 | "nvidia-drm.modeset=1 to your kernel command line " | ||
158 | "parameters.\x1B[0m\n"); | ||
159 | } | ||
160 | #else | ||
138 | f = fopen("/proc/cmdline", "r"); | 161 | f = fopen("/proc/cmdline", "r"); |
139 | if (f) { | 162 | if (f) { |
140 | char *line = read_line(f); | 163 | char *line = read_line(f); |
@@ -146,6 +169,7 @@ void detect_proprietary() { | |||
146 | fclose(f); | 169 | fclose(f); |
147 | free(line); | 170 | free(line); |
148 | } | 171 | } |
172 | #endif | ||
149 | } | 173 | } |
150 | } | 174 | } |
151 | 175 | ||