aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c58
1 files changed, 8 insertions, 50 deletions
diff --git a/sway/main.c b/sway/main.c
index 85bc2f1c..1c4939aa 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -1,4 +1,3 @@
1#define _POSIX_C_SOURCE 200809L
2#include <getopt.h> 1#include <getopt.h>
3#include <pango/pangocairo.h> 2#include <pango/pangocairo.h>
4#include <signal.h> 3#include <signal.h>
@@ -49,44 +48,6 @@ void sig_handler(int signal) {
49 sway_terminate(EXIT_SUCCESS); 48 sway_terminate(EXIT_SUCCESS);
50} 49}
51 50
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 if (strstr(line, "fglrx")) {
74 if (allow_unsupported_gpu) {
75 sway_log(SWAY_ERROR,
76 "!!! Proprietary AMD drivers are in use !!!");
77 } else {
78 sway_log(SWAY_ERROR, "Proprietary AMD drivers do NOT support "
79 "Wayland. Use radeon. To try anyway, launch sway with "
80 "--unsupported-gpu and DO NOT report issues.");
81 exit(EXIT_FAILURE);
82 }
83 break;
84 }
85 }
86 free(line);
87 fclose(f);
88}
89
90void run_as_ipc_client(char *command, char *socket_path) { 51void run_as_ipc_client(char *command, char *socket_path) {
91 int socketfd = ipc_open_socket(socket_path); 52 int socketfd = ipc_open_socket(socket_path);
92 uint32_t len = strlen(command); 53 uint32_t len = strlen(command);
@@ -192,11 +153,7 @@ void restore_nofile_limit(void) {
192} 153}
193 154
194void enable_debug_flag(const char *flag) { 155void enable_debug_flag(const char *flag) {
195 if (strcmp(flag, "damage=highlight") == 0) { 156 if (strcmp(flag, "noatomic") == 0) {
196 debug.damage = DAMAGE_HIGHLIGHT;
197 } else if (strcmp(flag, "damage=rerender") == 0) {
198 debug.damage = DAMAGE_RERENDER;
199 } else if (strcmp(flag, "noatomic") == 0) {
200 debug.noatomic = true; 157 debug.noatomic = true;
201 } else if (strcmp(flag, "txn-wait") == 0) { 158 } else if (strcmp(flag, "txn-wait") == 0) {
202 debug.txn_wait = true; 159 debug.txn_wait = true;
@@ -204,8 +161,8 @@ void enable_debug_flag(const char *flag) {
204 debug.txn_timings = true; 161 debug.txn_timings = true;
205 } else if (strncmp(flag, "txn-timeout=", 12) == 0) { 162 } else if (strncmp(flag, "txn-timeout=", 12) == 0) {
206 server.txn_timeout_ms = atoi(&flag[12]); 163 server.txn_timeout_ms = atoi(&flag[12]);
207 } else if (strcmp(flag, "noscanout") == 0) { 164 } else if (strcmp(flag, "legacy-wl-drm") == 0) {
208 debug.noscanout = true; 165 debug.legacy_wl_drm = true;
209 } else { 166 } else {
210 sway_log(SWAY_ERROR, "Unknown debug flag: %s", flag); 167 sway_log(SWAY_ERROR, "Unknown debug flag: %s", flag);
211 } 168 }
@@ -255,7 +212,7 @@ static const char usage[] =
255 "\n"; 212 "\n";
256 213
257int main(int argc, char **argv) { 214int main(int argc, char **argv) {
258 static bool verbose = false, debug = false, validate = false, allow_unsupported_gpu = false; 215 static bool verbose = false, debug = false, validate = false;
259 216
260 char *config_path = NULL; 217 char *config_path = NULL;
261 218
@@ -363,7 +320,6 @@ int main(int argc, char **argv) {
363 return 0; 320 return 0;
364 } 321 }
365 322
366 detect_proprietary(allow_unsupported_gpu);
367 increase_nofile_limit(); 323 increase_nofile_limit();
368 324
369 // handle SIGTERM signals 325 // handle SIGTERM signals
@@ -375,12 +331,14 @@ int main(int argc, char **argv) {
375 331
376 sway_log(SWAY_INFO, "Starting sway version " SWAY_VERSION); 332 sway_log(SWAY_INFO, "Starting sway version " SWAY_VERSION);
377 333
378 root = root_create();
379
380 if (!server_init(&server)) { 334 if (!server_init(&server)) {
381 return 1; 335 return 1;
382 } 336 }
383 337
338 if (server.linux_dmabuf_v1) {
339 wlr_scene_set_linux_dmabuf_v1(root->root_scene, server.linux_dmabuf_v1);
340 }
341
384 if (validate) { 342 if (validate) {
385 bool valid = load_main_config(config_path, false, true); 343 bool valid = load_main_config(config_path, false, true);
386 free(config_path); 344 free(config_path);