[client] egl: fix SPICE video rendering to a HDR surface

If the last state had HDR enabled, the spice video surface was being
rendered as HDR even though the SPICE video content is SDR. This
corrects this.
This commit is contained in:
Geoffrey McRae
2026-07-19 06:33:59 +10:00
parent f8d9574709
commit 02751b10df
5 changed files with 93 additions and 25 deletions

View File

@@ -464,12 +464,13 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
egl_desktopRectsUpdate(desktop->mesh, rects, width, height);
*fullFrame = false;
const bool hdr = desktop->hdr && !desktop->useSpice;
const bool processFrame = atomic_exchange(&desktop->processFrame, false) ||
egl_postProcessConfigModified(desktop->pp);
if (processFrame &&
egl_postProcessRun(desktop->pp, tex, desktop->mesh,
width, height, outputWidth, outputHeight, dma,
desktop->hdr && desktop->hdrPQ) &&
hdr && desktop->hdrPQ) &&
egl_postProcessNeedsFullFrame(desktop->pp))
{
/* The filter output may have changed everywhere, but this only applies to
@@ -529,7 +530,7 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
egl_uniformMatrix3x2fv(shader->uTransform , 1, GL_FALSE, desktop->matrix);
egl_uniform1f (shader->uNVGain , desktop->nvGain);
egl_uniform1i (shader->uCBMode , desktop->cbMode);
egl_uniform1i (shader->uIsHDR , desktop->hdr);
egl_uniform1i (shader->uIsHDR , hdr);
egl_uniform1i (shader->uMapHDRtoSDR, desktop->mapHDRtoSDR && !desktop->nativeHDR);
egl_uniform1f (shader->uMapHDRGain , mapHDRGain);
egl_uniform1i (shader->uMapHDRPQ , desktop->hdrPQ);

View File

@@ -619,8 +619,8 @@ static bool egl_updateHDRState(struct Inst * this, bool force)
app_getProp(LG_DS_NATIVE_HDR, &nativeHDR);
const bool surfaceCompatible = this->format.hdrPQ ?
this->surfaceSupportsPQ : this->surfaceSupportsSCRGB;
const bool useNativeHDR = this->format.hdr && surfaceCompatible && nativeHDR &&
!app_getHDRDescFailed();
const bool useNativeHDR = !this->showSpice && this->format.hdr &&
surfaceCompatible && nativeHDR && !app_getHDRDescFailed();
if (!force && this->nativeHDR == useNativeHDR)
return false;