RetroArch icon indicating copy to clipboard operation
RetroArch copied to clipboard

Switchres Crash

Open Slider-Whistle opened this issue 2 years ago • 16 comments

Description

Hi, I suspect this might be a config issue on my side (if not with RetroArch itself, then maybe with X11), but I feel like I've tried everything I can to work around this. RetroArch, on my machine, seems to demonstrate somewhat inconsistent behaviour in being able to use Native SwitchRes. Unless X11 is already outputting a custom SwitchRes mode when RetroArch is started, RetroArch will fail to calculate a new mode without causing the window to crash. That's my current working theory, anyway. I've attached a log of RetroArch failing to switch to 256x240@60hz, another log doing the same thing successfully with SwitchRes' reference program (in actual fact it's using 120hz, but that's what I expect), my monitor's "parse-edid", and my SwitchRes ini file (added .txt so I could upload) if that might help. I've confirmed that RetroArch is set to "INI" mode.

In any case, I think there might be some safety in considering that it might possibly be a bug, if standalone SwitchRes seems to be able to do it just fine.

Expected behavior

N/A

Actual behavior

N/A

Steps to reproduce the bug

  1. Launch RetroArch, with my particular environment
  2. Load any game
  3. RetroArch will crash

Bisect Results

N/A

Version/Commit

  • RetroArch: v1.10.3 -- b999eaa4c9

Environment information

  • OS: Gentoo
  • Compiler: GCC (11.3.0) 64-bit Built: Jul 28 2022

Slider-Whistle avatar Jul 28 '22 23:07 Slider-Whistle

@alphanu1 Got any ideas here?

LibretroAdmin avatar Aug 01 '22 09:08 LibretroAdmin

Hi @Slider-Whistle,

Can you try with a different video. Maybe GL and let me know what results you get?

Please attach the RA logs for it as well

alphanu1 avatar Aug 01 '22 10:08 alphanu1

Sorry for the delay! I just fixed my email notification program.

  • I didn't notice any difference between gl or glcore and vulkan. I'll post one log for plain gl.
  • gl1 and xvideo had frozen video or blank output, so I probably won't log those either.
  • sdl2 actually works just fine. But rgui's menu gets distorted (only sometimes?), and it returns to my desktop with an incorrect mode (consistently). I just realised that Switchres' own debug output is going to stdout, rather than stderr. I'll attach SR's output for my attempts with the gl (unsuccessful) and sdl (successful) drivers. Interestingly, it seems to think that h_size, h_shift, and v_shift aren't real options, but unfortunately nothing else appears to give helpful info. retroarchloggl.log (unsuccessful) switchresgl.log retroarchlogsdl2.log (successful) switchressdl2.log

Edit: Nevermind, SDL2 doesn't -crash-, but it produces some very wonky and incorrect video modes.

Slider-Whistle avatar Aug 04 '22 03:08 Slider-Whistle

Sorry for the mention. I have an important update. @alphanu1 I switched back to Vulkan, and had a look through other settings which I thought might be relevant. I believe I've positively identified the culprit. Earlier, I had SwitchRes Native (crt_switch_resolution = "4"), and Fullscreen (video_fullscreen = "true") enabled. However, I did NOT have Windowed Fullscreen mode (video_windowed_fullscreen) set to "true". When setting this option to "true", all of my crashes and being returned to the desktop in an incorrect resolution issues disappeared. In other words, the crashes specifically have to do with this setting, and possibly how it gets combined with SwitchRes. Some experimentation with different environments might be needed to pin down the exact cause.

I thought the setting would be irrelevant in my case, as Linux/X11's API makes no differentiation.

Slider-Whistle avatar Aug 09 '22 12:08 Slider-Whistle

@Slider-Whistle Would you mind taking this issue over the RetroArch SwitchRes Discord? I am currently on another project ATM but the guys over there ae very helpful and have probably come across this or something similar before!

Its in the Groovyarcade Discord under the RetroArch channel. if it is found to be bug. I can look into fixing it once I finish my current project.

alphanu1 avatar Aug 10 '22 08:08 alphanu1

Sure!

Slider-Whistle avatar Aug 10 '22 09:08 Slider-Whistle

Can you guys keep us informed on what the status of this is?

LibretroAdmin avatar Sep 03 '22 15:09 LibretroAdmin

Oh, pardon. I think I've figured out why it's happening, but nobody in that discord channel he mentioned could reproduce the issue so I haven't got a definitive answer as to whether it's a bug.

The "fix" in my case is as it was described above, I just had to set "video_windowed_fullscreen" to "false", which makes me believe that having it set to "true" on X11 while using (native?) switchres must cause crashes. Nobody else seemed to experience it though.

Slider-Whistle avatar Oct 20 '22 22:10 Slider-Whistle

@Slider-Whistle It would be nice to know if this s defiantly SwicthRes of something else. Have you tried changing resolutions with this setting on and SwitchRes turned off?

What GPU and driver version are you running?

alphanu1 avatar Oct 21 '22 07:10 alphanu1

Sorry for the delay. I use a GTX 970, with DVI-I output passively converted to VGA through hardware. Software-side, my version for the proprietary nvidia firmware is listed as "520.56.06", though I haven't rebooted since yesterday.

I've confirmed that the crash is still reproducible on my end with retroarch v1.12.0 -- 194be57da1.

I don't know if I could find any way to try the test you suggested. I tried going into the "Fullscreen Mode" menu, setting "Fullscreen Width" and "Fullscreen Height" from 0, 0 to 640, 480, and toggling "Start in Fullscreen Mode" from on, to off, and back to on, but didn't experience any crash. Do you have any other ideas to widen the search?

Slider-Whistle avatar Oct 27 '22 10:10 Slider-Whistle

