[client] wayland: display swap to photon latency graph

This commit is contained in:
Quantum 2021-07-17 22:57:15 -04:00 committed by Geoffrey McRae
parent e87bc3a83e
commit 09893fd728
2 changed files with 10 additions and 6 deletions

View File

@ -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)

View File

@ -29,9 +29,11 @@
# include <EGL/eglext.h>
#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;