Skip to content

Commit

Permalink
Revert "video: Prefer Wayland over X11 (take 2!)"
Browse files Browse the repository at this point in the history
This reverts commit f9f7db4

Wayland has a myriad of unresolved problems regarding surface suspension
blocking presentation and the FIFO (vsync) implementation being
fundamentally broken leading to reduced GPU-bound performance.

That is not to say "we should fix FIFO in Mesa/other drivers," but rather
that it is completely unfixable without an additional protocol, in this
case fifo-v1[1].

Without this protocol, vkQueuePresent or glSwapBuffers *must* stall for
the 'frame' callback after presenting an image.
The only reason we can get away with this on SteamOS is because
Gamescope implements what is essentially fifo-v1 and we use that there.

The other side is surface suspension -- a very similar issue to the
above wrt the frame callback being used in that way and blocking.
If the SDL window is obscured, vkQueuePresent *will* block in FIFO,
which games typically do NOT like. This is solved by the combination of
fifo-v1 and commit-timing-v1.

There is no advantage to games and average applications preferring
Wayland over X11 -- only severe performance and unusability regressions
right now.
Thus, we must revert this change until fifo-v1 and commit-timing-v1 are
released and at least in a stable release for major compositors.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/256
  • Loading branch information
Joshua-Ashton committed Mar 24, 2024
1 parent beb52ed commit fca4099
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/video/SDL_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,18 @@ static VideoBootStrap *bootstrap[] = {
#ifdef SDL_VIDEO_DRIVER_COCOA
&COCOA_bootstrap,
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND
&Wayland_bootstrap,
#endif
/*
* Prefer X11 over Wayland for now until fifo-v1 + commit-timing-v1 are released
* and available in compositors otherwise we will suffer large performance/frame pacing
* regressions in GPU-bound apps or when the window is obscured when the application is
* using FIFO (vsync).
*/
#ifdef SDL_VIDEO_DRIVER_X11
&X11_bootstrap,
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND
&Wayland_bootstrap,
#endif
#ifdef SDL_VIDEO_DRIVER_VIVANTE
&VIVANTE_bootstrap,
#endif
Expand Down Expand Up @@ -4904,12 +4910,12 @@ int SDL_GetMessageBoxCount(void)
#ifdef SDL_VIDEO_DRIVER_UIKIT
#include "uikit/SDL_uikitmessagebox.h"
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND
#include "wayland/SDL_waylandmessagebox.h"
#endif
#ifdef SDL_VIDEO_DRIVER_X11
#include "x11/SDL_x11messagebox.h"
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND
#include "wayland/SDL_waylandmessagebox.h"
#endif
#ifdef SDL_VIDEO_DRIVER_HAIKU
#include "haiku/SDL_bmessagebox.h"
#endif
Expand Down

0 comments on commit fca4099

Please sign in to comment.