[common] kvmfr: report cadence hold and lead timing

This commit is contained in:
Geoffrey McRae
2026-08-06 17:14:29 +10:00
parent 1b78384da3
commit 0b744d2286
7 changed files with 59 additions and 20 deletions

View File

@@ -30,7 +30,7 @@
#include "LGMPConfig.h"
#define KVMFR_MAGIC "KVMFR---"
#define KVMFR_VERSION 28
#define KVMFR_VERSION 29
// Fallback used by producers that cannot report the source display's SDR
// white level. IDD frames override this with IDDCX_METADATA2::SdrWhiteLevel.
@@ -210,24 +210,23 @@ typedef struct KVMFRFrame
uint64_t captureTime;
uint64_t postProcessTime;
uint64_t copyTime;
// Time from copy completion until FrameBuffer::wp publishes readiness.
// Non-copy preparation and publication time, excluding cadence hold time.
uint64_t readyTime;
// Time a prepared frame waited for its cadence publication target.
uint64_t holdTime;
// Time remaining until the cadence deadline when the frame was published.
uint64_t readyLeadTime;
// Published after the timing fields and matched against frameSerial by the
// client. timingValid is written last by the producer.
uint32_t timingSerial;
uint32_t timingValid;
// Producer cadence identity. Phase feedback is permitted only when the
// matching frame has KVMFR_FRAME_TIMING_PHASE_VALID set.
KVMFRFrameTimingFlags timingFlags;
uint32_t scheduleGeneration;
uint32_t scheduleEpoch;
uint32_t scheduleDeadlineSerial;
// Keep the conditional HDR block and damage rectangles on separate cache
// lines from the producer timing fields.
uint8_t timingReserved[8];
uint8_t timingReserved[4];
// HDR static metadata (valid when FRAME_FLAG_HDR_METADATA is set)
// Display color primaries in 0.00002 units (SMPTE ST 2086 format)
@@ -242,7 +241,13 @@ typedef struct KVMFRFrame
uint32_t hdrMaxContentLightLevel; // MaxCLL (cd/m²)
uint32_t hdrMaxFrameAverageLightLevel; // MaxFALL (cd/m²)
uint8_t hdrReserved[32];
// Producer cadence identity. Phase feedback is permitted only when the
// matching frame has KVMFR_FRAME_TIMING_PHASE_VALID set.
uint32_t scheduleGeneration;
uint32_t scheduleEpoch;
uint32_t scheduleDeadlineSerial;
uint8_t hdrReserved[20];
FrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS];
}
@@ -251,9 +256,15 @@ KVMFRFrame;
#if defined(__cplusplus)
static_assert(offsetof(KVMFRFrame, captureTime) == 64,
"KVMFRFrame hot fields must fit in one cache line");
static_assert(offsetof(KVMFRFrame, timingFlags) == 104,
static_assert(offsetof(KVMFRFrame, holdTime) == 96,
"KVMFRFrame hold timing layout changed");
static_assert(offsetof(KVMFRFrame, readyLeadTime) == 104,
"KVMFRFrame ready lead timing layout changed");
static_assert(offsetof(KVMFRFrame, timingSerial) == 112,
"KVMFRFrame timing publication layout changed");
static_assert(offsetof(KVMFRFrame, timingFlags) == 120,
"KVMFRFrame timing flags layout changed");
static_assert(offsetof(KVMFRFrame, scheduleDeadlineSerial) == 116,
static_assert(offsetof(KVMFRFrame, scheduleDeadlineSerial) == 168,
"KVMFRFrame schedule identity layout changed");
static_assert(offsetof(KVMFRFrame, hdrDisplayPrimary) == 128,
"KVMFRFrame HDR metadata must be cache-line aligned");
@@ -262,9 +273,15 @@ static_assert(offsetof(KVMFRFrame, damageRects) == 192,
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
_Static_assert(offsetof(KVMFRFrame, captureTime) == 64,
"KVMFRFrame hot fields must fit in one cache line");
_Static_assert(offsetof(KVMFRFrame, timingFlags) == 104,
_Static_assert(offsetof(KVMFRFrame, holdTime) == 96,
"KVMFRFrame hold timing layout changed");
_Static_assert(offsetof(KVMFRFrame, readyLeadTime) == 104,
"KVMFRFrame ready lead timing layout changed");
_Static_assert(offsetof(KVMFRFrame, timingSerial) == 112,
"KVMFRFrame timing publication layout changed");
_Static_assert(offsetof(KVMFRFrame, timingFlags) == 120,
"KVMFRFrame timing flags layout changed");
_Static_assert(offsetof(KVMFRFrame, scheduleDeadlineSerial) == 116,
_Static_assert(offsetof(KVMFRFrame, scheduleDeadlineSerial) == 168,
"KVMFRFrame schedule identity layout changed");
_Static_assert(offsetof(KVMFRFrame, hdrDisplayPrimary) == 128,
"KVMFRFrame HDR metadata must be cache-line aligned");