[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:
Geoffrey McRae
2026-07-17 22:02:05 +10:00
parent e3616ed4b9
commit b2c40a80af
7 changed files with 161 additions and 101 deletions

View File

@@ -35,7 +35,7 @@ void rectsBufferToFramebuffer(FrameDamageRect * rects, int count, int bpp,
FrameBuffer * frame, int dstPitch, int height,
const uint8_t * src, int srcPitch);
void rectsFramebufferToBuffer(FrameDamageRect * rects, int count, int bpp,
bool rectsFramebufferToBuffer(FrameDamageRect * rects, int count, int bpp,
uint8_t * dst, int dstPitch, int height,
const FrameBuffer * frame, int srcPitch);

View File

@@ -85,10 +85,10 @@ static int cornerCompare(const void * a_, const void * b_)
return 0;
}
inline static void rectsBufferCopy(FrameDamageRect * rects, int count, int bpp,
inline static bool rectsBufferCopy(FrameDamageRect * rects, int count, int bpp,
uint8_t * dst, int dstStride, int height,
const uint8_t * src, int srcStride, void * opaque,
void (*rowCopyStart)(int y, void * opaque),
bool (*rowCopyStart)(int y, void * opaque),
void (*rowCopyFinish)(int y, void * opaque))
{
const int cornerCount = 4 * count;
@@ -138,8 +138,8 @@ inline static void rectsBufferCopy(FrameDamageRect * rects, int count, int bpp,
change[changes++] = (struct Edge) { .x = x, .delta = delta };
}
if (rowCopyStart)
rowCopyStart(y, opaque);
if (rowCopyStart && !rowCopyStart(y, opaque))
return false;
struct Edge * active = active_[activeRow];
int x1 = 0;
@@ -191,6 +191,8 @@ inline static void rectsBufferCopy(FrameDamageRect * rects, int count, int bpp,
rs = re;
activeRow ^= 1;
}
return true;
}
struct ToFramebufferData
@@ -221,18 +223,18 @@ struct FromFramebufferData
int pitch;
};
static void fbRowStart(int y, void * opaque)
static bool fbRowStart(int y, void * opaque)
{
struct FromFramebufferData * data = opaque;
framebuffer_wait(data->frame, y * data->pitch);
return framebuffer_wait(data->frame, y * data->pitch);
}
void rectsFramebufferToBuffer(FrameDamageRect * rects, int count, int bpp,
bool rectsFramebufferToBuffer(FrameDamageRect * rects, int count, int bpp,
uint8_t * dst, int dstPitch, int height,
const FrameBuffer * frame, int srcPitch)
{
struct FromFramebufferData data = { .frame = frame, .pitch = srcPitch };
rectsBufferCopy(rects, count, bpp, dst, dstPitch, height,
return rectsBufferCopy(rects, count, bpp, dst, dstPitch, height,
framebuffer_get_buffer(frame), srcPitch, &data, fbRowStart, NULL);
}