[raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post Reply
StackDoubleFlow
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jan 21, 2024 4:15 pm
Contact:

[raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post by StackDoubleFlow »

> What happened?
The game closes before I can even see the window open.
> What did you expect to happen instead? It might be obvious to you, but do it anyway!
The game to open.
> Does it happen always, once, or sometimes?
Always
> If you can reproduce the issue provide the exact steps!
I simply launch the factorio binary: `./factorio`

Relevant part of log:

Code: Select all

wp_viewport@32: error 2: source rectangle out of buffer bounds
The game does launch properly without this line in my sway config: `output eDP-1 scale 1.5` so I am fairly certain fractional scaling leads to the issue here.
I have also attached a log file with `WAYLAND_DEBUG=1`.
It looks like osu had a similar issue recently https://github.com/hyprwm/Hyprland/issues/4158
Attachments
factorio-wayland-debug.log
(21.49 KiB) Downloaded 22 times
factorio-current.log
(2.05 KiB) Downloaded 21 times

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 452
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post by raiguard »

Thanks for the report. What version of Sway are you running? Also, could you link me your Sway configuration file?

Initial investigation points to this being an SDL issue that I will have to report upstream.
Don't forget, you're here forever.

StackDoubleFlow
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jan 21, 2024 4:15 pm
Contact:

Re: [raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post by StackDoubleFlow »

My full sway configuration has been attached.
I use the -git packages on AUR for sway and wlroots.
Sway revision: e8c421e
wlroots revision: b80337a8
Attachments
config.txt
(8.99 KiB) Downloaded 21 times

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 452
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post by raiguard »

Thank you, I was able to reproduce the crash. This looks to be an SDL bug that has been fixed in more recent versions. Unfortunately we will not be updating SDL in 1.1.x any more, but I will test this after we upgrade SDL on master and see if the problem is resolved there.
Don't forget, you're here forever.

StackDoubleFlow
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jan 21, 2024 4:15 pm
Contact:

Re: [raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post by StackDoubleFlow »

Do you happen to know which commit or version of SDL this was fixed in? I'm trying to track down the issue as it seems Factorio is not the only thing affected for me.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 452
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post by raiguard »

It appears that newer SDL does not fix the underlying issue. However, I tested with a standalone SDL2 program and this does not occur there.

I have a feeling that this issue, along with a myriad of other issues, are being caused by Factorio submitting frames with incorrect sizes because it begins generating the next frame before it processes SDL resize events. I will update you when I have more information.
Don't forget, you're here forever.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 452
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post by raiguard »

I was right about the old buffer sizes being the cause, but a workaround was committed to SDL last week. I applied the patch locally and confirmed that it works. Once a new SDL release is cut and we pull it into Factorio I will mark this as resolved for 2.0.

Thanks for the report!

https://github.com/libsdl-org/SDL/issues/9283
https://github.com/libsdl-org/SDL/pull/9286
Don't forget, you're here forever.

ogsIhdw
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Aug 18, 2023 5:18 pm

Re: [raiguard][1.1.103] Crash on startup under Wayland with fractional scaling

Post by ogsIhdw »

A quick fix is to turn off fractional scaling (via swaymsg or what have you) then launch factorio, then re-enable scaling:

Code: Select all

swaymsg output eDP-1 scale 1
factorio &
sleep 5
swaymsg output eDP-1 scale 1.5

Post Reply

Return to “Assigned”