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());