aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-10-24 20:29:06 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-10-30 17:23:27 -0400
commit1bc91e0a0949e429c96b1bc65a7222cb4797e0c9 (patch)
tree4210724a73677c96984ab11c63a91a8aa2bb5f18
parentMerge pull request #1427 from ranisalt/patch-1 (diff)
downloadsway-1bc91e0a0949e429c96b1bc65a7222cb4797e0c9.tar.gz
sway-1bc91e0a0949e429c96b1bc65a7222cb4797e0c9.tar.zst
sway-1bc91e0a0949e429c96b1bc65a7222cb4797e0c9.zip
Merge pull request #1430 from dlrobertson/nvidia_drm
nvidia: Validate the nvidia_drm module options
-rw-r--r--sway/main.c24
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