From 6fdaa6ee8a05d105e6ee90cff8212f3d51b1a659 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 24 Apr 2022 16:48:21 -0500 Subject: [PATCH] Avoid modesetting if the display didn't change --- app/streaming/session.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 2704ccc1..30bf65c4 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -1662,8 +1662,11 @@ void Session::execInternal() flushWindowEvents(); // Update the window display mode based on our current monitor - currentDisplayIndex = SDL_GetWindowDisplayIndex(m_Window); - updateOptimalWindowDisplayMode(); + // NB: Avoid a useless modeset by only doing this if it changed. + if (currentDisplayIndex != SDL_GetWindowDisplayIndex(m_Window)) { + currentDisplayIndex = SDL_GetWindowDisplayIndex(m_Window); + updateOptimalWindowDisplayMode(); + } // Now that the old decoder is dead, flush any events it may // have queued to reset itself (if this reset was the result