From 0a58af4fa1430f98457caada336f6805fd4db9db Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 5 Jan 2026 21:27:11 -0600 Subject: [PATCH] Allow plane selection overrides using environment variables --- app/streaming/video/ffmpeg-renderers/drm.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/streaming/video/ffmpeg-renderers/drm.cpp b/app/streaming/video/ffmpeg-renderers/drm.cpp index 87d2d5de..f7c6bb15 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.cpp +++ b/app/streaming/video/ffmpeg-renderers/drm.cpp @@ -654,6 +654,15 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) continue; } + { + // Allow the user to override the plane selection logic + uint32_t userPlane; + if (Utils::getEnvironmentVariableOverride("DRM_VIDEO_PLANE", &userPlane) && userPlane != planeRes->planes[i]) { + drmModeFreePlane(plane); + continue; + } + } + // We don't check plane->crtc_id here because we want to be able to reuse the primary plane // that may owned by Qt and in use on a CRTC prior to us taking over DRM master. When we give // control back to Qt, it will repopulate the plane with the FB it owns and render as normal. @@ -756,6 +765,16 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) continue; } + { + // Allow the user to override the plane selection logic + uint32_t userPlane; + QString optionVarName = QString("DRM_OVERLAY_PLANE%1").arg(overlayIndex); + if (Utils::getEnvironmentVariableOverride(optionVarName.toUtf8(), &userPlane) && userPlane != planeRes->planes[i]) { + drmModeFreePlane(plane); + continue; + } + } + DrmPropertyMap props { m_DrmFd, planeRes->planes[i], DRM_MODE_OBJECT_PLANE }; // Only consider overlay planes as valid targets if (auto type = props.property("type"); type->initialValue() != DRM_PLANE_TYPE_OVERLAY) {