aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2023-12-12 15:25:10 +0100
committerLibravatar Simon Zeni <simon@bl4ckb0ne.ca>2023-12-12 10:04:14 -0500
commitff07eab85b5c6b728ad3cc99d02e9f2ae8b9854f (patch)
treefc4aa760eafe3a14c37fd11d8743c3b54e31de9c /sway/main.c
parentDrop fglrx detection (diff)
downloadsway-ff07eab85b5c6b728ad3cc99d02e9f2ae8b9854f.tar.gz
sway-ff07eab85b5c6b728ad3cc99d02e9f2ae8b9854f.tar.zst
sway-ff07eab85b5c6b728ad3cc99d02e9f2ae8b9854f.zip
Detect Nvidia proprietary driver via drmGetVersion()
This is less punishing for users with the Nvidia driver loaded but not used by Sway (e.g. for CUDA).
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/sway/main.c b/sway/main.c
index 0db116d3..98aba7f2 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -49,32 +49,6 @@ void sig_handler(int signal) {
49 sway_terminate(EXIT_SUCCESS); 49 sway_terminate(EXIT_SUCCESS);
50} 50}
51 51
52void detect_proprietary(int allow_unsupported_gpu) {
53 FILE *f = fopen("/proc/modules", "r");
54 if (!f) {
55 return;
56 }
57 char *line = NULL;
58 size_t line_size = 0;
59 while (getline(&line, &line_size, f) != -1) {
60 if (strncmp(line, "nvidia ", 7) == 0) {
61 if (allow_unsupported_gpu) {
62 sway_log(SWAY_ERROR,
63 "!!! Proprietary Nvidia drivers are in use !!!");
64 } else {
65 sway_log(SWAY_ERROR,
66 "Proprietary Nvidia drivers are NOT supported. "
67 "Use Nouveau. To launch sway anyway, launch with "
68 "--unsupported-gpu and DO NOT report issues.");
69 exit(EXIT_FAILURE);
70 }
71 break;
72 }
73 }
74 free(line);
75 fclose(f);
76}
77
78void run_as_ipc_client(char *command, char *socket_path) { 52void run_as_ipc_client(char *command, char *socket_path) {
79 int socketfd = ipc_open_socket(socket_path); 53 int socketfd = ipc_open_socket(socket_path);
80 uint32_t len = strlen(command); 54 uint32_t len = strlen(command);
@@ -243,7 +217,7 @@ static const char usage[] =
243 "\n"; 217 "\n";
244 218
245int main(int argc, char **argv) { 219int main(int argc, char **argv) {
246 static bool verbose = false, debug = false, validate = false, allow_unsupported_gpu = false; 220 static bool verbose = false, debug = false, validate = false;
247 221
248 char *config_path = NULL; 222 char *config_path = NULL;
249 223
@@ -351,7 +325,6 @@ int main(int argc, char **argv) {
351 return 0; 325 return 0;
352 } 326 }
353 327
354 detect_proprietary(allow_unsupported_gpu);
355 increase_nofile_limit(); 328 increase_nofile_limit();
356 329
357 // handle SIGTERM signals 330 // handle SIGTERM signals