Fix overlay plane selection on drivers without zpos properties

This commit is contained in:
Cameron Gutman
2026-04-01 22:37:12 -05:00
parent b6407492c7
commit 5676a076fd

View File

@@ -644,6 +644,12 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params)
else if (auto zpos = props.property("zpos")) { else if (auto zpos = props.property("zpos")) {
activePlanesZpos.emplace(zpos->initialValue()); 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 { 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()); SDL_assert(!m_VideoPlane.isValid());
@@ -860,6 +874,14 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params)
continue; 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 // Allocate this overlay plane to the next unused overlay slot
SDL_assert(!m_OverlayPlanes[overlayIndex].isValid()); SDL_assert(!m_OverlayPlanes[overlayIndex].isValid());