substring / os

GroovyArcade is an Arch Linux based OS primarily targetting best CRT MAME experience
80 stars 10 forks source link

When leaving MAME game to come back to Attract Mode, Monitor loses picture/sync. #26

Closed skilau closed 1 year ago

skilau commented 1 year ago

Hi, I have an old Betson 27inch Arcade Monitor that is able to do tri-sync, and also using an old ArcadeVGA board.

I can run a MAME game just fine, but when exiting MAME, so it tries to switch back to Attract Mode, I am losing video/sync, and it stays lost. It will just show "No signal detected" on the monitor itself.

Interestingly enough, a ctrl-alt-detect will bring the "Groovy Mame" screen back up, as it shuts the system down.

I am extremely new to GroovyArcade (loaded it literally today), so I am not sure where to begin searching to fix this issue. Any thoughts? Thank you!

substring commented 1 year ago

Hey!

I'm surprised your arcadevga works, it requires a special video bios on linux that is hard to find, so support has been removed ...

Start by updating your install in gasetup > setup > system update> full os update

skilau commented 1 year ago

Hi @substring ! Thanks for responding so fast!

Yup, I bought this video card from Ultimarc about 15 years ago, I was surprised to see it still works as well! The monitor is a 27 inch Betson tri-sync arcade monitor that I bought at about the same time as the card.

In case you are curious, here is the output for it:

sudo lshw -C display

*-display description: VGA compatible controller product: RV370 [Radeon X600/X600 SE] vendor: Advanced Micro Devices, Inc. [AMD/ATI] physical id: 0 bus info: pci@0000:01:00.0 version: 00 width: 32 bits clock: 33MHz capabilities: pm pciexpress vga_controller bus_master cap_list rom configuration: driver=radeon latency=0 resources: irq:37 memory:f0000000-f3ffffff ioport:e000(size=256) memory:fea20000-fea2ffff memory:c0000-dffff

Yes, I was able to find the update option yesterday after install, and did the update.

Another issue I have noticed is that if I try to get out of Attract-Mode, the system/UI will lock up as it is trying to exit. I have to hard reboot to get it back.

I also had to make 1 change to the MAME config/mame.ini, I had to change "autosync" to 0, or some games would run at 2-3x times their regular speed.

Is there a log file I can take a look at to see what it is trying to do when it is trying to get from MAME -> Attract Mode? (And Attract Mode -> Exit) ?

Thanks again for your help, and I love the install of this software! I was up and running within about 5 minutes!

skilau commented 1 year ago

Just an update...

When coming back from MAME to Attract-Mode, I look at the logs, and I see that "attract.log" has blown up in size.

Looking at the content of the file, it looks normal until the lock up/crash/whatever.

Then I get 100000+ lines of: Error: No such device

For example:

Yet, in other cases, I get the lock up, and see nothing like this, or anything really out of the ordinary, for example:

*** Initializing display: 'MAME'

<NOTE: It remains locked here, where the monitor sits on "No signal detected", until I reboot the system>

substring commented 1 year ago

Sounds like a KMS problem. But your logs show you haven't updated yet, you should really do so, please.

Edit: kernel logs may be useful here too

skilau commented 1 year ago

Hi @substring !

Thanks for responding!

