Skip to content

Commit 9d5f25f

Browse files
committed
Don't use separate threads for querying SDL video info
This is no longer necessary now that we force Qt and SDL to use EGL.
1 parent d3c23b5 commit 9d5f25f

2 files changed

Lines changed: 1 addition & 62 deletions

File tree

app/backend/systemproperties.cpp

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -95,36 +95,7 @@ int SystemProperties::getRefreshRate(int displayIndex)
9595
return monitorRefreshRates.value(displayIndex);
9696
}
9797

98-
class QuerySdlVideoThread : public QThread
99-
{
100-
public:
101-
QuerySdlVideoThread(SystemProperties* me) :
102-
QThread(nullptr),
103-
m_Me(me) {}
104-
105-
void run() override
106-
{
107-
m_Me->querySdlVideoInfoInternal();
108-
}
109-
110-
SystemProperties* m_Me;
111-
};
112-
11398
void SystemProperties::querySdlVideoInfo()
114-
{
115-
if (WMUtils::isRunningX11() || WMUtils::isRunningWayland()) {
116-
// Use a separate thread to temporarily initialize SDL
117-
// video to avoid stomping on Qt's X11 and OGL state.
118-
QuerySdlVideoThread thread(this);
119-
thread.start();
120-
thread.wait();
121-
}
122-
else {
123-
querySdlVideoInfoInternal();
124-
}
125-
}
126-
127-
void SystemProperties::querySdlVideoInfoInternal()
12899
{
129100
hasHardwareAcceleration = false;
130101

@@ -136,8 +107,7 @@ void SystemProperties::querySdlVideoInfoInternal()
136107
}
137108

138109
// Update display related attributes (max FPS, native resolution, etc).
139-
// We call the internal variant because we're already in a safe thread context.
140-
refreshDisplaysInternal();
110+
refreshDisplays();
141111

142112
SDL_Window* testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
143113
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
@@ -163,36 +133,7 @@ void SystemProperties::querySdlVideoInfoInternal()
163133
SDL_QuitSubSystem(SDL_INIT_VIDEO);
164134
}
165135

166-
class RefreshDisplaysThread : public QThread
167-
{
168-
public:
169-
RefreshDisplaysThread(SystemProperties* me) :
170-
QThread(nullptr),
171-
m_Me(me) {}
172-
173-
void run() override
174-
{
175-
m_Me->refreshDisplaysInternal();
176-
}
177-
178-
SystemProperties* m_Me;
179-
};
180-
181136
void SystemProperties::refreshDisplays()
182-
{
183-
if (WMUtils::isRunningX11() || WMUtils::isRunningWayland()) {
184-
// Use a separate thread to temporarily initialize SDL
185-
// video to avoid stomping on Qt's X11 and OGL state.
186-
RefreshDisplaysThread thread(this);
187-
thread.start();
188-
thread.wait();
189-
}
190-
else {
191-
refreshDisplaysInternal();
192-
}
193-
}
194-
195-
void SystemProperties::refreshDisplaysInternal()
196137
{
197138
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
198139
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,

app/backend/systemproperties.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class SystemProperties : public QObject
3838

3939
private:
4040
void querySdlVideoInfo();
41-
void querySdlVideoInfoInternal();
42-
void refreshDisplaysInternal();
4341

4442
bool hasHardwareAcceleration;
4543
bool rendererAlwaysFullScreen;

0 commit comments

Comments
 (0)