From 09893fd728a8ff757c330a53b4dd334dcd4b67df Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 17 Jul 2021 22:57:15 -0400 Subject: [PATCH] [client] wayland: display swap to photon latency graph --- client/displayservers/Wayland/presentation.c | 12 ++++++------ client/displayservers/Wayland/wayland.h | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/client/displayservers/Wayland/presentation.c b/client/displayservers/Wayland/presentation.c index 7ccd355a..657eeb2d 100644 --- a/client/displayservers/Wayland/presentation.c +++ b/client/displayservers/Wayland/presentation.c @@ -63,12 +63,7 @@ static void presentationFeedbackPresented(void * opaque, struct timespec delta; tsDiff(&delta, &present, &data->sent); - printf("Presented in %3jd.%06lums, vsync: %d, hw_clock: %d, hw_compl: %d, zero_copy: %d\n", - (intmax_t) delta.tv_sec * 1000 + delta.tv_nsec / 1000000, delta.tv_nsec % 1000000, - (bool) (flags & WP_PRESENTATION_FEEDBACK_KIND_VSYNC), - (bool) (flags & WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK), - (bool) (flags & WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION), - (bool) (flags & WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY)); + ringbuffer_push(wlWm.photonTimings, &(float){ delta.tv_sec + delta.tv_nsec * 1e-6f }); free(data); } @@ -86,6 +81,9 @@ static const struct wp_presentation_feedback_listener presentationFeedbackListen bool waylandPresentationInit(void) { + wlWm.photonTimings = ringbuffer_new(256, sizeof(float)); + wlWm.photonGraph = app_registerGraph("PHOTON", wlWm.photonTimings); + if (wlWm.presentation) wp_presentation_add_listener(wlWm.presentation, &presentationListener, NULL); return true; @@ -94,6 +92,8 @@ bool waylandPresentationInit(void) void waylandPresentationFree(void) { wp_presentation_destroy(wlWm.presentation); + app_unregisterGraph(wlWm.photonGraph); + ringbuffer_free(&wlWm.photonTimings); } void waylandPresentationFrame(void) diff --git a/client/displayservers/Wayland/wayland.h b/client/displayservers/Wayland/wayland.h index 9a9a042b..5cabe320 100644 --- a/client/displayservers/Wayland/wayland.h +++ b/client/displayservers/Wayland/wayland.h @@ -29,9 +29,11 @@ # include #endif +#include "app.h" #include "egl_dynprocs.h" #include "common/locking.h" #include "common/countedbuffer.h" +#include "common/ringbuffer.h" #include "interface/displayserver.h" #include "wayland-xdg-shell-client-protocol.h" @@ -113,6 +115,8 @@ struct WaylandDSState struct wp_presentation * presentation; clockid_t clkId; + RingBuffer photonTimings; + GraphHandle photonGraph; #ifdef ENABLE_LIBDECOR struct libdecor * libdecor;