As far as I can tell, I have updated all packages. (I don't know ArchLinux as well as I do Ubuntu, so I might not be doing something right?)

"pacman -Syu" shows as nothing new now.

I notice in the gasetup menu, there is options for enabling the testing repo... Should I be doing that?

Also, you are right, there IS an interesting message in dmesg/kernel logs when I go from MAME -> Attract Mode:

[ 277.593487] radeon 0000:01:00.0: [drm] User-defined mode not supported: "SR-1_400x288@52.43": 52 8505 400 417 457 525 288 289 292 309 0x20 0xa

How do I remove that mode from my list of modes supported?

Thank you!

substring commented 1 year ago

You don't need the testing repo. But your logs showing SDL 2.0.20 meant an outdated version of SDL2, so probably the whole system as well.

The kernel message happens when a mode doesn't pass some checks, you'd need to enable DRM debug log mesasges to get more details. It's too early to suspect this card has problems with a modern linux, but considering this only happens with it ... Which exact ArcadeVGA model is it ?

skilau commented 1 year ago

Hi @substring : It appears my SDL version is:

pacman -Q --info sdl2

Name : sdl2 Version : 2.26.2-2

For the video card, I am not 100% sure, but based on pictures on Google, I believe it is an ArcadeVGA 3000 pcie. (Andy @ Ultimarc didn't really label these, except for saying "ArcadeVGA" on it)

Attached is a photo of it.

PXL_20230206_151445672

substring commented 1 year ago

Looks like the AVGA3000 yes, the 5000 has passive cooling according to pictures I could find.

So, on Linux tha AVGA3000 required a specific BIOS and some kernel patches (see https://github.com/Ansa89/linux-15khz-patch/blob/master/avga3000.diff) but these have been removed since these cards are really out of date and not supported anymore. One thing you may try is to change the video backend from KMS to X (gasetup : setup > video > X / KMS)

skilau commented 1 year ago

Hi @substring :

I tried X early on, thinking it might act better. However, with X, I don't even get video output anymore... So I went back to KMS pretty quickly.

Yeah, I know this card is (very!) old, but pairing it with my also old Arcade monitor is quite nice.

I noticed your fork of that patch. I wouldn't be opposed to me forking that fork, and trying to bring that patch forward as needed, since it really is just me needing it.

However, I do not have that specific BIOS (hd6200.bin). Is it available somewhere where I can grab it? Or is that part of the problem, is that the file is just gone now?

Thanks again!

substring commented 1 year ago

cough https://drive.google.com/folderview?id=0B0NB2HYUHHktcDJiVmNPTGxEUE0&usp=sharing cough

Afair the arcadevga patch couldn't be applied anymore, but I'm not too sure ... I don't know if you're familiar with building kernels for Arch, but I may give a go this evening if you wish. That said, I don't think it will fix your issue, it's a driver level thing ... unless the PLLs fixes would help, I can't tell.

skilau commented 1 year ago

Thanks! I sent a request to (cough) get the file. :)

Back a number of years ago, I was the maintainer for an out of kernel serial board driver for the company I work at, so I am familiar with the "pains" of patching the kernel and bringing code up to the latest and greatest kernels.

If you are willing to try to do it, that would be awesome, otherwise, I can try doing it myself as well, the patch didn't look TOO horrible to try to bring in. Do you have a .config file you typically use to build the custom kernel after you apply the patches? Or do you just take the standard .config that I assume archLinux provides?

Thanks!

substring commented 1 year ago

You don't need a request to get the file, you just download it

I use the standard Arch .config file. But there are a number of other patches (for 15kHz and other related stuff)

skilau commented 1 year ago

For some reason, Google Drive is telling me "Access Denied", and only gives me button to "Request Access".

Are the only extra patches that you apply are from the https://github.com/D0023R/linux_kernel_15khz repo? Or are there more?

PS: Getting familiar with Arch's build system now, doing a test build on the stock kernel. (My arcade system is an old Bulldozer that I am building it on now, I may install a VM of Arch on my faster machine if this just takes too long to build)

substring commented 1 year ago

I don't run Arch on my everyday computer, but Ubuntu, so I use Docker to build packages for Arch/GroovyArcade. I'm afraid I'm the only one used to patching packages and have them built in Docker ... But still, check the packages repo, package/linux. It will get the linux PKGBUILD and other files, patch it to include 15kHz patches and then build.

hd2600.zip

skilau commented 1 year ago

Hi @substring !

OK. I can see what you mean, the old "02_arcadevga_3000.patch" no longer patches cleanly with the more current sources.

So I grabbed archLinux's latest kernel, (6.1.10), and modified the patch as needed to get a clean compile out of it, with the kernel building cleanly.

I have NOT actually tested it yet, as I am not set up yet to be able to build using your scripts and environment. (I will try setting that up later tonight/tomorrow).

Attached is the new patch file that should now patch cleanly. 02_arcadevga_3000_updated.patch

substring commented 1 year ago

OK I'll build it later today with this patch.

skilau commented 1 year ago

Awesome! Thank you so much!

substring commented 1 year ago

https://we.tl/t-VTOHaAGSZy

don't forget the bios file, the path is detailed in the patch you've fixed. Something like /usr/lib/firmware/radeon

skilau commented 1 year ago

Thank you for building it for me!

On the positive side, I was able to install the kernel, and boot into it properly, (I don't know ArchLinux well enough to be sure I knew how to do it)

However, it does NOT load the driver.

But, after digging a bit more into things, I can see why.

Apparently Andy @ Ultimarc must have made a few versions of the Arcade VGA 3000's. My Device ID and subsystem ID's do not match the patch for what we just did.

My Arcade VGA 3000 is:

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV370 [Radeon X600/X600 SE] (prog-if 00 [VGA controller]) Subsystem: Phison Electronics Corporation Device 1964

cat device subsystem_vendor subsystem_device

0x5b62 0x1987 0x1964

Whereas the patch wants: pdev->device == 0x958f pdev->subsystem_vendor == 0x1002 pdev->subsystem_device == 0x0502

So it is no wonder why it didn't try to load the patch.

Obviously we could patch the drivers to add my id's in there... But then, what about the special BIOS? The cards do not appear to be the same family (RV370 vs RV630), so my card would be unlikely to be able to load the special firmware...

Sadly, this might be a dead end, unless you might happen to have any ideas on this?

Thanks! Scott

skilau commented 1 year ago

Googling around, checking various arcadecontrol threads, etc, I think I understand what I have/what is going on.

Apparently I do not actually have a Arcade VGA 3000. Apparently I have an earlier version that Ultimarc produced called the ArcadeVGA2 PCIe.

Interestingly enough, I should have caught that earlier, because at boot, his card shows a quick screen of: "Ultimarc ArcadeVGA X550 BIOS V 1.0"

Is it possible that I do not actually need a special BIOS load for this card? That it already has it in place? At boot, the monitor shows the system starts at 15KHz. I am trying to find a game that typically runs at 15KHz, to see what it does.

substring commented 1 year ago

What I know is that these cards existed before I forked GroovyArcade and I wasn't involved in ctr gaming at that moment, so I lack experience and knowledge with all these relics from Ultimarc. So, for that specific BIOS, I really have no idea. That said, we typically encourage people to get at least a HD5450. The wiki has a compatibility page where we list all known cards that have been tested. For now, DC3 AMD cards do not have interlaced enabled as it requires some patch at driver level. But any card prior to DNC3 should work, although we couldn't test them all.

At boot : that card is flashed to boot the BIOS in 15kHz, this can be achieved with any supported card using atom15. But some people reported conflicts with in game modeswithing.

Try wrally, it's shipped with GA and runs at 15kHz.

ou need to enable DRM kernel log debugging to get na idea of which check wasn't passed (I hope I didn't remove the messages ... They were useful when i wrote the patch, but as no one had that problem since, I may have removed them)

skilau commented 1 year ago

Hi @substring, Oh, definitely thank you so much for all your help on this, I really appreciate it!

To be honest, everything works well enough games-wise, that getting/not getting the 15kHz stuff is quite minor.

My only remaining issue I need to figure out is when leaving MAME, and coming back to the Attract Mode frontend, Attract Mode seems to pick/land on a resolution (or something) that causes the Monitor to lose sync, and the picture stays black. I can only get it back by rebooting.

But what is interesting about it, is when it "goes and stays black", if I do a Ctrl-Alt-Delete, I actually get your "Groovy Arcade" shutdown screen just fine, as it is shutting down!

To me, this suggests that whatever resolution Attract Mode is picking when coming back out of MAME isn't supported by my monitor/card, but the resolution you pick for the "Groovy Arcade" logo screens (startup and shutdown) are fine.

Is there a way to find out what resolutions Attract Mode is using?

Actually, for that matter, is there a file/location that contains the resolutions that Groovy Arcade/Attract Mode/MAME thinks my video card and monitor supports?

(I ask for MAME as well, because I noticed on Defender, it is trying a resolution that makes my Arcade Monitor very unhappy, it loses the bottom 1/5 or so, and no matter what adjustments I make on the Monitor, those lines are just lost/gone)

Again, I really want to extend my thank you on all of this. I really appreciate you taking the time to answer my questions! Scott

substring commented 1 year ago

I'm wondering ... Here it looks like 400x288@52 is the problem, so :

Technically speaking, GM restores the original resolution before exiting, so AM should be all good. I don't think AM is supposed to modeswitch when resuming. If it had to, it would be to your boot resolution. But the "no device error" is worrying, what is the content of /dev/dri at that moment ?

skilau commented 1 year ago

Watching dmesg/kernel logs, when I have the problem where leaving MAME which then goes back to AM, I get this:

[ 118.661118] radeon 0000:01:00.0: [drm] User-defined mode not supported: "SR-1_512x224@60.10": 60 10430 512 533 582 665 224 233 236 261 0x20 0xa

What is interesting, is that with wrally, the first time I leave the game, I got back to the Attract Mode OK, even though I got this message: [ 120.187150] radeon 0000:01:00.0: [drm] User-defined mode not supported: "SR-1_368x232@60.00": 60 7485 368 383 418 478 232 237 240 261 0x20 0xa

But the 2nd time I went into wrally and then leave it, I got my blank screen/no signal detected, but another log message to dmesg: [ 157.286498] radeon 0000:01:00.0: [drm] User-defined mode not supported: "SR-1_368x232@60.00": 60 7485 368 383 418 478 232 237 240 261 0x20 0xa

As for my default resolution, I didn't change anything, so probably whatever GroovyArcade/AM selects... I think it is 800x600, although I am not positive of that.

substring commented 1 year ago

There are some unanswered questions in my previous post, please do answer them. Because I start to wonder if you really have some modeswitch happening

skilau commented 1 year ago

Hi @substring :

Sorry about that, yes, I owe you a number of things here.

I didn't set a default resolution when I installed, but I am assuming it is probably 640x480. I did select a "tri-sync monitor" (Options 21) in the settings. PS: My monitor is this one: https://retroblast.com/reviews/betson.html

For the ROMS/resolutions: Yes, on wrally, MAME does show that it properly got to 368x232. Interestingly enough, Defender now seems to display pretty darn close. It says it is running at 296x240.

Attached is the first log. It is the kernel log during when I am playing the game, and leaving the game, where the video goes to black, and the monitor loses sync/signal. Looking at the log, I am guessing I left the game -> AM at about 118.69 or so.

I don't know if I am reading the logs right, but it seems like it is trying to do: [ 119.486280] [drm:drm_mode_debug_printmodeline] Modeline "1280x240": 60 25200 640 656 752 800 480 489 492 525 0x60 0xa

My tri-sync monitor can do 31K at a max resolution of 800x600, so if the above message is right, that would be the reason my monitor can't get a picture...

dmesg.log.gz

skilau commented 1 year ago

Attached is another log, using wrally, as it gives us another resolution.

It also goes into the game just fine, and it definitely switches resolutions, as these old arcade monitors are extremely noisy when the switch resolutions/modes. So I know for sure it flipped to the 368x232 resolution. (Lots of click-click-clicks from the monitor)

But when it comes back out from MAME to AM, it just ends up a blank screen with "No signal detected".

I am still puzzled by grepping for Modeline, and seeing so many of these 1280x240's in there. I am really unsure where or why they are in there...

dmesg2.log.gz

skilau commented 1 year ago

Finally, here is a last log for the night. This one is interesting, because this run worked! MAME -> Attract Mode worked, and I was able to leave MAME, and AM came back and displayed its stuff again.

After it came back to the menu, I quit the logging, so the switching back should be close to the bottom.

(Different game however, so maybe it just happens that the game uses the same resolution as AM, and so it never had to switch?)

Thanks again for all your help on this!

dmesg3.log.gz

substring commented 1 year ago

Your logs show an abnormal number of errors, various ones, look for ret=-

The main one which I believe is the main problem, is

[  119.486232] [drm:drm_ioctl] comm="attractplus-kms" pid=759, dev=0xe200, auth=1, DRM_IOCTL_MODE_ADDFB2
[  119.486238] radeon 0000:01:00.0: [drm:drm_internal_framebuffer_create] driver does not support fb modifiers
[  119.486242] [drm:drm_ioctl] comm="attractplus-kms", pid=759, ret=-22

AM+ couldn't create a framebuffer

Another weird one:

[  779.904724] radeon 0000:01:00.0: [drm:drm_mode_getconnector] User-space requested a forced probe on [CONNECTOR:49:DVI-I-1] but is not the DRM master, demoting to read-only probe

For that 400x288 that returned an error, this mode has been validated earlier, but gets rejected at a point. For now, I have a feeling things are on AM+ side. But I'm afraid your hardware is not helping much either.

substring commented 1 year ago

When investigating further on the radeon driver, it doesn"t support fb modifiers, see here So I wonder why it's trying tu use it

skilau commented 1 year ago

Strange for sure. I grabbed attractplus source, tried grepping for that ioctl value, and don't see it. So I assume it must be an API call, that gets translated to that ioctl value later on.

I will admit, this is the first time I have looked at the DRM code, so I don't have much grasp of how it all works.

substring commented 1 year ago

Well, it's a little more complicated than AM+ handling all itself. It's AM+ -> SFML -> libdrm

Oomek and I have worked to get DRM support in upstream SFML, it's planned for 2.6, but these guyz are never in a hurry when talking about a release date ... The best is to checl Oomek's fork, branch 2.6.0 in src/Window/DRM if I'm not mistaken

But the thing is that this happens only to you ...

substring commented 1 year ago

Out of curiosity, is the ResFix plugin enabled in AM ?

skilau commented 1 year ago

Hi @substring, I just went and checked.

It is Enabled. (It and History.dat are the only things Enabled in "Plugins", everything else is Disabled)

I went and Disabled it, and tried things out... Turning it off fixes the problem!!!

I am able to go in and come out of Mame without any troubles, and the Video always come back in AM now!

Thank you for the suggestion!

PS: What the ramifications for turning this off?

substring commented 1 year ago

The fact is that this plugin fixes another problem for some people. The problem seems to occur only on KMS

skilau commented 1 year ago

@substring Just wanted to come back and say thank you again for you telling me about disabling ResFix! It totally fixes the problem, and my arcade machine is working perfectly now! I will close this issue. Thanks again!

substring commented 1 year ago

Just for curiosity: can you remind me your backend (X/KMS) and the layout you were using ?

skilau commented 1 year ago

@substring Sorry for the delay. Meant to respond earlier!

I use KMS for the backend. (I believe at one point, I tried X, and wasn't even able to get into AttractMode at all with it)

The layouts I used were "Basic" and "Reflect". (I have now decided I like "Reflect" the best)