Fix #8029: [SDL2] disable draw-thread on wayland SDL video driver (#8648)

When the wayland SDL video driver is used, an EGL context is
created in the main thread. It is not allowed to update this
context from another thread, which is exactly what our draw-thread
is trying.

The other solution would be to move all of SDL into the
draw-thread, but that would introduce a whole scala of different
problems.

The wayland SDL backend is significantly faster than the
X11 SDL backend, but there is a performance hit nevertheless.
pull/221/head
Patric Stout 3 years ago committed by GitHub
parent 4f0692c437
commit 2c9084d48c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -715,6 +715,17 @@ const char *VideoDriver_SDL::Start(const StringList &parm)
MarkWholeScreenDirty();
_draw_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread");
/* Wayland SDL video driver uses EGL to render the game. SDL created the
* EGL context from the main-thread, and with EGL you are not allowed to
* draw in another thread than the context was created. The function of
* _draw_threaded is to do exactly this: draw in another thread than the
* window was created, and as such, this fails on Wayland SDL video
* driver. So, we disable threading by default if Wayland SDL video
* driver is detected.
*/
if (strcmp(dname, "wayland") == 0) {
_draw_threaded = false;
}
SDL_StopTextInput();
this->edit_box_focused = false;

Loading…
Cancel
Save