-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switchres should use correct monitor type and alter between NTSC and PAL properly #96
Comments
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: 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 |
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! 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 |
Also if you watch my whole video, the conclusion was that it is also helpful to set |
This is very interesting! 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.
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: Sidenote 2: |
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.
Now it switches, but it still have issues:
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:
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):
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:
LOG output
|
You wrote: Instead, you have to write: |
Obviously, the
No. |
Ah, my mistake! :-) Settings 1:
Settings 2: LOG:
Same result, in the end. |
|
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 |
Full log - first is boot to RetroArch menu. Second is running Amstrad CPC emulator hence two times switching to modeline. Switchres.ini (renamed to txt for uploading here) |
Attaching DEBUG logs (switchres.ini verbosity=3). Sometimes it crash, sometimes it hangs up, but mostly it works. |
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: |
So, forget about SR/RA by now. Please user Arcade OSD by now. Select this text Press CTRL+C Launch Arcade OSD, and select |
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. |
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 |
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? |
Ok, I'm recording video right now.... |
Then use |
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: 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 :) |
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. |
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. |
Ok, please go back to starting point, and let me know. |
Nice. Now, set Lock Vfreq to yes. Go back to Edit modeline menu, and test these V total values: 624, 625, 626 |
623 - shaking 30% |
Ok. What if you go below 623? E.g. 621, 622? |
I tried to go down to 613. Some of them shake a lot, some of them shake less. But none of them gives same results as 625. With 625 lines, it has currently the best properties. |
Good. Next test. Back to the starting point. Now we're going to check whether it's Vfreq dependent or not. Edit Modeline-> set Vtotal to 625 Start increasing the dotclock, and go testing values. Increase it a lot too until you reach 52 or 53 Hz and test. See if the variation of vfreq, while keeping v total constant, has an effect on flicker. |
Of course with non-interlaced resolutions you can play these tricks and it will be ok. But I guess for interlaced resolution you want to have total number of lines by the spec. Also this is a regular professional broadcast monitor calibrated for that, it is not arcade monitor. ok, will do, thank you Antonio |
So adjusting dotclock moves V Hz as well as H kHz Regarding the vertical: I went down to 48hz and it was ok. In the extreme cases, adjusting Deflection HFV Control helped. But V total lines needs to be 625. When changing V total lines to anything else than 625, even adjusting deflection parameters on TV will not help. That was the first thing I always tried. So I would say it is not Vfreq dependant. |
So, despite going out of sync on extreme cases, and other geometry distorsions, the flicker didn't change? |
Correct, did not change. |
Ok, thanks for doing these tests. So, it looks like, as you said, your monitor requires exact 625 vtotal to handle interlace correctly. Keep in mind that this is a feature of this monitor. Other monitors or consumer TVs are perfectly happy with random vtotal values. Now, the problem is SR has no method for setting a fixed vtotal. In fact, vtotal is a free field that is used in its computations to match the target refresh. So, the only way to set a fixed vtotal is through the pal/ntsc presets, that are extremely limited and useless in practice. But since the purpose of this is only addressing the issue with interlaced modes, we can make a combination of pal and ntsc, as you already did, but only for interlaced modes, and use generic_15 for progressive modes. It would look like this:
|
Ok, thank you very much Antonio. I just got JVC TM-A10E-K 10'' (PAL only, 50Hz) and Sony PVM 14M2 today. So I will retest on these. I would not be surprised if this issue occurs on more TVs. For example I tried to survive this for a year and was thinking that this is happening because interlaced resolution is like that by default. It would be great if these three ranges could be a part of some new profile for NTSC+PAL professional TVs such as Sony PVM. Now I need to focus on a code somewhere else, but I will retest everything once more, probably during the weekend. |
I just briefly check Amstrad CPC emulator boot and it looks better. Beware that there is additional issue that applies to SwitchRes in general: This mode Now I verified: changed to generic_15 instead of custom in switchres.ini and I get this: I would say this is definitely another bug that will apply to all users. The stretching happens in both configurations: The algorithm should favor the first stretching case Y~=1 is better than Y~=2 |
Make sure you have restored Once you do that, if things keep behaving strange for 768x272, please post a full log. |
Yes, of course I have restored modeline to auto and this is happening always. In fact this is the reason why I discovered 576i mismatch - because the emulators keep switching to it quite often in some cases. I will post full log tomorrow. |
Hi Antonio, I'm sharing a full debug log. When using generic_15 profile, with default switchres.ini configuration, it will choose incorrect priority modeline. It will choose 576i while it should select 288p. It will select correct 288p only if:
It happens only for some emulators. For example ZX Spectrum (Fuse) is OK. While Amstrad CPC is not ok and this log contains that one: |
Tested using latest stable Retroarch 1.19.1 (released two weeks ago), this configuration works the best for me: monitor.ini
user_modes.ini
Everything works out of the box and no individual core configuration needed. Amstrad CPC has interlaced PAL mode, NES has NTSC mode, Amiga works as well, etc. |
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: libretro/RetroArch#14441
The text was updated successfully, but these errors were encountered: