Debian Codegraph @

src/diagnostic.c

raw symbols SCIP
1 // SPDX-License-Identifier: MPL-2.0
2 // Copyright (c) 2018 Yuxuan Shui <[email protected]>
3
4 #include <stdio.h>
5 #include <xcb/composite.h>
6 #include <xcb/xcb.h>
7
8 #include "backend/backend.h"
9 #include "backend/driver.h"
10 #include "common.h"
11 #include "config.h"
12 #include "diagnostic.h"
13 #include "picom.h"
14
15 void print_diagnostics(session_t *ps, const char *config_file, bool compositor_running) {
16 printf("**Version:** " PICOM_FULL_VERSION "\n");
17 // printf("**CFLAGS:** %s\n", "??");
18 printf("\n### X extensions:\n\n");
19 printf("* GLX: %s\n", ps->c.e.has_glx ? "present" : "absent");
20 printf("* Present: %s\n", ps->c.e.has_present ? "present" : "absent");
21 printf("* RandR: %s\n", ps->c.e.has_randr ? "present" : "absent");
22 printf("* Shape: %s\n", ps->c.e.has_shape ? "present" : "absent");
23 printf("* Sync: %s\n", ps->c.e.has_sync ? "present" : "absent");
24 printf("\n### Misc:\n\n");
25 printf("* Use Overlay: %s\n", ps->overlay != XCB_NONE ? "Yes" : "No");
26 if (ps->overlay == XCB_NONE) {
27 if (compositor_running) {
28 printf(" (Another compositor is already running)\n");
29 } else if (session_redirection_mode(ps) != XCB_COMPOSITE_REDIRECT_MANUAL) {
30 printf(" (Not in manual redirection mode)\n");
31 } else {
32 printf("\n");
33 }
34 }
35 #ifdef __FAST_MATH__
36 printf("* Fast Math: Yes\n");
37 #endif
38 printf("* Config file specified: %s\n", config_file ?: "None");
39 printf("* Config file used: %s\n", ps->o.config_file_path ?: "None");
40 if (!list_is_empty(&ps->o.included_config_files)) {
41 printf("* Included config files:\n");
42 list_foreach(struct included_config_file, i, &ps->o.included_config_files,
43 siblings) {
44 printf(" - %s\n", i->path);
45 }
46 }
47 printf("\n### Drivers (inaccurate):\n\n");
48 print_drivers(ps->drivers);
49
50 for (auto i = backend_iter(); i; i = backend_iter_next(i)) {
51 auto backend_data = backend_init(i, ps, session_get_target_window(ps));
52 if (!backend_data) {
53 printf(" Cannot initialize backend %s\n", backend_name(i));
54 continue;
55 }
56 if (backend_data->ops.diagnostics) {
57 printf("\n### Backend: %s\n\n", backend_name(i));
58 backend_data->ops.diagnostics(backend_data);
59 }
60 backend_data->ops.deinit(backend_data);
61 }
62 }
63
64 // vim: set noet sw=8 ts=8 :