netbrain / zwift

Easily zwift on linux
The Unlicense
265 stars 28 forks source link

Unable to start ziwft with 2 monitors #140

Closed StebQC closed 5 months ago

StebQC commented 5 months ago

Describe the bug When running with 2 monitors: image

Workaround Unplug 1 monitor and latest zwift works fine or by using command VERSION=1.62.0 zwift with 2 monitors

Logs

docker logs zwift-stebqc
+ [[ -f /.dockerenv ]]
+ CONTAINER=docker
+ '[' '!' -z ']'
+ [[ docker == \d\o\c\k\e\r ]]
++ getent passwd user
++ cut -d: -f6
+ ZWIFT_USER_HOME=/home/user
+ ZWIFT_HOME='/home/user/.wine/drive_c/Program Files (x86)/Zwift'
+ mkdir -p '/home/user/.wine/drive_c/Program Files (x86)/Zwift'
+ cd '/home/user/.wine/drive_c/Program Files (x86)/Zwift'
++ id -u user
+ USER_UID=1000
++ id -g user
+ USER_GID=1000
+ '[' 1000 -eq 1000 ']'
+ '[' 1000 -ne 1000 ']'
+ echo 'ZWIFT_UID is not set or not a number: '\''1000'\'''
+ '[' 1000 -eq 1000 ']'
+ '[' 1000 -ne 1000 ']'
ZWIFT_UID is not set or not a number: '1000'
+ echo 'ZWIFT_GID is not set or not a number: '\'''\''1000'\'''
+ '[' '!' -z ']'
+ '[' '' = update ']'
ZWIFT_GID is not set or not a number: ''1000'
++ ls -A .
+ '[' '!' 'ANT_DLL.dll
APR2007_xinput_x64.cab
APR2007_xinput_x86.cab
BleWin10Lib.dll
BleWin10Lib_V2.dll
CloseLauncher.exe
DSETUP.dll
DXSETUP.exe
Feb2010_X3DAudio_x64.cab
Feb2010_X3DAudio_x86.cab
Jun2010_XAudio_x64.cab
Jun2010_XAudio_x86.cab
Launcher_ver_cur.xml
Patcher.dll
VC_redist.x64.exe
WebView2Loader.dll
Webview2Setup.exe
Windows ANT Dongle Driver
ZwiftApp.exe
ZwiftHelper.exe
ZwiftLauncher.exe
ZwiftLauncher.exe.config
ZwiftWindowsCrashHandler.exe
Zwift_1.0.129105_d7f49bc5_manifest.xml
Zwift_ver_cur.xml
Zwift_ver_cur_filename.txt
assets
bink2w64.dll
data
dotnet-v4.7.2-installer.exe
dsetup32.dll
dxupdate.cab
unins000.dat
unins000.exe' ']'
+ chown -R 1000:1000 /home/user/.wine/drive_c/users/user/Documents/Zwift
+ gosu user:user /bin/run_zwift.sh ''
+ ZWIFT_HOME='/home/user/.wine/drive_c/Program Files (x86)/Zwift'
+ '[' '!' -d '/home/user/.wine/drive_c/Program Files (x86)/Zwift' ']'
+ cd '/home/user/.wine/drive_c/Program Files (x86)/Zwift'
+ echo 'starting zwift...'
starting zwift...
+ wine start ZwiftLauncher.exe SilentLaunch
0044:err:winediag:is_broken_driver Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
++ winedbg --command 'info proc'
++ grep -P ZwiftLauncher.exe
++ grep -oP '^\s\K.+?(?=\s)'
+ LAUNCHER_PID_HEX=00000164
+ LAUNCHER_PID=356
authenticating with zwift...
+ [[ ! -z XXXXX ]]
+ [[ ! -z YYYYY ]]
+ echo 'authenticating with zwift...'
++ zwift-auth
0168:err:winediag:is_broken_driver Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
0034:err:winediag:is_broken_driver Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
0180:err:ole:CoGetContextToken apartment not initialised
0168:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Foundation.Diagnostics.AsyncCausalityTracer"
+ wine start /exec /bin/runfromprocess-rs.exe 356 ZwiftApp.exe '--token={"access_token":"ZZZZZZ","expires_in":21600,"refresh_expires_in":691200,"refresh_token":"ZZZZZZ","not-before-policy":1408478984,"session_state":"b416aa00-d42b-4078-bc06-a20e2fee39f1","scope":"openid"}'
+ sleep 3
01d0:err:winediag:is_broken_driver Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
01e4:err:winediag:is_broken_driver Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.
+ pgrep -f ZwiftApp.exe
+ echo 'Killing uneccesary applications'
Killing uneccesary applications
+ pkill ZwiftLauncher
+ [[ -n unix:path=/run/user/1000/bus ]]
+ true
+ sleep 30
+ pkill ZwiftWindowsCra
+ pkill -f MicrosoftEdgeUpdate
+ wineserver -w
netbrain commented 5 months ago

Looks like the culprit is 0044:err:winediag:is_broken_driver Broken NVIDIA RandR detected, falling back to RandR 1.0. Please consider using the Nouveau driver instead.

netbrain commented 5 months ago

Maybe https://forums.developer.nvidia.com/t/issue-wine-falling-back-to-nouveau-driver/36957 can help

If Wine is getting confused by the implicit scaling resolutions listed by “xrandr --q1”, you can disable them by disabling the IncludeImplicitMetaModes option.

You could also try to set zwift into windowed mode using a single screen, and the plug in the second screen and see if zwift starts in windowed mode. Probably something going on in your system with randr and multiple screens that's confusing either wine, zwift or both.

StebQC commented 5 months ago

Like you said, starting zwift:latest with 1 monitor then plug the second one works fine.

I managed to locate that the problem started with version 1.64.0. I haven't time to look for the changes between these 2 version. Will try to look into it over the weekend.

StebQC commented 5 months ago

I have tried to find the changes that causes this issue with no luck. As it takes a few seconds to unplug my second monitor, the workaround is easy to manage. I will close this issue.

Thanks for your help @netbrain

netbrain commented 5 months ago

You could also try to simply write a script that disables the second monitor at startup of Zwift, and then re-enables it a minute later.

StebQC commented 5 months ago

Great idea !!! For future reference, here is my script if anyone is interested

#!/bin/bash
xrandr --output HDMI-0 --off
zwift
sleep 7
xrandr --output HDMI-0 --auto --right-of DP-0