From b6407492c7b87822f7fac3440e2bfedd2d48ed11 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 28 Mar 2026 22:01:15 -0500 Subject: [PATCH] Move refreshDisplay() after test window creation SDL invalidates cached display modes after a window creation, so this avoids paying a second mode enumeration cost when the user enters the settings page. --- app/backend/systemproperties.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/backend/systemproperties.cpp b/app/backend/systemproperties.cpp index 1140c93e..7dd54e26 100644 --- a/app/backend/systemproperties.cpp +++ b/app/backend/systemproperties.cpp @@ -184,9 +184,6 @@ void SystemProperties::startAsyncLoad() return; } - // Update display related attributes (max FPS, native resolution, etc). - refreshDisplays(); - testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags()); if (!testWindow) { @@ -204,6 +201,13 @@ void SystemProperties::startAsyncLoad() } } + // Update display related attributes (max FPS, native resolution, etc). + // + // NB: SDL3 will forcefully refresh displays when a window is created, + // so we place this after the window creation to ensure we don't pay + // the penalty for mode enumeration twice. + refreshDisplays(); + systemPropertyQueryThread = new SystemPropertyQueryThread(this); systemPropertyQueryThread->start(); }