[client] report presentation cadence over LGMP

This commit is contained in:
Geoffrey McRae
2026-08-04 13:00:48 +10:00
parent 5626cfa55b
commit b23430b9a8
10 changed files with 335 additions and 0 deletions

View File

@@ -56,6 +56,8 @@ static void presentationFeedbackPresented(void * opaque,
uint32_t tvNsec, uint32_t refresh, uint32_t seqHi, uint32_t seqLo, uint32_t flags)
{
struct FrameData * data = opaque;
if (refresh)
atomic_store(&wlWm.presentationPeriod, refresh);
struct timespec present = {
.tv_sec = (uint64_t) tvSecHi << 32 | tvSecLo,
.tv_nsec = tvNsec,
@@ -69,6 +71,16 @@ static void presentationFeedbackPresented(void * opaque,
wp_presentation_feedback_destroy(feedback);
}
bool waylandGetFramePeriod(uint64_t * period)
{
const uint64_t value = atomic_load(&wlWm.presentationPeriod);
if (!value)
return false;
*period = value;
return true;
}
static void presentationFeedbackDiscarded(void * data,
struct wp_presentation_feedback * feedback)
{

View File

@@ -314,6 +314,7 @@ struct LG_DisplayServerOps LGDS_Wayland =
.waitFrame = waylandWaitFrame,
.skipFrame = waylandSkipFrame,
.stopWaitFrame = waylandStopWaitFrame,
.getFramePeriod = waylandGetFramePeriod,
.guestPointerUpdated = waylandGuestPointerUpdated,
.setPointer = waylandSetPointer,
.grabPointer = waylandGrabPointer,

View File

@@ -158,6 +158,7 @@ struct WaylandDSState
struct wp_presentation * presentation;
clockid_t clkId;
_Atomic(uint64_t) presentationPeriod;
RingBuffer photonTimings;
GraphHandle photonGraph;
@@ -399,6 +400,7 @@ bool waylandPollUnregister(int fd);
bool waylandPresentationInit(void);
void waylandPresentationFrame(void);
void waylandPresentationFree(void);
bool waylandGetFramePeriod(uint64_t * period);
// registry module
bool waylandRegistryInit(void);