@Slider-Whistle if you can open a terminal window and user this to change the resolution wile RA is running. Use the "xrandr" commands to switch to different resolutions. Then change back to RA. Let me know the outcome and some logs would be good too.

FYI, looking closer at the logs Fullscreen is being called before SwitchRes called for a resolution change. There are quite a few Video driver call before SwirchRes is called. So, it does look like a possible driver issue.

Now this could be that GL is not like the correct resolution the Menu has switched to. Can you also try super resolutions @60hz to see if you still receive the save error.

GL init `[INFO] [Environ]: SET_INPUT_DESCRIPTORS:

[INFO] [Environ]: SET_MEMORY_MAPS.

[INFO] [SRAM]: Skipping SRAM load.

[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1

[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.

[INFO] [Video]: Set video size to: fullscreen.

X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 152 (XFree86-VidModeExtension) Minor opcode of failed request: 10 (XF86VidModeSwitchToMode) Value in failed request: 0x5a00001 Serial number of failed request: 4728 Current serial number in output stream: 4730`

SDL init

`[INFO] [Environ]: SET_INPUT_DESCRIPTORS:

[INFO] [Environ]: SET_MEMORY_MAPS. [INFO] [SRAM]: Skipping SRAM load.

[INFO] [State]: Found auto save state in "/home/houston/.config/retroarch/states/Balloon Fight (Japan) (En).state.auto".

[INFO] [State]: Auto-loading save state from "/home/houston/.config/retroarch/states/Balloon Fight (Japan) (En).state.auto" succeeded.

[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1

[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.

[INFO] [Video]: Set video size to: fullscreen.

[INFO] [SDL2]: Available renderers (change with $SDL_RENDER_DRIVER):

[INFO] opengl

[INFO] software

[INFO] [SDL2]: Available displays:

[INFO] Display #0 mode: 1280x720@60hz.

[INFO] [Video]: Graphics driver did not initialize an input driver. Attempting to pick a suitable driver.

[INFO] [Joypad]: Found joypad driver: "udev".

[INFO] [Video]: Found display server: "x11".

[INFO] ALSA: Using signed 16-bit format.

[INFO] ALSA: Period size: 1024 frames

[INFO] ALSA: Buffer size: 2048 frames

[INFO] [Display]: Found display driver: "null".

[INFO] [Playlist]: Loading history file: "/home/houston/.config/retroarch/content_history.lpl".

[INFO] [Playlist]: Loading history file: "/home/houston/.config/retroarch/content_music_history.lpl".

[INFO] [Playlist]: Loading history file: "/home/houston/.config/retroarch/content_video_history.lpl".

[INFO] [Playlist]: Loading history file: "/home/houston/.config/retroarch/content_image_history.lpl".

[INFO] [Playlist]: Loading favorites file: "/home/houston/.config/retroarch/content_favorites.lpl".

[INFO] [CRT]: Requested Resolution: [email protected] << SwitchRes not called until here

[INFO] [CRT]: Current running core Mesen

[INFO] Switchres: Modeline "256x240_120 31.611975KHz 120.197624Hz" 10.463563 256 279 282 331 240 242 243 263 -hsync -vsync

[INFO] sr_refresh_display: mode was added

[INFO] sr_switch_to_mode: successfully switched to [email protected]

[INFO] [CRT]: Setting Aspect Ratio: 1.066667

[INFO] [CRT]: Setting Video Screen Size to: 256x240

[INFO] [Video]: Setting refresh rate to: 120.198 Hz.

[INFO] [State]: Loading state "/home/houston/.config/retroarch/states/Balloon Fight (Japan) (En).state.auto", 21528 bytes.

[INFO] [State]: Saving state "RAM", 21528 bytes.

[INFO] [State]: Saving state "/home/houston/.config/retroarch/states/Balloon Fight (Japan) (En).state.auto", 21528 bytes.

[INFO] Auto save state to "/home/houston/.config/retroarch/states/Balloon Fight (Japan) (En).state.auto" succeeded.

[INFO] [Overrides]: Configuration overrides unloaded, original configuration restored.

[INFO] [Config]: Saved new config to "/home/houston/.config/retroarch/retroarch.cfg".

[INFO] [Core]: Content ran for a total of: 00 hours, 01 minutes, 15 seconds.

[INFO] [Runtime]: Saving runtime log file: "/home/houston/.config/retroarch/playlists/logs/Mesen/Balloon Fight (Japan) (En).lrtl".

[INFO] [Core]: Unloading game..

[INFO] [Core]: Unloading core..

[INFO] [Core]: Unloading core symbols..

[INFO] [Core]: Saved core options file to "/home/houston/.config/retroarch/config/Mesen/Mesen.opt".

[INFO] [Video]: Average monitor Hz: 60.237335 Hz. (21.332 % frame time deviation, based on 2048 last samples).`

alphanu1 avatar Oct 27 '22 11:10 alphanu1

I didn't experience any crash when externally changing the resolution with Switchres disabled, and experience the same crash when it's set to do 2560x @60hz modes. noswitchres.log superres.log

Slider-Whistle avatar Oct 27 '22 11:10 Slider-Whistle

@Slider-Whistle thanks. The test you have done are with Vulkan so you get the same with GL and Vulkan.

Your refresh is still triggering at 120hhz however. Are you using a 31khz monitor?

[INFO] Switchres: Modeline "2560x240_120 31.560000KHz 120.000000Hz" 104.368920 2560 2790 2819 3307 240 242 243 263 -hsync -vsync [INFO] sr_refresh_display: no refresh required [INFO] sr_switch_to_mode: successfully switched to [email protected]

alphanu1 avatar Oct 27 '22 13:10 alphanu1