Source: wesnoth-1.18
Severity: normal
Tags: patch
User: [email protected]
Usertags: regression

After discussion with SDL upstream, I'm looking into what needs to 
happen for Debian (and indirectly Ubuntu) to replace "classic" SDL2 with 
sdl2-compat, following in the footsteps of other distros like Arch and 
Fedora. sdl2-compat is a reimplementation of the SDL 2 API using SDL 3.

One issue that I've noticed is that the autopkgtest for wesnoth-1.18 has 
regressed. This seems to be because "classic" SDL2 will automatically 
use the `offscreen` video driver if neither X11 nor Wayland works, but 
there was an upstream change in SDL3 to make the `offscreen` video 
driver only work if explicitly requested, similar to the behaviour that 
the `dummy` video driver already had. The result is that on a CI system 
with no X11 display or Wayland compositor, this test fails to initialize 
SDL video when SDL is really sdl2-compat.

The upstream change seems reasonable to me - by default, games should 
only use video drivers that actually display some pixels to the user! - 
but I've opened https://github.com/libsdl-org/sdl2-compat/issues/561 to 
query whether sdl2-compat should be bug-for-bug compatible with 
"classic" SDL2 on this point. So I think this is really an issue in 
wesnoth-1.18, more than an issue in sdl2-compat.

A workaround that I have confirmed does work is to run the test with 
SDL_VIDEODRIVER="offscreen" (or "dummy" or "offscreen,dummy"), so in the 
short term please consider applying the attached patch.

The xauth and xvfb dependencies can probably also be dropped, although I 
haven't verified that.

In the longer term, for consideration upstream:

wesnoth --nogui still calls SDL_InitSubSystem(SDL_INIT_VIDEO), even 
though it has been asked not to have a GUI. Perhaps ideally it wouldn't? 
(But perhaps there's some feature of the video subsystem that it is 
relying on?)

Or perhaps wesnoth could call SDL_SetHint(SDL_HINT_VIDEODRIVER, "offscreen")
(or "dummy", or "offscreen,dummy") when invoked with --nogui or equivalent?

Thanks,
    smcv
>From 2292879cf54cb8b9ef33f4fd0fd85f105faffebc Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Sat, 20 Dec 2025 16:17:18 +0000
Subject: [PATCH] d/tests/control.in: Explicitly use offscreen or dummy video
 driver

In a CI environment we can't expect to have a working X11 display or
Wayland compositor unless we explicitly run one, which this test
does not. In "classic" SDL2 this was masked by the offscreen video
driver being enabled by default, but in SDL3 + sdl2-compat the offscreen
video driver is only used if it is specifically requested, with the
reasonable justification that video drivers that don't show any pixels
to the user are only rarely what is wanted.

Closes: #-1
---
 debian/tests/control    | 2 +-
 debian/tests/control.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/tests/control b/debian/tests/control
index 12a7dad6ad5..64879f04f16 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,6 +1,6 @@
 # Inspired by upstream CI script utils/CI/play_test_executor.sh
 # This runs wesnoth with a multiplayer AI-only matchup.
-Test-Command: /usr/games/wesnoth-1.18 -m --controller 1:ai --controller 2:ai --nogui
+Test-Command: SDL_VIDEODRIVER=offscreen,dummy /usr/games/wesnoth-1.18 -m --controller 1:ai --controller 2:ai --nogui
 Depends:
  wesnoth-1.18,
  xauth,
diff --git a/debian/tests/control.in b/debian/tests/control.in
index 582ad1ce727..3929ef24c5f 100644
--- a/debian/tests/control.in
+++ b/debian/tests/control.in
@@ -1,6 +1,6 @@
 # Inspired by upstream CI script utils/CI/play_test_executor.sh
 # This runs wesnoth with a multiplayer AI-only matchup.
-Test-Command: /usr/games/wesnoth-BRANCH -m --controller 1:ai --controller 2:ai --nogui
+Test-Command: SDL_VIDEODRIVER=offscreen,dummy /usr/games/wesnoth-BRANCH -m --controller 1:ai --controller 2:ai --nogui
 Depends:
  wesnoth-BRANCH,
  xauth,
-- 
2.51.0

Reply via email to