From fb95b7785ace7972ffb1fd9f96b4c35101962daf Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Sat, 16 May 2026 17:05:30 -0700 Subject: [PATCH] ui: Set SDL_HINT_VIDEO_DRIVER to wayland,x11 --- ui/xemu.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ui/xemu.c b/ui/xemu.c index f0a56d1647..4a2f0bac57 100644 --- a/ui/xemu.c +++ b/ui/xemu.c @@ -947,16 +947,13 @@ static void poll_events(struct xemu_console *scon) static void display_very_early_init(DisplayOptions *o) { #ifdef __linux__ - /* on Linux, SDL may use fbcon|directfb|svgalib when run without - * accessible $DISPLAY to open X11 window. This is often the case - * when qemu is run using sudo. But in this case, and when actually - * run in X11 environment, SDL fights with X11 for the video card, - * making current display unavailable, often until reboot. - * So make x11 the default SDL video driver if this variable is unset. - * This is a bit hackish but saves us from bigger problem. - * Maybe it's a good idea to fix this in SDL instead. + /* SDL3 falls back to XWayland on compositors without fifo-v1 [1], + * breaking HiDPI. Swap may block when occluded, but the BQL is released + * before swap so emulation is unaffected. + * + * [1] https://github.com/libsdl-org/SDL/pull/9383 */ - setenv("SDL_VIDEODRIVER", "x11", 0); + SDL_SetHint(SDL_HINT_VIDEO_DRIVER, "wayland,x11"); #endif if (!SDL_Init(SDL_INIT_VIDEO)) {