From 1c6ed8f390464cb2879ddff322833d6b442c02db Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 5 Jan 2026 21:50:31 -0600 Subject: [PATCH] Remove atomic test-only commit This is currently race-prone because nothing is synchronizing between other Qt and SDL uses of DRM master, so it can cause false negatives if we can't retake master ourselves. --- app/streaming/video/ffmpeg-renderers/drm.cpp | 67 +------------------- 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/app/streaming/video/ffmpeg-renderers/drm.cpp b/app/streaming/video/ffmpeg-renderers/drm.cpp index f7c6bb15..64d43b72 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.cpp +++ b/app/streaming/video/ffmpeg-renderers/drm.cpp @@ -1365,8 +1365,8 @@ bool DrmRenderer::addFbForFrame(AVFrame *frame, uint32_t* newFbId, bool testMode drmFrame = (AVDRMFrameDescriptor*)frame->data[0]; } - // For non-atomic drivers, check the IN_FORMATS property or legacy plane formats - if (testMode && !m_PropSetter.isAtomic()) { + // If we're testing, check the IN_FORMATS property or legacy plane formats + if (testMode) { bool formatMatch = false; uint64_t maskedModifier = drmFrame->objects[0].format_modifier; @@ -1497,69 +1497,6 @@ bool DrmRenderer::addFbForFrame(AVFrame *frame, uint32_t* newFbId, bool testMode return false; } - // For atomic drivers, we'll use a test-only commit to confirm this plane+FB works - if (testMode && m_PropSetter.isAtomic()) { - SDL_Rect src, dst; - src.x = src.y = 0; - src.w = frame->width; - src.h = frame->height; - - // This isn't a completely accurate test since SDL hasn't modeset to the new - // display resolution that we'll actually be using for streaming (since we're - // still not committed to even using DrmRenderer for rendering yet). Hopefully, - // it will be good enough though. - dst.x = dst.y = 0; - drmModeCrtc* crtc = drmModeGetCrtc(m_DrmFd, m_Crtc.objectId()); - if (crtc != nullptr) { - dst.w = crtc->width; - dst.h = crtc->height; - drmModeFreeCrtc(crtc); - } - else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "drmModeGetCrtc() failed: %d", - errno); - - // We'll just hope for the best here - dst.w = frame->width; - dst.h = frame->height; - } - - StreamUtils::scaleSourceToDestinationSurface(&src, &dst); - - // Temporarily take DRM master if we dropped it after initialization - if (!m_DrmStateModified) { - drmSetMaster(m_DrmFd); - } - bool testResult = m_PropSetter.testPlane(m_VideoPlane, - m_Crtc.objectId(), - *newFbId, - dst.x, dst.y, - dst.w, dst.h, - 0, 0, - frame->width << 16, - frame->height << 16); - if (!m_DrmStateModified) { - drmDropMaster(m_DrmFd); - } - - if (testResult) { - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, - "Selected DRM plane supports chosen decoding format and modifier: " FOURCC_FMT " %016" PRIx64, - FOURCC_FMT_ARGS(drmFrame->layers[0].format), - drmFrame->objects[0].format_modifier); - } - else { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, - "Selected DRM plane doesn't support chosen decoding format and modifier: " FOURCC_FMT " %016" PRIx64, - FOURCC_FMT_ARGS(drmFrame->layers[0].format), - drmFrame->objects[0].format_modifier); - drmModeRmFB(m_DrmFd, *newFbId); - *newFbId = 0; - return false; - } - } - return true; }