garrysmod-issues
garrysmod-issues copied to clipboard
x86_64 Chromium beta sees multiple monitors as single monitor on Linux
Details
As in the title, the "x86_64 - Chromium + 64-bit binaries" beta detects my monitors as one big monitor, in fact the resolution it shows as "native" resolution is the full size of the X screen:
$ xrandr -q
Screen 0: minimum 8 x 8, current 4480 x 1440, maximum 32767 x 32767
The 32 bit version correctly sees that I have two monitors. I haven't played GMod in a little while so I only know that this issue has appeared in the last few weeks I think.
Version:
I've also tried verifying game cache, no change.
Steps to reproduce
Enable the 64 bit chromium beta on Linux with more than one monitor and boot the game. On its own the game will crash before being able to fully load (GModCEFCodecFix fixes this, but you can still see the game tries to take up both monitors without it) Once in the menu, the game is really stretched and believes the monitor resolution is the full X screen size, the input is broken as it tries to stretch over both screens. However the actual resolution it seems to run at is 640x480.... which is really confusing.
I can confirm this, although in my case I don't even see any image, it's just black.
Weirdly enough manually specifying the resolution with -w 2560 -h 1080 -fullscreen
does not work, it only works for -window
.
Also, even when I launch the game with -window -noborder
changing any unrelated setting and then clicking ok will cause the game to try to stretch to the multi monitor resolution.
I'm on Arch Linux with the Nvidia proprietary driver under GNOME Shell on Wayland.
The only workaround I found that worked was by using gamescope with these launch options on Steam:
cd ~/.local/share/Steam/steamapps/common/GarrysMod; gamescope -w 2560 -h 1080 -W 2560 -H 1080 -f -- ./hl2.sh -window # %command%
I have no idea why, but the current directory does seem to matter, if I just run hl2.sh
using its full path I either get a black screen or the game only renders the first frame.
Same on KDE wayland, running on Xwayland. Can't test in native wayland cause GMod crashes with SDL_VIDEODRIVER=wayland
.
This is quite recent as it used to work week or two back on the chromium x86-64 build. Still works correctly on stable.
Experiencing the same issue on GNOME Wayland & X11
Playing on the 32 bit version on Linux is so bad. I forgot about how unstable the 32 bit version is on Linux.
Can't wait for this to be fixed
Work around: Disable all monitors but your primary one launch gmod then turn monitors back on. (This sucks) Write a script to do this and your all good.
I can confirm this issue still occurs, although it's only happened recently on my computer - not sure what has caused that change. Here are some system details if that helps; POP_OS! 22.04, Nvidia drivers 515, GNOME 42.5, X11
I can also confirm @Minc3 work around works around the issue, and you can pretty easily write a script as a temporary fix. I've made a steam guide about making your own script in case anyone else needs help working around this.
I tested both on native Xorg and Xwayland, using Nvidia proprietary drivers and AMD's open source drivers. Issue occurs regardless.
This issue occurs for me as well. I found an alternative solution that hasn't been discussed here yet.
- Launch Garry's Mod, change "Resolution" to your native resolution, and "Display mode" to "Borderless Window"
- Locate the "Launch Options" field in the "Properties" menu
- Use the "[position horizontally]" launch option:
-x 0
My primary display is positioned on the left and my secondary on the right. Your setup may differ, so adjust the launch option value to fit your arrangement.
Still happening as of now with X11 on Gnome 43.1
Same here. X11 Gnome 43.1
X11 Cinnamon 5.6.7 Mint 21.1 5.15.0-58-generic NVIDIA Corporation TU116 [GeForce GTX 1660 Ti]
Still happening 5 months later.
Still happening.
It seems like this might be an issue with SDL2, which GMod does not bundle (as far as I could see at least, there was no libSDL2.so in my bin/linux64 folder). I copied whatever version is included in CS:GO (located at bin/linux64/libSDL2-2.0.so.0) over to GMod's library folder (bin/linux64) and it seems to fix the issue entirely. Could someone else try this? I can actually replicate this issue in CS:GO if I delete the bundled SDL2 version and make it fall back on the system library.
It seems like this might be an issue with SDL2, which GMod does not bundle (as far as I could see at least, there was no libSDL2.so in my bin/linux64 folder). I copied whatever version is included in CS:GO (located at bin/linux64/libSDL2-2.0.so.0) over to GMod's library folder (bin/linux64) and it seems to fix the issue entirely. Could someone else try this? I can actually replicate this issue in CS:GO if I delete the bundled SDL2 version and make it fall back on the system library.
I can confirm copying the library fixes this issue. SDL seems a likely culprit as I've encountered a similar monitor setting bug with OpenTTD, another game using SDL. I resolved that issue by compiling an OpenTTD build from source instead of using the precompiled binaries.
For GMod, would there be any consequences in using the CS:GO library as a workaround? I'm not sure if it would trigger VAC or cause other problems down the line.
Any news on this?
Hi!
This issue is due to the system SDL libraries not using X11 XRandR extensions by default. Valve's SDL libraries are compiled with this enabled by default, however, you can still force the system SDL libraries to use XRandR even if it's not compiled to use it by default using one environment variable: SDL_VIDEO_X11_XRANDR
.
This forces SDL to use XRandR extensions, thus enabling the behaviour that is expected from Source games on Linux. This is a workaround that doesn't require you copying any of Valve's provided libraries around.
Example game launch parameters:
SDL_VIDEO_X11_XRANDR=1 %command% <game parameters>
Very nice! Will have to try that later.
Could the game maybe set this by default as well?
I have applied the proposed fix, please let me know if that fixes it for you.
I am assuming issue is resolved since I see no replies.