diff options
Diffstat (limited to 'sway/main.c')
-rw-r--r-- | sway/main.c | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/sway/main.c b/sway/main.c index 0c219fb3..264fa847 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <sys/un.h> | 12 | #include <sys/un.h> |
13 | #include <unistd.h> | 13 | #include <unistd.h> |
14 | #include <wlr/util/log.h> | 14 | #include <wlr/util/log.h> |
15 | #include <wlr/version.h> | ||
15 | #include "sway/commands.h" | 16 | #include "sway/commands.h" |
16 | #include "sway/config.h" | 17 | #include "sway/config.h" |
17 | #include "sway/server.h" | 18 | #include "sway/server.h" |
@@ -46,43 +47,6 @@ void sig_handler(int signal) { | |||
46 | sway_terminate(EXIT_SUCCESS); | 47 | sway_terminate(EXIT_SUCCESS); |
47 | } | 48 | } |
48 | 49 | ||
49 | void detect_raspi(void) { | ||
50 | bool raspi = false; | ||
51 | FILE *f = fopen("/sys/firmware/devicetree/base/model", "r"); | ||
52 | if (!f) { | ||
53 | return; | ||
54 | } | ||
55 | char *line = NULL; | ||
56 | size_t line_size = 0; | ||
57 | while (getline(&line, &line_size, f) != -1) { | ||
58 | if (strstr(line, "Raspberry Pi")) { | ||
59 | raspi = true; | ||
60 | break; | ||
61 | } | ||
62 | } | ||
63 | fclose(f); | ||
64 | FILE *g = fopen("/proc/modules", "r"); | ||
65 | if (!g) { | ||
66 | free(line); | ||
67 | return; | ||
68 | } | ||
69 | bool vc4 = false; | ||
70 | while (getline(&line, &line_size, g) != -1) { | ||
71 | if (strstr(line, "vc4")) { | ||
72 | vc4 = true; | ||
73 | break; | ||
74 | } | ||
75 | } | ||
76 | free(line); | ||
77 | fclose(g); | ||
78 | if (!vc4 && raspi) { | ||
79 | fprintf(stderr, "\x1B[1;31mWarning: You have a " | ||
80 | "Raspberry Pi, but the vc4 Module is " | ||
81 | "not loaded! Set 'dtoverlay=vc4-kms-v3d'" | ||
82 | "in /boot/config.txt and reboot.\x1B[0m\n"); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | void detect_proprietary(int allow_unsupported_gpu) { | 50 | void detect_proprietary(int allow_unsupported_gpu) { |
87 | FILE *f = fopen("/proc/modules", "r"); | 51 | FILE *f = fopen("/proc/modules", "r"); |
88 | if (!f) { | 52 | if (!f) { |
@@ -99,7 +63,7 @@ void detect_proprietary(int allow_unsupported_gpu) { | |||
99 | sway_log(SWAY_ERROR, | 63 | sway_log(SWAY_ERROR, |
100 | "Proprietary Nvidia drivers are NOT supported. " | 64 | "Proprietary Nvidia drivers are NOT supported. " |
101 | "Use Nouveau. To launch sway anyway, launch with " | 65 | "Use Nouveau. To launch sway anyway, launch with " |
102 | "--my-next-gpu-wont-be-nvidia and DO NOT report issues."); | 66 | "--unsupported-gpu and DO NOT report issues."); |
103 | exit(EXIT_FAILURE); | 67 | exit(EXIT_FAILURE); |
104 | } | 68 | } |
105 | break; | 69 | break; |
@@ -218,6 +182,8 @@ void enable_debug_flag(const char *flag) { | |||
218 | debug.txn_timings = true; | 182 | debug.txn_timings = true; |
219 | } else if (strncmp(flag, "txn-timeout=", 12) == 0) { | 183 | } else if (strncmp(flag, "txn-timeout=", 12) == 0) { |
220 | server.txn_timeout_ms = atoi(&flag[12]); | 184 | server.txn_timeout_ms = atoi(&flag[12]); |
185 | } else if (strcmp(flag, "noscanout") == 0) { | ||
186 | debug.noscanout = true; | ||
221 | } else { | 187 | } else { |
222 | sway_log(SWAY_ERROR, "Unknown debug flag: %s", flag); | 188 | sway_log(SWAY_ERROR, "Unknown debug flag: %s", flag); |
223 | } | 189 | } |
@@ -245,7 +211,7 @@ static void handle_wlr_log(enum wlr_log_importance importance, | |||
245 | int main(int argc, char **argv) { | 211 | int main(int argc, char **argv) { |
246 | static int verbose = 0, debug = 0, validate = 0, allow_unsupported_gpu = 0; | 212 | static int verbose = 0, debug = 0, validate = 0, allow_unsupported_gpu = 0; |
247 | 213 | ||
248 | static struct option long_options[] = { | 214 | static const struct option long_options[] = { |
249 | {"help", no_argument, NULL, 'h'}, | 215 | {"help", no_argument, NULL, 'h'}, |
250 | {"config", required_argument, NULL, 'c'}, | 216 | {"config", required_argument, NULL, 'c'}, |
251 | {"validate", no_argument, NULL, 'C'}, | 217 | {"validate", no_argument, NULL, 'C'}, |
@@ -254,7 +220,6 @@ int main(int argc, char **argv) { | |||
254 | {"verbose", no_argument, NULL, 'V'}, | 220 | {"verbose", no_argument, NULL, 'V'}, |
255 | {"get-socketpath", no_argument, NULL, 'p'}, | 221 | {"get-socketpath", no_argument, NULL, 'p'}, |
256 | {"unsupported-gpu", no_argument, NULL, 'u'}, | 222 | {"unsupported-gpu", no_argument, NULL, 'u'}, |
257 | {"my-next-gpu-wont-be-nvidia", no_argument, NULL, 'u'}, | ||
258 | {0, 0, 0, 0} | 223 | {0, 0, 0, 0} |
259 | }; | 224 | }; |
260 | 225 | ||
@@ -344,11 +309,11 @@ int main(int argc, char **argv) { | |||
344 | } | 309 | } |
345 | 310 | ||
346 | sway_log(SWAY_INFO, "Sway version " SWAY_VERSION); | 311 | sway_log(SWAY_INFO, "Sway version " SWAY_VERSION); |
312 | sway_log(SWAY_INFO, "wlroots version " WLR_VERSION_STR); | ||
347 | log_kernel(); | 313 | log_kernel(); |
348 | log_distro(); | 314 | log_distro(); |
349 | log_env(); | 315 | log_env(); |
350 | detect_proprietary(allow_unsupported_gpu); | 316 | detect_proprietary(allow_unsupported_gpu); |
351 | detect_raspi(); | ||
352 | 317 | ||
353 | if (optind < argc) { // Behave as IPC client | 318 | if (optind < argc) { // Behave as IPC client |
354 | if (optind != 1) { | 319 | if (optind != 1) { |