diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-12-31 14:39:40 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-12-31 14:39:40 +0000 |
| commit | 5a074190960130b6136a398d83da43fd1e8ec7e2 (patch) | |
| tree | 77a5b8ce40d8749c405958c398d26b6c22d07070 /main.c | |
| parent | main: let getopt_long() print error message (diff) | |
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.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -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; |
