[client] expose EGL stages in frame latency

Correlate received frames with the texture update actually consumed by
the renderer and retain damage until its token becomes renderable.

Split client latency into dispatch, import, queue, preparation, setup,
effects, desktop, composition, and swap stages in FRAME LATENCY.
Exclude diagnostic overlay work from composition and preserve client
wait time when producer timing is unavailable.

Publish joined samples through a bounded token queue, avoid sleeping
while producer timing is finalized, and correct Wayland photon units.
This commit is contained in:
Geoffrey McRae
2026-08-03 23:25:25 +10:00
parent 6109501eed
commit fbe08d00ce
21 changed files with 897 additions and 349 deletions

View File

@@ -160,12 +160,14 @@ bool egl_textureUpdateRect(EGL_Texture * this,
}
bool egl_textureUpdateFromFrame(EGL_Texture * this,
const FrameBuffer * frame, const FrameDamageRect * damageRects,
int damageRectsCount, uint64_t * waitTimeNs)
const FrameBuffer * frame, LG_RendererFrameToken frameToken,
const FrameDamageRect * damageRects, int damageRectsCount,
uint64_t * waitTimeNs)
{
const struct EGL_TexUpdate update =
{
.type = EGL_TEXTYPE_FRAMEBUFFER,
.frameToken = frameToken,
.x = 0,
.y = 0,
.width = this->format.width,
@@ -182,18 +184,20 @@ bool egl_textureUpdateFromFrame(EGL_Texture * this,
}
bool egl_textureUpdateFromDMA(EGL_Texture * this,
const FrameBuffer * frame, const int dmaFd, uint64_t * waitTimeNs)
const FrameBuffer * frame, LG_RendererFrameToken frameToken,
const int dmaFd, uint64_t * waitTimeNs)
{
const struct EGL_TexUpdate update =
{
.type = EGL_TEXTYPE_DMABUF,
.x = 0,
.y = 0,
.width = this->format.width,
.height = this->format.height,
.pitch = this->format.pitch,
.stride = this->format.stride,
.dmaFD = dmaFd
.type = EGL_TEXTYPE_DMABUF,
.frameToken = frameToken,
.x = 0,
.y = 0,
.width = this->format.width,
.height = this->format.height,
.pitch = this->format.pitch,
.stride = this->format.stride,
.dmaFD = dmaFd
};
/* wait for completion */
@@ -204,9 +208,18 @@ bool egl_textureUpdateFromDMA(EGL_Texture * this,
return this->ops.update(this, &update);
}
enum EGL_TexStatus egl_textureProcess(EGL_Texture * this)
enum EGL_TexStatus egl_textureProcess(EGL_Texture * this,
LG_RendererFrameToken frameTokenLimit,
LG_RendererFrameToken * consumedFrameToken)
{
return this->ops.process(this);
if (consumedFrameToken)
*consumedFrameToken = LG_RENDERER_FRAME_TOKEN_NONE;
const enum EGL_TexStatus status =
this->ops.process(this, frameTokenLimit);
if (status == EGL_TEX_STATUS_UPDATED && consumedFrameToken)
*consumedFrameToken = this->frameToken;
return status;
}
enum EGL_TexStatus egl_textureBind(EGL_Texture * this)