antonioginer / switchres

Modeline generation engine for emulation
44 stars 12 forks source link

Switchres on Steam Deck #97

Open LichLord91 opened 1 year ago

LichLord91 commented 1 year ago

Hello!

I'm trying to get switchres and 15khz output from Steam Deck. I've actually successfully patched the Steam Deck's kernel with the following repo https://github.com/D0023R/linux_kernel_15khz . Steam Deck is on 5.13 kernel atm if that helps.

Anyway I compiled the swithres repo here and tried to just test it on the built in screen and once with a external lcd screen in KMS/DRM gamescope mode (while in the normal Steam Deck UI game mode) (with non 15khz outputs) but looks like I'm having issues , I've added the debug logging below including the drm card devices. eDP is the laptop where DP is the external adapter.

I understand that the steam deck's custom APU may not work here but wanted to see if it could haha. let me know if I'm on the right direction or not even close.

(Steam deck uses Xwayland for the gamescope session)

image

image

xwayland while connected to external monitor through DP-1

image

xwayland while connected to internal monitor through eDP-1

image

substring commented 1 year ago

Hi, The logs say it didn't find a X session, so it went the DRM way. But it couldn't find an existing DRM master to hijack, nor set itself as DRM master, so it failed.

So among various things that come to my mind :

To tell you the truth, I personnaly switched to wayland a few weeks ago only because I was having heavy tearing in X after upgrading my daily Ubuntu desktop to 22.04 + BIOS update.

Pinging @D0023R if he has free time and wanna investigate further on that.

LichLord91 commented 1 year ago

Hey Substring! Thanks for the reply. Just to let you know I'm very new to all this retro gaming tech and been researching quite a bit haha so if i missed some obvious things that's probably why.

you may have not compiled the kernel with the KMS user modes patch, D00zer added it recently in the 6.0 branch -> 05_linux_switchres_kms_drm_modesetting.patch. The other patches in that kernel version are worth, really, even more on a AMD APU

Ahh okay wasn't sure if the 6.0 patches would apply to 5.13, rebuilding the kernel now with those patches as well.

X support wasn't compiled in switchres

Ahh haha, tbh I wasn't sure how to compile the repo i just ran make with no arguments and thought it worked <<. (first time using switchres and not the best compiler/package maker XD) Any tips to compile this correctly? Did I miss some guide? (is there a PKGBUILD out there somewhere << :) )

try in a terminal session, not from the desktop so you have good old DRM once you have patched the kernel with the fore mentionned patch. We're doing our best to help emulators integrate switchres so modeswitching is absolutely transparent to them

So I actually ran these commands via ssh on terminal remotely. I add export DISPLAY=0.0 to interact with the display session. If that method is flawed lmk I'll see if i can get a konsole session running in the Steam Deck Game Mode.

Also just to clarify I was just trying to change the resolution on the screen not via any emulator (though I know switch res is used in emulators via a library)

Just to tell you my use case I plan to use emulation on the deck and use a Sony PVM-20m2mdu (which does 240p/480i only @ 15khz obviously with 600 lines).

The following is what got me to this point.

15khz patch http://forum.arcadecontrols.com/index.php/topic,159804.0.html

Groovymame http://forum.arcadecontrols.com/index.php/topic,164449.0.html

(wealth of info even beyond batocera) https://wiki.batocera.org/batocera-and-crt

(some switchres edid emulation info) http://forum.arcadecontrols.com/index.php/topic,140215.msg1447520.html#msg1447520

P.S. Found your thread/gitlab on making a GroovyMame Live CD based on Arch Linux so its funny you're commented here cause I was going to reach out to eventually as you know Steam Deck runs of Arch Linux too XD

substring commented 1 year ago

Ok, things are crystal clear in my mind but sounds like I should explain myself better ;)

The first thing you need is a kernel patched with the patches from the 6.0 folder. Except maybe some amdgpu specific parts, anything else should apply more or less fine on a 5.13 kernel. The KMS patch is top mandatory at this point, really

situation word on Wayland: we've never investigated for Wayland modeswitching for many different reasons, one of them being that at that moment, KMS modeswitching wasn't as mature as today.

X support in switchres/wayland: you're on your own on that point, since I have no idea if this would work. I bet not. To build X support you need libxrandr, Steam may not provide it or at least, not its pkgconfig + header file. But I guess we shouldn't need it

When I say terminal session, I mean with no X/wayland running, just pure tty and no X/Wayland process even running in background.

A word on some testing protocol: we like to build the grid with make grid then test switchres with it like switchres 320 240 60 -s -l grid.

I suggest you hop on the GroovyArcade discord, might be easier for helping you