Open cyberluke opened 2 years ago
Hi cyberluke,
arcade_15 and generic_15 are not the same. arcade_15 has a wider horizontal frequency range. These presets are needed for arcade systems. Most arcade systems had non-standard refresh rates.
Your custom preset is perfectly fine for emulating consoles, though.
Interlaced modes are problematic to make look fine on some screens. I don't think it's a matter of having an exact 50 Hz match (in fact you don't have it in either of your examples, because the pixel clock shown is just an approximation of the final value the hardware actually produces).
The problem probably has to do with vertical fields parity. Some monitors are sensitive to some combinations of even/odd fields. It also depends on the gpu hardware, as we're finding lately.
From your post in RA's repo, you have:
This looks BAD:
Modeline “704x576_50i 15.677190KHz 50.006985Hz” 14.344628 704 733 800 915 576 583 589 627 interlace -hsync -vsync
This looks OK:
Modeline “704x576_50i 15.625000KHz 50.000000Hz” 13.531250 704 724 788 866 576 582 587 625 interlace -hsync -vsync
I notice that in the first case, you have an odd vbegin field. In the second case, vbegin is even. So, I'd try this: change the first modeline to make vbegin even, and force SR to use it to see if that's the problem:
Edit switchres.ini
, and change the line modeline auto
to: modeline “704x576_50i 15.677190KHz 50.006985Hz” 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
I understand the difference between generic_15 and arcade_15, but generic_15 is currently not for NTSC+PAL TV such as Sony PVM.
I am not emulating consoles. I am emulating Amstrad CPC, ZX Spectrum, Nintendo, Super Nintendo and PS1. With that in mind, my fix above resolves the issue.
I have experimented with all switchres.ini configuration, including combinations. Total work spent of 40 hours. Including the odd fix for AMD GPU (interlace_force_even 1). I'm using CRT EmuDriver, so you probably know that I have AMD GPU as well as Windows 10.
The modeline you say look bad is generated by your library! 704x576_50i 15.677190KHz 50.006985Hz
I did not create it!
This happens when using your generic_15 preset as I pointed out. So that preset is not good, not correct. It generates out of spec PAL interlaced resolution. Therefore that is probably what this bug should be mainly about.
So you want me now to change back to generic_15 preset and add modeline “704x576_50i 15.677190KHz 50.006985Hz” 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
to switchres.ini and it will use that when generating modelines on the fly?
Also if you watch my whole video, the conclusion was that it is also helpful to set interlace 0
in switchres.ini as for Amstrad CPC it will choose 288p instead of 576i when rounding from 272p. Therefore providing much better result out of the box. Interlaced should be enabled only for game consoles (mostly PS2 and similar) that produce 480i output. Yes, it will print warning about stretching, but that is like 0.976 and the result look same as interlaced with jumping flickery vertical line, but without the flickering.
This is very interesting! I don't think it's a matter of having an exact 50 Hz match (in fact you don't have it in either of your examples, because the pixel clock shown is just an approximation of the final value the hardware actually produces).
- I found some modelines generators online, but only for 31kHz. Is there some tool?
Or can you share modeline that would be exact 50 Hz match as well, so I can compare it with the findings here?
I tried to use ArcadeOSD as well, but changing values will only adjust V Size and H Size. It never changes the actual refresh rate when choosing Test in the menu. I believe it might be some additional bug. Therefore I had to always play with switchres.ini and do full application start and exit.
BTW interlace_force_even 1 only inverts the lines of the text that are 'jumping'
Cyberluke,
Please I beg you to follow my instructions above, to see if we can get some useful information to improve SR.
I know the modelines were created by SR. I'm just trying to understand why some values look good in your monitor while some do not.
Please keep in mind this is NOT a bug. Those modelines look perfect on other CRTs. But we could try to circunvent the issue if we understood the reason why some monitors (or combinations of gpu+monitor) don't play well with interlaced modes.
Or can you share modeline that would be exact 50 Hz match as well, so I can compare it with the findings here?
You can't get 50 Hz exactly due to limitations in the accuracy of real world pixel clocks. But don't focus on that. Monitors don't care about those tiny deviations.
Ok, I will use generic_15 in switchres.ini and change the modeline from auto to the specific one you supplied.
Sidenote: I don't agree those modelines look perfect on other CRTs. I have Sony PVM 20L2, tried also 20M2 last year (different calibration menu, same issues). Today I will have 14M2 and also some JVC semi-professional TV. So I will verify that. So far all CRTs show same symptoms. I would only agree that it would look perfect on arcade CRTs. So my assumption is based on this product as a whole product line, not only one specific device with different calibration.
Sidenote 2: Here is a video of calibration of that TV. Here is interesting part about deflection. You see when the menu text becomes distorted. I have already resolved that. But it is needed to tweak it sometimes, when the resolution will change. Inside TV there is some center knob (he shows it in 20 seconds) - that could also help a little in some cases. https://youtu.be/o-MquBghtDg?t=354
First it did not switch to that modeline.
I had to disable modeline generation otherwise it would say that no suitable modeline found and will not even switch it.
# Enable on-the-fly generation of video modes
modeline_generation 0
Now it switches, but it still have issues:
[libretro-cap32]: Got size: 768 x 272 (s4 rs417792).
[INFO] [CRT]: Requested Resolution: 768x272@50.006985
[INFO] [CRT]: Current running core cap32
[INFO] sr_refresh_display: no refresh required
[INFO] set_desktop_mode: \\.\DISPLAY2 (352x576@51) flags(2)
[INFO] sr_switch_to_mode: successfully switched to 352x576@51.108589
[INFO] [CRT]: Resolution is stretched. Fractal scaling @ X:0.458333 Y:2.117647
[INFO] [CRT]: Setting Aspect Ratio: 0.611111
[INFO] [CRT]: Setting Video Screen Size to: 352x576
[INFO] [Video]: Setting refresh rate to: 51.109 Hz.
The refresh rate is different and it does not print what modeline it wants to use.
Can you be more specific how to force that particular modeline with that particular refresh rate?
Ok, another bug:
This has to be set to auto:
crt_range0 auto
crt_range1 auto
Even comment says it will be applied only when monitor=custom. It is applied even when monitor=generic_15.
Now it is not flickering, but the vertical refresh rate seems to be calculated on its own (probably should not matter as you say):
[INFO] [CRT]: Requested Resolution: 768x272@50.006985
[INFO] [CRT]: Current running core cap32
[INFO] Switchres: Modeline "704x576_50i 15.677000KHz 50.006380Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
[INFO] sr_refresh_display: no refresh required
[INFO] set_desktop_mode: \\.\DISPLAY2 (704x576@50) flags(2)
[ERROR] ChangeDisplaySettingsExA error(fffffffe)
[ERROR] sr_switch_to_mode: error switching to mode
[INFO] [CRT]: SR failed to switch mode[INFO] [CRT]: Resolution is stretched. Fractal scaling @ X:0.916667 Y:2.117647
[INFO] [CRT]: Setting Aspect Ratio: 1.222222
[INFO] [CRT]: Setting Video Screen Size to: 704x576
[INFO] [Video]: Setting refresh rate to: 50.006 Hz.
[INFO] [Video]: Frame delay reset to 1.
But there is some error and resolution is stretched, so it looks much worse than any other case. Also TV reports it is in 480/60i mode, while it should be in 576/50i mode - that's why I don't see it flickering.
Screenshot from iPad below:
Basically I cannot force any modeline, same error here with previously OK settings:
monitor generic_15
crt_range0 auto
crt_range1 auto
modeline modeline "704x576_50i 15.625000KHz 50.000000Hz" 13.531250 704 724 788 866 576 582 587 625 interlace -hsync -vsync
refresh_dont_care 1
modeline_generation 1
interlace 1
sync_refresh_tolerance 1.00
LOG output
[INFO] Switchres: Modeline "704x576_50i 15.625000KHz 50.000000Hz" 13.531250 704 724 788 866 576 582 587 625 interlace -hsync -vsync
[INFO] sr_refresh_display: no refresh required
[INFO] set_desktop_mode: \\.\DISPLAY2 (704x576@50) flags(2)
[ERROR] ChangeDisplaySettingsExA error(fffffffe)
[ERROR] sr_switch_to_mode: error switching to mode
You wrote:
modeline modeline "704x576_50i 15.625000KHz 50.000000Hz" 13.531250 704 724 788 866 576 582 587 625 interlace -hsync -vsync
Instead, you have to write:
modeline "704x576_50i 15.625000KHz 50.000000Hz" 13.531250 704 724 788 866 576 582 587 625 interlace -hsync -vsync
Obviously, the interlace
option in switchres.ini must be enabled.
Even comment says it will be applied only when monitor=custom. It is applied even when monitor=generic_15.
No.
Ah, my mistake! :-)
Settings 1:
modeline "704x576_50i 15.625000KHz 50.000000Hz" 13.531250 704 724 788 866 576 582 587 625 interlace -hsync -vsync
LOG:
[INFO] [CRT]: Requested Resolution: 768x272@50.006985
[INFO] [CRT]: Current running core cap32
[ERROR] Switchres: could not find a video mode that meets your specs
[INFO] sr_switch_to_mode: switching not required
Settings 2:
modeline "704x576_50i 15.677190KHz 50.006985Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
LOG:
[INFO] [CRT]: Current running core cap32
[INFO] Switchres: Modeline "704x576_50i 15.677000KHz 50.006380Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
[INFO] sr_refresh_display: no refresh required
[INFO] set_desktop_mode: \\.\DISPLAY2 (704x576@50) flags(2)
[ERROR] ChangeDisplaySettingsExA error(fffffffe)
[ERROR] sr_switch_to_mode: error switching to mode
[INFO] [CRT]: SR failed to switch mode[INFO] [CRT]: Resolution is stretched. Fractal scaling @ X:0.916667 Y:2.117647
[INFO] [CRT]: Setting Aspect Ratio: 1.222222
[INFO] [CRT]: Setting Video Screen Size to: 704x576
[INFO] [Video]: Setting refresh rate to: 50.006 Hz.
[INFO] [Video]: Frame delay reset to 1.
Same result, in the end.
# Enable on-the-fly generation of video modes
modeline_generation 1
# Allow interlaced modes (existing or generated)
interlace 1
In those cases, I often open VMMaker, delete all existing modelines. Create my custom modelist.txt - change that one specific timing for that specific resolution. Export modelist.txt to the driver. Disable modeline generation in switchres.ini => then it might use it, but will probably throw the same error.
It should be setting the modeline in switchres.ini.
Could you post the full log, using this modeline "704x576_50i 15.677190KHz 50.006985Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
Full log - first is boot to RetroArch menu. Second is running Amstrad CPC emulator hence two times switching to modeline. full_log_1.txt
Switchres.ini (renamed to txt for uploading here) switchres.txt
Attaching DEBUG logs (switchres.ini verbosity=3). Sometimes it crash, sometimes it hangs up, but mostly it works. full_log_2_verbosity_3.txt
Thanks, I can see where the problem is. RA's SR version is old, there was a bug in the modeline to crt_range function. That's now been fixed in SR, but not in RA yet.
You're getting:
Switchres(v2.002) display[0]: monitor[generic_15] generation[on] SwitchRes: user modeline "704x576_50i 15.677000KHz 50.006380Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync Switchres: Monitor range 0.00-0.00,0.00-0.00,2.022,4.671,8.017,0.510,0.319,2.424,0,0,0,0,576,576
You should be getting:
Switchres: display[0] options: monitor[generic_15] generation[on] SwitchRes: user modeline "704x576_50i 15.625000KHz 50.000000Hz" 13.531250 704 724 788 866 576 582 587 625 interlace -hsync -vsync Switchres: Monitor range 15562.50-15687.50,49.80-50.20,1.478,4.730,5.764,0.192,0.160,1.216,0,0,0,0,576,576
So, forget about SR/RA by now.
Please user Arcade OSD by now.
Select this text modeline "704x576_50i 15.677000KHz 50.006380Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
Press CTRL+C
Launch Arcade OSD, and select Get mode from clipboard
.
1) This modeline does not seem to be a solution, the original PAL works better. 2) ArcadeOSD version is 2.0 beta 15 (should be latest, downloaded from Calamity’s forum thread)
adjusting V retrace end does not have any visible impact - the issue is the dotclock 14.344626 - that is out of spec for PAL, 15.625kHZ. That is for arcade crt maybe.
changing dot clock somewhere around 14.20mhz equals to 15.570khz and that is better. But it is still not exactly PAL spec 15.625khz. I cannot get to it.
this gives better results
But I need to tweak it, it still does not match exactly to PAL specification, which seems to be very important for interlaced modes.
This modeline is not the one I asked you to test. Did you use the Get mode from clipboard
option?
Yes, I did, but it did nothing. ArcadeOSD is buggy as well. I'm going to clone RetroArch repo, replace their old SwitchRes source files, download MingW compiler and dependencies and recompile everything myself. That will be faster. I have experience only with Java, Python, Visual Studio (C++ and .NET and Windows kernel driver compilation), so I don't have mingw currently installed.
Could you please help me to find the root of this problem? Can you please follow my instructions with Arcade OSD?
Ok, I'm recording video right now....
Get mode from clipboard
didn't work because the existing mode label in the system is 704x576@51. We have to match our modeline label with that, so the modeline is loaded in that "slot". Copy this text with CTRL+C:
modeline "704x576@51i 15.677000KHz 50.006380Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
Then use Get mode from clipboard
in Arcade OSD
Ok, I'm recording video right now....
Please don't bother, just follow my advice so we can reach somewhere.
Yes, you are correct! It switched now. But still the same flicker. Not as good as original PAL mode. I noticed dotclock and frequencies are not correct. I will need to probably regenerate this modeline, so it has 50hz, not 51hz. This was generated from generic_15 preset in vmmaker.
I tried changing the dotclock but cannot set exactly 14344628. Still same flicker.
I will just import that modeline to driver using vmmaker,
Cyberluke,
When you copied the modeline from the clipboard, the refresh should be 50, not 51. Something went wrong. Please set the modeline above in Arcade OSD, and before doing anything else, let me know.
Let me explain it better: I need you to set this modeline in Arcade OSD: modeline "704x576@51i 15.677000KHz 50.006380Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
And once it's on screen, I'd like to ask you to change certain values.
I don't care if it jumps, that's not the purpose of this test. I want to change params and see if they have an effect.
Yes, changing params do have effect.
I have manually edited modelines using VMMaker. Export from driver. Remove 51i, add your 50i variation. Delete all modes from the driver and then import modes from my txt file and install these. Now I don’t have to copy anything from the clipboard and I see it here:
But instead of 15.677khz, there is 15.672khz.
Ok perfect.
Now, with that modeline set, do you still have the same problem?
Yes, I have. I'm trying to tweak V retrace Start and V reatrace End values as you said.
For reference, this is the original PAL modeline that is ok:
"704x576_50 15.62KHz 50.00Hz" 13.62 704 728 792 872 576 582 587 625 interlace +hsync +vsync
The biggest difference is adjusting the dotclock from 14.34 to 13.62. That solves the flickering. The retrace stuff does not seem to make any visible change.
Ah, got it! I had to change V total from 627 to 625 and it is better now. PAL must have 625 lines.
V retrace start and end can be 584 and 589 or 582 and 587. That does not matter. 583 and 590 does not matter as well. The only thing that matters is to have total number of lines 625.
Ok
I need you to set the original modeline: "704x576@51i 15.677000KHz 50.006380Hz" 14.344628 704 733 800 915 576 584 589 627 interlace -hsync -vsync
And when you have it on the screen, send me a message back saying: Antonio, I have it on the screen, tell me what to do.
This is my last attempt :)
Ok ok! :-)
I was expecting Generic_15 will generate 525 lines for NTSC and 625 lines for PAL as it is mentioned here in dropdown menu. But it generates 523 for NTSC and 617 for PAL
PAL and NTSC are broadcast standards. They are meaningless for us.
It's only due to a (theoretical) limitation in your monitor's hardware/firmware that deviations might matter.
The generic_15 preset doesn't follow any standard, it just tries to meet the limits defined in the preset.
Antonio, I have it on the screen, please tell me what to doooo
Ok.
First experiment: go back to Vertical Geometry, and try moving de picture up and down, one line by one line.
Expected result (based on your previous comments): no change in flicker.
Let me know when you finish.
Yes, Antonie, that’s right. Changing V center in Vertical geometry menu by one step in range +5 and -5 produce same results.
but it was possible to get a working combination if V total equals to 625
Ok, please go back to starting point, and let me know.
I have identified the issue in SwitchRes, including RetroArch dependency SwitchRes and recorded Youtube video.
Here I present the cause as well as solution!
But further development will be probably necessary to provide a better user experience and configuration properties.
https://www.youtube.com/watch?v=Xv5u-JPKDS0
In a nutshell: generic_15 and arcade_15 are now the same, which does not make any sense.
arcade_15 has different frequency range than regular NTSC/PAL
generic_15 should encapsulate regular NTSC/PAL frequencies, which it currently doesn't.
Acceptance criteria: generic_15 profile will use 15.625000KHz 50.000000Hz for PAL resolutions and 15.73KHz 59.94Hz for NTSC
Initialy I started my bug hunt here: https://github.com/libretro/RetroArch/issues/14441