2018-11-03 18:15:38 -04:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) 2018 Yuxuan Shui <yshuiv7@gmail.com>
|
|
|
|
|
2019-01-20 16:15:20 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <xcb/xcb.h>
|
2020-03-11 15:15:26 -04:00
|
|
|
#include <xcb/composite.h>
|
2019-01-20 16:15:20 -05:00
|
|
|
|
2019-04-19 19:21:38 -04:00
|
|
|
#include "backend/driver.h"
|
2018-11-03 18:15:38 -04:00
|
|
|
#include "diagnostic.h"
|
2019-01-18 18:30:44 -05:00
|
|
|
#include "config.h"
|
2020-03-11 15:15:26 -04:00
|
|
|
#include "picom.h"
|
2018-11-03 18:15:38 -04:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-03-11 15:15:26 -04:00
|
|
|
void print_diagnostics(session_t *ps, const char *config_file, bool compositor_running) {
|
2018-11-03 18:15:38 -04:00
|
|
|
printf("**Version:** " COMPTON_VERSION "\n");
|
|
|
|
//printf("**CFLAGS:** %s\n", "??");
|
|
|
|
printf("\n### Extensions:\n\n");
|
|
|
|
printf("* Shape: %s\n", ps->shape_exists ? "Yes" : "No");
|
|
|
|
printf("* XRandR: %s\n", ps->randr_exists ? "Yes" : "No");
|
|
|
|
printf("* Present: %s\n", ps->present_exists ? "Present" : "Not Present");
|
|
|
|
printf("\n### Misc:\n\n");
|
2020-10-19 23:10:11 -04:00
|
|
|
printf("* Use Overlay: %s\n", ps->overlay != XCB_NONE ? "Yes" : "No");
|
2020-03-11 15:15:26 -04:00
|
|
|
if (ps->overlay == XCB_NONE) {
|
|
|
|
if (compositor_running) {
|
2020-12-22 22:11:25 -05:00
|
|
|
printf(" (Another compositor is already running)\n");
|
2020-03-11 15:15:26 -04:00
|
|
|
} else if (session_redirection_mode(ps) != XCB_COMPOSITE_REDIRECT_MANUAL) {
|
2020-12-22 22:11:25 -05:00
|
|
|
printf(" (Not in manual redirection mode)\n");
|
2020-03-11 15:15:26 -04:00
|
|
|
} else {
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
2018-11-03 18:15:38 -04:00
|
|
|
#ifdef __FAST_MATH__
|
|
|
|
printf("* Fast Math: Yes\n");
|
|
|
|
#endif
|
2019-02-07 17:29:24 -05:00
|
|
|
printf("* Config file used: %s\n", config_file ?: "None");
|
2019-04-19 19:21:38 -04:00
|
|
|
printf("\n### Drivers (inaccurate):\n\n");
|
|
|
|
print_drivers(ps->drivers);
|
2020-12-22 22:11:25 -05:00
|
|
|
|
|
|
|
for (int i = 0; i < NUM_BKEND; i++) {
|
|
|
|
if (backend_list[i] && backend_list[i]->diagnostics) {
|
|
|
|
printf("\n### Backend: %s\n\n", BACKEND_STRS[i]);
|
|
|
|
auto data = backend_list[i]->init(ps);
|
|
|
|
if (!data) {
|
|
|
|
printf(" Cannot initialize this backend\n");
|
|
|
|
} else {
|
|
|
|
backend_list[i]->diagnostics(data);
|
|
|
|
backend_list[i]->deinit(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-11-03 18:15:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// vim: set noet sw=8 ts=8 :
|