mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 16:01:27 +00:00
Merge pull request #2896 from RyanDwyer/abort-proprietary
Abort if proprietary drivers are in use
This commit is contained in:
commit
a41b77ef29
35
sway/main.c
35
sway/main.c
|
@ -22,6 +22,7 @@
|
||||||
#include "sway/tree/root.h"
|
#include "sway/tree/root.h"
|
||||||
#include "sway/ipc-server.h"
|
#include "sway/ipc-server.h"
|
||||||
#include "ipc-client.h"
|
#include "ipc-client.h"
|
||||||
|
#include "log.h"
|
||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "stringop.h"
|
#include "stringop.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -81,7 +82,7 @@ void detect_raspi(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void detect_proprietary(void) {
|
void detect_proprietary(int allow_unsupported_gpu) {
|
||||||
FILE *f = fopen("/proc/modules", "r");
|
FILE *f = fopen("/proc/modules", "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
return;
|
return;
|
||||||
|
@ -92,15 +93,30 @@ void detect_proprietary(void) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strstr(line, "nvidia")) {
|
if (strstr(line, "nvidia")) {
|
||||||
fprintf(stderr, "\x1B[1;31mWarning: Proprietary Nvidia drivers are "
|
|
||||||
"NOT supported. Use Nouveau.\x1B[0m\n");
|
|
||||||
free(line);
|
free(line);
|
||||||
|
if (allow_unsupported_gpu) {
|
||||||
|
wlr_log(WLR_ERROR,
|
||||||
|
"!!! Proprietary Nvidia drivers are in use !!!");
|
||||||
|
} else {
|
||||||
|
wlr_log(WLR_ERROR,
|
||||||
|
"Proprietary Nvidia drivers are NOT supported. "
|
||||||
|
"Use Nouveau. To launch sway anyway, launch with "
|
||||||
|
"--my-next-gpu-wont-be-nvidia and DO NOT report issues.");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strstr(line, "fglrx")) {
|
if (strstr(line, "fglrx")) {
|
||||||
fprintf(stderr, "\x1B[1;31mWarning: Proprietary AMD drivers do "
|
|
||||||
"NOT support Wayland. Use radeon.\x1B[0m\n");
|
|
||||||
free(line);
|
free(line);
|
||||||
|
if (allow_unsupported_gpu) {
|
||||||
|
wlr_log(WLR_ERROR,
|
||||||
|
"!!! Proprietary AMD drivers are in use !!!");
|
||||||
|
} else {
|
||||||
|
wlr_log(WLR_ERROR, "Proprietary AMD drivers do NOT support "
|
||||||
|
"Wayland. Use radeon. To try anyway, launch sway with "
|
||||||
|
"--unsupported-gpu and DO NOT report issues.");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(line);
|
free(line);
|
||||||
|
@ -214,7 +230,7 @@ void enable_debug_flag(const char *flag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
static int verbose = 0, debug = 0, validate = 0;
|
static int verbose = 0, debug = 0, validate = 0, allow_unsupported_gpu = 0;
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
@ -224,6 +240,8 @@ int main(int argc, char **argv) {
|
||||||
{"version", no_argument, NULL, 'v'},
|
{"version", no_argument, NULL, 'v'},
|
||||||
{"verbose", no_argument, NULL, 'V'},
|
{"verbose", no_argument, NULL, 'V'},
|
||||||
{"get-socketpath", no_argument, NULL, 'p'},
|
{"get-socketpath", no_argument, NULL, 'p'},
|
||||||
|
{"unsupported-gpu", no_argument, NULL, 'u'},
|
||||||
|
{"my-next-gpu-wont-be-nvidia", no_argument, NULL, 'u'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -265,6 +283,9 @@ int main(int argc, char **argv) {
|
||||||
case 'D': // extended debug options
|
case 'D': // extended debug options
|
||||||
enable_debug_flag(optarg);
|
enable_debug_flag(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'u':
|
||||||
|
allow_unsupported_gpu = 1;
|
||||||
|
break;
|
||||||
case 'v': // version
|
case 'v': // version
|
||||||
fprintf(stdout, "sway version " SWAY_VERSION "\n");
|
fprintf(stdout, "sway version " SWAY_VERSION "\n");
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
@ -317,7 +338,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
log_kernel();
|
log_kernel();
|
||||||
log_distro();
|
log_distro();
|
||||||
detect_proprietary();
|
detect_proprietary(allow_unsupported_gpu);
|
||||||
detect_raspi();
|
detect_raspi();
|
||||||
|
|
||||||
drop_permissions();
|
drop_permissions();
|
||||||
|
|
Loading…
Reference in a new issue