mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-07 04:34:03 -05:00
wayland: optionally use the presentation time protocol to measure input lag
This adds a flag, -p,--presentation-timings, that enables input lag measuring using the presentation time Wayland protocol. When enabled, we store a timestamp when we *send* a key to the slave. Then, when we commit a frame for rendering to the compositor, we request presentation feedback. We also store a timestamp for when the frame was committed. The 'presented' callback then looks at the input and commit timestamps, and compares it with the presented timestamp. The delay is logged at INFO when the delay was less than one frame interval, at WARN when it was one frame interval, and at ERR when it was two or more frame intervals. We also update statistic counters that we log when foot is shut down.
This commit is contained in:
parent
ea1d072f52
commit
5a07419096
9 changed files with 187 additions and 11 deletions
25
main.c
25
main.c
|
|
@ -90,14 +90,15 @@ main(int argc, char *const *argv)
|
|||
const char *const prog_name = argv[0];
|
||||
|
||||
static const struct option longopts[] = {
|
||||
{"config", required_argument, NULL, 'c'},
|
||||
{"term", required_argument, NULL, 't'},
|
||||
{"font", required_argument, NULL, 'f'},
|
||||
{"geometry", required_argument, NULL, 'g'},
|
||||
{"server", optional_argument, NULL, 's'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{NULL, no_argument, NULL, 0},
|
||||
{"config", required_argument, NULL, 'c'},
|
||||
{"term", required_argument, NULL, 't'},
|
||||
{"font", required_argument, NULL, 'f'},
|
||||
{"geometry", required_argument, NULL, 'g'},
|
||||
{"server", optional_argument, NULL, 's'},
|
||||
{"presentation-timings", no_argument, NULL, 'p'}, /* Undocumented */
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{NULL, no_argument, NULL, 0},
|
||||
};
|
||||
|
||||
const char *conf_path = NULL;
|
||||
|
|
@ -107,9 +108,10 @@ main(int argc, char *const *argv)
|
|||
int conf_height = -1;
|
||||
bool as_server = false;
|
||||
const char *conf_server_socket_path = NULL;
|
||||
bool presentation_timings = false;
|
||||
|
||||
while (true) {
|
||||
int c = getopt_long(argc, argv, "c:tf:g:s::vh", longopts, NULL);
|
||||
int c = getopt_long(argc, argv, "c:tf:g:s::pvh", longopts, NULL);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
|
|
@ -162,6 +164,10 @@ main(int argc, char *const *argv)
|
|||
conf_server_socket_path = optarg;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
presentation_timings = true;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
printf("foot version %s\n", FOOT_VERSION);
|
||||
return EXIT_SUCCESS;
|
||||
|
|
@ -208,6 +214,7 @@ main(int argc, char *const *argv)
|
|||
free(conf.server_socket_path);
|
||||
conf.server_socket_path = strdup(conf_server_socket_path);
|
||||
}
|
||||
conf.presentation_timings = presentation_timings;
|
||||
|
||||
struct fdm *fdm = NULL;
|
||||
struct wayland *wayl = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue