mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-21 14:52:04 +00:00
[client] egl: remove blocking waits from frame submission
Track PBO fences per upload slot and wait only when a slot is reused, allowing rendering to proceed without a CPU stall. Use GPU-side waits for cross-context DMABUF synchronization. Also propagate KVMFR write-completion failures so incomplete shared-memory frames are never submitted, while retaining incremental damage-copy waits to avoid added latency.
This commit is contained in:
@@ -85,15 +85,17 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||
|
||||
DEBUG_ASSERT(update->type == EGL_TEXTYPE_FRAMEBUFFER);
|
||||
|
||||
LG_LOCK(parent->copyLock);
|
||||
if (!egl_texBufferStreamLock(parent))
|
||||
return false;
|
||||
|
||||
struct TexDamage * damage = this->damage + parent->bufIndex;
|
||||
bool damageAll = !update->rects || update->rectCount == 0 || damage->count < 0 ||
|
||||
damage->count + update->rectCount > KVMFR_MAX_DAMAGE_RECTS;
|
||||
bool complete;
|
||||
|
||||
if (damageAll)
|
||||
{
|
||||
framebuffer_read(
|
||||
complete = framebuffer_read(
|
||||
update->frame,
|
||||
parent->buf[parent->bufIndex].map,
|
||||
texture->format.pitch,
|
||||
@@ -122,7 +124,7 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||
scaledDamageRects[i] = rect;
|
||||
}
|
||||
|
||||
rectsFramebufferToBuffer(
|
||||
complete = rectsFramebufferToBuffer(
|
||||
scaledDamageRects,
|
||||
damage->count,
|
||||
texture->format.bpp,
|
||||
@@ -135,7 +137,7 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||
}
|
||||
else
|
||||
{
|
||||
rectsFramebufferToBuffer(
|
||||
complete = rectsFramebufferToBuffer(
|
||||
damage->rects,
|
||||
damage->count,
|
||||
texture->format.bpp,
|
||||
@@ -148,6 +150,16 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||
}
|
||||
}
|
||||
|
||||
if (unlikely(!complete))
|
||||
{
|
||||
/* The mapped PBO may contain a partial copy. Force a full refresh if the
|
||||
* caller recovers, and never expose this slot to the render context. */
|
||||
damage->count = -1;
|
||||
parent->buf[parent->bufIndex].updated = false;
|
||||
LG_UNLOCK(parent->copyLock);
|
||||
return false;
|
||||
}
|
||||
|
||||
parent->buf[parent->bufIndex].updated = true;
|
||||
|
||||
for (int i = 0; i < EGL_TEX_BUFFER_MAX; ++i)
|
||||
|
||||
Reference in New Issue
Block a user