aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-10-20 16:18:58 +0200
committerLibravatar GitHub <noreply@github.com>2018-10-20 16:18:58 +0200
commita41b77ef295326e94101da0c1d62832ab6a6ce7d (patch)
tree2adfa78d92b20deb061f192db2461c66c9a768fa
parentMerge pull request #2895 from RyanDwyer/fix-popup-damage (diff)
parentAbort if proprietary drivers are in use (diff)
downloadsway-a41b77ef295326e94101da0c1d62832ab6a6ce7d.tar.gz
sway-a41b77ef295326e94101da0c1d62832ab6a6ce7d.tar.zst
sway-a41b77ef295326e94101da0c1d62832ab6a6ce7d.zip
Merge pull request #2896 from RyanDwyer/abort-proprietary
Abort if proprietary drivers are in use
-rw-r--r--sway/main.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/sway/main.c b/sway/main.c
index 8d39d5f1..cc5f7187 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -22,6 +22,7 @@
22#include "sway/tree/root.h" 22#include "sway/tree/root.h"
23#include "sway/ipc-server.h" 23#include "sway/ipc-server.h"
24#include "ipc-client.h" 24#include "ipc-client.h"
25#include "log.h"
25#include "readline.h" 26#include "readline.h"
26#include "stringop.h" 27#include "stringop.h"
27#include "util.h" 28#include "util.h"
@@ -81,7 +82,7 @@ void detect_raspi(void) {
81 } 82 }
82} 83}
83 84
84void detect_proprietary(void) { 85void detect_proprietary(int allow_unsupported_gpu) {
85 FILE *f = fopen("/proc/modules", "r"); 86 FILE *f = fopen("/proc/modules", "r");
86 if (!f) { 87 if (!f) {
87 return; 88 return;
@@ -92,15 +93,30 @@ void detect_proprietary(void) {
92 break; 93 break;
93 } 94 }
94 if (strstr(line, "nvidia")) { 95 if (strstr(line, "nvidia")) {
95 fprintf(stderr, "\x1B[1;31mWarning: Proprietary Nvidia drivers are "
96 "NOT supported. Use Nouveau.\x1B[0m\n");
97 free(line); 96 free(line);
97 if (allow_unsupported_gpu) {
98 wlr_log(WLR_ERROR,
99 "!!! Proprietary Nvidia drivers are in use !!!");
100 } else {
101 wlr_log(WLR_ERROR,
102 "Proprietary Nvidia drivers are NOT supported. "
103 "Use Nouveau. To launch sway anyway, launch with "
104 "--my-next-gpu-wont-be-nvidia and DO NOT report issues.");
105 exit(EXIT_FAILURE);
106 }
98 break; 107 break;
99 } 108 }
100 if (strstr(line, "fglrx")) { 109 if (strstr(line, "fglrx")) {
101 fprintf(stderr, "\x1B[1;31mWarning: Proprietary AMD drivers do "
102 "NOT support Wayland. Use radeon.\x1B[0m\n");
103 free(line); 110 free(line);
111 if (allow_unsupported_gpu) {
112 wlr_log(WLR_ERROR,
113 "!!! Proprietary AMD drivers are in use !!!");
114 } else {
115 wlr_log(WLR_ERROR, "Proprietary AMD drivers do NOT support "
116 "Wayland. Use radeon. To try anyway, launch sway with "
117 "--unsupported-gpu and DO NOT report issues.");
118 exit(EXIT_FAILURE);
119 }
104 break; 120 break;
105 } 121 }
106 free(line); 122 free(line);
@@ -214,7 +230,7 @@ void enable_debug_flag(const char *flag) {
214} 230}
215 231
216int main(int argc, char **argv) { 232int main(int argc, char **argv) {
217 static int verbose = 0, debug = 0, validate = 0; 233 static int verbose = 0, debug = 0, validate = 0, allow_unsupported_gpu = 0;
218 234
219 static struct option long_options[] = { 235 static struct option long_options[] = {
220 {"help", no_argument, NULL, 'h'}, 236 {"help", no_argument, NULL, 'h'},
@@ -224,6 +240,8 @@ int main(int argc, char **argv) {
224 {"version", no_argument, NULL, 'v'}, 240 {"version", no_argument, NULL, 'v'},
225 {"verbose", no_argument, NULL, 'V'}, 241 {"verbose", no_argument, NULL, 'V'},
226 {"get-socketpath", no_argument, NULL, 'p'}, 242 {"get-socketpath", no_argument, NULL, 'p'},
243 {"unsupported-gpu", no_argument, NULL, 'u'},
244 {"my-next-gpu-wont-be-nvidia", no_argument, NULL, 'u'},
227 {0, 0, 0, 0} 245 {0, 0, 0, 0}
228 }; 246 };
229 247
@@ -265,6 +283,9 @@ int main(int argc, char **argv) {
265 case 'D': // extended debug options 283 case 'D': // extended debug options
266 enable_debug_flag(optarg); 284 enable_debug_flag(optarg);
267 break; 285 break;
286 case 'u':
287 allow_unsupported_gpu = 1;
288 break;
268 case 'v': // version 289 case 'v': // version
269 fprintf(stdout, "sway version " SWAY_VERSION "\n"); 290 fprintf(stdout, "sway version " SWAY_VERSION "\n");
270 exit(EXIT_SUCCESS); 291 exit(EXIT_SUCCESS);
@@ -317,7 +338,7 @@ int main(int argc, char **argv) {
317 338
318 log_kernel(); 339 log_kernel();
319 log_distro(); 340 log_distro();
320 detect_proprietary(); 341 detect_proprietary(allow_unsupported_gpu);
321 detect_raspi(); 342 detect_raspi();
322 343
323 drop_permissions(); 344 drop_permissions();