[client] egl: fix streamed texture post-processing race
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled

This commit is contained in:
Geoffrey McRae
2026-07-31 14:15:17 +10:00
parent 08993d3e1e
commit fab9961c49
3 changed files with 13 additions and 8 deletions

View File

@@ -431,12 +431,14 @@ bool egl_desktopUpdate(EGL_Desktop * desktop, const FrameBuffer * frame, int dma
return false;
}
/*
* Streamed textures trigger post-processing when the render context submits
* the upload. Signalling here can race with that submission and process the
* previous texture contents instead.
*/
if (likely(egl_textureUpdateFromFrame(desktop->texture, frame,
damageRects, damageRectsCount)))
{
atomic_store(&desktop->processFrame, true);
return true;
}
return false;
}
@@ -474,8 +476,9 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
if (unlikely(outputWidth == 0 || outputHeight == 0))
DEBUG_FATAL("outputWidth || outputHeight == 0");
enum EGL_TexStatus status;
if (unlikely((status = egl_textureProcess(tex)) != EGL_TEX_STATUS_OK))
const enum EGL_TexStatus status = egl_textureProcess(tex);
const bool textureUpdated = status == EGL_TEX_STATUS_UPDATED;
if (unlikely(status != EGL_TEX_STATUS_OK && !textureUpdated))
{
if (status != EGL_TEX_STATUS_NOTREADY)
DEBUG_ERROR("Failed to process the desktop texture");
@@ -501,8 +504,9 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
HDR_PEAK_LUMINANCE_MIN, HDR_PEAK_LUMINANCE_MAX);
}
const bool processFrame = atomic_exchange(&desktop->processFrame, false) ||
egl_postProcessConfigModified(desktop->pp);
bool processFrame = textureUpdated;
processFrame |= atomic_exchange(&desktop->processFrame, false);
processFrame |= egl_postProcessConfigModified(desktop->pp);
if (processFrame &&
egl_postProcessRun(desktop->pp, tex, desktop->mesh,
width, height, outputWidth, outputHeight, dma,

View File

@@ -48,6 +48,7 @@ typedef enum EGL_TexStatus
{
EGL_TEX_STATUS_NOTREADY,
EGL_TEX_STATUS_OK,
EGL_TEX_STATUS_UPDATED,
EGL_TEX_STATUS_ERROR
}
EGL_TexStatus;

View File

@@ -325,7 +325,7 @@ EGL_TexStatus egl_texBufferStreamProcess(EGL_Texture * texture)
if (keepLocked)
LG_UNLOCK(this->copyLock);
return EGL_TEX_STATUS_OK;
return EGL_TEX_STATUS_UPDATED;
}
EGL_TexStatus egl_texBufferStreamGet(EGL_Texture * texture, GLuint * tex,