From 5676a076fde0ee80a829bcb112823d9910ad6614 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 1 Apr 2026 22:37:12 -0500 Subject: [PATCH] Fix overlay plane selection on drivers without zpos properties --- app/streaming/video/ffmpeg-renderers/drm.cpp | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/streaming/video/ffmpeg-renderers/drm.cpp b/app/streaming/video/ffmpeg-renderers/drm.cpp index c546d9f1..55146721 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.cpp +++ b/app/streaming/video/ffmpeg-renderers/drm.cpp @@ -644,6 +644,12 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) else if (auto zpos = props.property("zpos")) { activePlanesZpos.emplace(zpos->initialValue()); } + else { + // If there's no zpos property (which if true for one plane, must be true for all), + // Z-order is determined by enumeration order. Pretend that the plane index is the + // (immutable) zpos value in this scenario. + activePlanesZpos.emplace(i); + } } } @@ -774,7 +780,15 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) } } else { - m_VideoPlaneZpos = 0; + // Use the plane index for DRM drivers without zpos support + if (!activePlanesZpos.empty() && i < *activePlanesZpos.crbegin()) { + // This plane is too low to be visible + drmModeFreePlane(plane); + continue; + } + else { + m_VideoPlaneZpos = i; + } } SDL_assert(!m_VideoPlane.isValid()); @@ -860,6 +874,14 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) continue; } } + else { + // Use the plane index for DRM drivers without zpos support + if (i <= m_VideoPlaneZpos) { + // This plane is too low to be visible + drmModeFreePlane(plane); + continue; + } + } // Allocate this overlay plane to the next unused overlay slot SDL_assert(!m_OverlayPlanes[overlayIndex].isValid());