From 1e7cfc1d19018acc77bdcb2cf354945a26e01942 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 25 Aug 2024 15:41:00 +0000 Subject: [PATCH] Fix directScanout getting shadowed Amends 7ab825cba1458cc3d3f7d61925d9c0423d481835. This shadow "directScanout" variable breaks if (!directScanout) { if (!m_backend->present(output, frame)) { m_backend->repairPresentation(output); } } which can result in present() function getting called twice with the same `OutputFrame` object: first, at line 359, and the second time at line 386. That, in its turn, would queue two drm commit objects with the same OutputFrame and then the behavior is undefined. --- src/compositor_wayland.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compositor_wayland.cpp b/src/compositor_wayland.cpp index 9f16a5e0b7..4e1c7358cc 100644 --- a/src/compositor_wayland.cpp +++ b/src/compositor_wayland.cpp @@ -336,7 +336,6 @@ void WaylandCompositor::composite(RenderLoop *renderLoop) frame->setPresentationMode(tearing ? PresentationMode::Async : PresentationMode::VSync); } - bool directScanout = false; const uint32_t planeCount = 1; if (const auto scanoutCandidates = superLayer->delegate()->scanoutCandidates(planeCount + 1); !scanoutCandidates.isEmpty()) { const auto sublayers = superLayer->sublayers();