libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.92k stars 1.84k forks source link

Wayland scaling causes the display picture to scale down #9946

Closed REmerald closed 5 months ago

REmerald commented 5 months ago

Using sway (swayfx) with output eDP-1 scale 1.5 (the issue is also present on output eDP-1 scale 2).

The scaling causes the picture's height and width to be reduced by the scale factor and the remaining window space to have black borders (on the top and right). Only the picture itself is scaled down, the window interaction is not, e.g. to press a button I need to position the cursor where the button would have been if the picture was displaying normally.

Turning off scaling fixes it. Also, since setting SDL_VIDEO_DRIVER=x11 fixes it as well, I'm assuming, it's the SDL bug, not the application bug.

See https://github.com/minecraft-linux/mcpelauncher-manifest/issues/981#issuecomment-2143605846 for logs and more details.

The issue isn't present on xonotic-sdl which uses sdl 2.30.3-1, so it seems to be SDL3 specific.

Kontrabant commented 5 months ago

What appears to be happening from that log:

  1. The game creates a resizable window of size 720x480
  2. The window manager resizes the window to 1428x910 ('tiled' to the desktop dimensions)
  3. The game continues rendering at 720x480 to a portion of the new backbuffer size

Basically, it looks like the game (or something else) sets the resizable flag on the window, but the game doesn't adjust its rendering when receiving resize events.

ChristopherHX commented 5 months ago

yes this is not a sdl3 bug, I wouldn't have reported it here as it's experimental untested binding.

The x11 backend doesn't seem to forward the scaling to the app, while wayland backend forwards scaling to the app.

Kontrabant commented 5 months ago

Ok, we can close this then. Thanks for confirming.