From 679da47235b4c4d523d7f3e3b8ccac1f8a9a6891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 31 Aug 2015 13:54:50 +0200 Subject: [PATCH] [wayland] Don't run Compositor loop if all outputs are disabled This ensures that the Compositor doesn't perform compositing and doesn't run the compositing timer if e.g. all outputs are dpms disabled. Thus we don't render any more, don't trigger wakeups and block applications from rendering if they properly implement the frame rendered callback. --- composite.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/composite.cpp b/composite.cpp index 4b81c97be7..e1f1856517 100644 --- a/composite.cpp +++ b/composite.cpp @@ -640,6 +640,13 @@ void Compositor::performCompositing() return; } + // If outputs are disabled, we return to the event loop and + // continue processing events until the outputs are enabled again + if (waylandServer() && !waylandServer()->backend()->areOutputsEnabled()) { + compositeTimer.stop(); + return; + } + // Create a list of all windows in the stacking order ToplevelList windows = Workspace::self()->xStackingOrder(); ToplevelList damaged; @@ -773,6 +780,11 @@ void Compositor::setCompositeTimer() if (m_bufferSwapPending && m_composeAtSwapCompletion) return; + // Don't start the timer if all outputs are disabled + if (waylandServer() && !waylandServer()->backend()->areOutputsEnabled()) { + return; + } + uint waitTime = 1; if (m_scene->blocksForRetrace()) {