garrysmod-issues icon indicating copy to clipboard operation
garrysmod-issues copied to clipboard

x86_64 Chromium beta sees multiple monitors as single monitor on Linux

Open thennothinghappened opened this issue 1 year ago • 5 comments

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

image 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: image

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.

image

thennothinghappened avatar Sep 10 '22 01:09 thennothinghappened

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.

luluco250 avatar Sep 15 '22 00:09 luluco250

Same on KDE wayland, running on Xwayland. Can't test in native wayland cause GMod crashes with SDL_VIDEODRIVER=wayland.

melvyn2 avatar Sep 15 '22 04:09 melvyn2

This is quite recent as it used to work week or two back on the chromium x86-64 build. Still works correctly on stable.

Jertzukka avatar Sep 15 '22 13:09 Jertzukka

Experiencing the same issue on GNOME Wayland & X11

SilverMight avatar Sep 17 '22 02:09 SilverMight

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.

Minc3 avatar Sep 18 '22 05:09 Minc3

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.

Lamrr avatar Nov 20 '22 08:11 Lamrr

I tested both on native Xorg and Xwayland, using Nvidia proprietary drivers and AMD's open source drivers. Issue occurs regardless.

kitrodian avatar Dec 08 '22 07:12 kitrodian

This issue occurs for me as well. I found an alternative solution that hasn't been discussed here yet.

  1. Launch Garry's Mod, change "Resolution" to your native resolution, and "Display mode" to "Borderless Window"
  2. Locate the "Launch Options" field in the "Properties" menu
  3. 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.

Kern3l-Panic avatar Dec 11 '22 01:12 Kern3l-Panic

Still happening as of now with X11 on Gnome 43.1

Magnotec1 avatar Jan 09 '23 01:01 Magnotec1

Same here. X11 Gnome 43.1

Sleggie avatar Jan 10 '23 04:01 Sleggie

X11 Cinnamon 5.6.7 Mint 21.1 5.15.0-58-generic NVIDIA Corporation TU116 [GeForce GTX 1660 Ti]

Nacroni avatar Jan 29 '23 17:01 Nacroni

Still happening 5 months later.

Sleggie avatar Feb 08 '23 03:02 Sleggie

Still happening.

KarlOfDuty avatar Mar 12 '23 16:03 KarlOfDuty

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.

SilverMight avatar May 10 '23 19:05 SilverMight

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.

Lamrr avatar May 11 '23 06:05 Lamrr

Any news on this?

Wunderharke avatar Oct 07 '23 20:10 Wunderharke

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>

JaiChoccyFox avatar Oct 29 '23 13:10 JaiChoccyFox

Very nice! Will have to try that later.

Could the game maybe set this by default as well?

KarlOfDuty avatar Oct 29 '23 13:10 KarlOfDuty

I have applied the proposed fix, please let me know if that fixes it for you.

robotboy655 avatar Oct 31 '23 18:10 robotboy655

I am assuming issue is resolved since I see no replies.

robotboy655 avatar Nov 16 '23 17:11 robotboy655