Scaler

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, spiny, Greenious, Sorgelig, Moderator Team

JamesF
Atari User
Atari User
Posts: 33
Joined: Sat Dec 15, 2018 6:46 am

Re: Scaler

Postby JamesF » Mon Jan 14, 2019 8:25 pm

@profd

Code: Select all

video_mode=2560,48,32,80,1440,3,5,33,241699

That's from Nvidia custom resolution, CVT reduced blank.

Grabulosaure
Atari freak
Atari freak
Posts: 61
Joined: Tue Sep 05, 2017 9:35 pm
Contact:

Re: Scaler

Postby Grabulosaure » Mon Jan 14, 2019 8:46 pm

JamesF wrote:@profd

Code: Select all

video_mode=2560,48,32,80,1440,3,5,33,241699

That's from Nvidia custom resolution, CVT reduced blank.


The hardware, both the FPGA and HDMI encoder, can barely reach 200MHz (which is far better than expected, and beyond the datasheet specs.). Mister software enforces 200MHz as max. freq.

Independently from that, there is a limit on horizontal resolution, around 2040 pixels (not exactly 2048, because prefetching, rubber elasticity, lunisolar precession, ...). To go beyond that, the cores must be recompiled with .OHRES(4096) as a parameter to the scaler (without that, it shows a clipped image).

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3513
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Mon Jan 14, 2019 8:55 pm

Grabulosaure wrote:the cores must be recompiled with .OHRES(4096) as a parameter to the scaler (without that, it shows a clipped image).

This will double the BRAM usage by scaler which is too much. And since frequencies beyond 200MHz are unreal for ADV7513 (165MHz max from datasheet), there is no point to compile with 4096.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3513
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Scaler

Postby Sorgelig » Mon Jan 14, 2019 9:00 pm

Currently there are no cores which can output native resolution higher than 1280x720. So there is no point to set output resolution to 2K or 4K.
It's enough to set 1/4 resolution of your TV, so for 2560x1440 TV it's enough to set 1280x720 and let the TV to do integer 2x scale. So no artifacts will be added by such scale (if you will set appropriate video type in TV settings).
The same for 4K 3840x2160 TV you can use 1920x1080 resolution with 2x integer scale by TV.

bitfan2011
Atari User
Atari User
Posts: 32
Joined: Sat Dec 29, 2018 5:46 pm

Re: Scaler

Postby bitfan2011 » Mon Jan 14, 2019 11:12 pm

Sorgelig wrote:Currently there are no cores which can output native resolution higher than 1280x720. So there is no point to set output resolution to 2K or 4K.
It's enough to set 1/4 resolution of your TV, so for 2560x1440 TV it's enough to set 1280x720 and let the TV to do integer 2x scale. So no artifacts will be added by such scale (if you will set appropriate video type in TV settings).
The same for 4K 3840x2160 TV you can use 1920x1080 resolution with 2x integer scale by TV.


Yeah, I changed the.ini to 1280x1024 for use with my 1600x1200 displays. 1:1 mode looks super clean, so I can always do aspect scaling via the display to fill the screen. 5x scaling can look great IMO, but too sharp for some people when using scanlines. I guess they like a tiny amount of blur.

User avatar
Newsdee
Atari God
Atari God
Posts: 1280
Joined: Fri Sep 19, 2014 8:40 am

Re: Scaler

Postby Newsdee » Tue Jan 15, 2019 1:02 am

Grabulosaure wrote:
Newsdee wrote:Implementing filters on an emulator to post-process dithering

Do you have any link ? I don't quite understand.
A design limitation is that horizontal and vertical interpolations are separate, it's two vectors, not a matrix.

I dug a bit deeper and it's the gdapt and mdapt shaders found in Retroarch. Here is a writeup about them: https://forums.libretro.com/t/mdapt-gda ... -06-14/375

Grabulosaure
Atari freak
Atari freak
Posts: 61
Joined: Tue Sep 05, 2017 9:35 pm
Contact:

Re: Scaler

Postby Grabulosaure » Tue Jan 15, 2019 1:29 am

Newsdee wrote:I dug a bit deeper and it's the gdapt and mdapt shaders found in Retroarch. Here is a writeup about them: https://forums.libretro.com/t/mdapt-gda ... -06-14/375


Looks nice.

If it keeps the original resolution, it could be rather implemented as something upstream from the scaler, like the HQ2x effects, and added only on cores where it is useful. Using it upstream allows to limit buffer sizes to the source resolution and run at lower frequency than the scaler.
Seems doable.

paulbnl
Retro freak
Retro freak
Posts: 12
Joined: Wed Oct 24, 2018 9:43 am

Re: Scaler

Postby paulbnl » Tue Jan 15, 2019 11:02 am

Mostly the low latency vsync_adjust=2 has been working well but sometimes there is tearing in the middle of the screen. Usually after a few minutes or sometimes from the start.

Also a lot of times the scaler will just output a single color screen (mostly black) and I have to reboot the system to make it work again. The menu still works when that happens.

JamesF
Atari User
Atari User
Posts: 33
Joined: Sat Dec 15, 2018 6:46 am

Re: Scaler

Postby JamesF » Tue Jan 15, 2019 11:41 am

Are you sure vsync_adjust=2 is working now with all cores?
I think you need the special cores by Grabulosaure to activate the low latency mode, the official cores do not support low latency mode yet, afaik.
If I understood Grabulosaure correctly, the current implementation is triple buffered hence 1-3 frames of lag.

edit:
I can't find any information on what the vsync_adjust=2 mode does, maybe the PLL discussion earlier in this thread is somehow related.
If I understood correctly this mode will align the sync signals from the core and scaler, thus removing tearing from the visible region while working with a single buffer.

@ Grabulosaure, Sorgelig
Can you please clarify what the vsync_adjust=2 mode actually does?

paulbnl
Retro freak
Retro freak
Posts: 12
Joined: Wed Oct 24, 2018 9:43 am

Re: Scaler

Postby paulbnl » Tue Jan 15, 2019 6:06 pm

JamesF wrote:Are you sure vsync_adjust=2 is working now with all cores?
I think you need the special cores by Grabulosaure to activate the low latency mode, the official cores do not support low latency mode yet, afaik.
If I understood Grabulosaure correctly, the current implementation is triple buffered hence 1-3 frames of lag


At least NES and SNES have been updated with low latency scaler.

In MiSTer.ini it is said that vsync_adjust =2 uses a single buffer.

cacophony
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 112
Joined: Sun Jul 22, 2018 11:14 pm

Re: Scaler

Postby cacophony » Tue Jan 15, 2019 6:17 pm

paulbnl wrote:
JamesF wrote:Are you sure vsync_adjust=2 is working now with all cores?
I think you need the special cores by Grabulosaure to activate the low latency mode, the official cores do not support low latency mode yet, afaik.
If I understood Grabulosaure correctly, the current implementation is triple buffered hence 1-3 frames of lag


At least NES and SNES have been updated with low latency scaler.

In MiSTer.ini it is said that vsync_adjust =2 uses a single buffer.


I don't think it's actually working yet with vsync_adjust =2 and the release cores based on my testing and conversations with Grabulosaure.

These were the instructions that I got from Grabulosaure on 12/26:

"I have posted on temlib.org/pub/mister/ascal a version of SNES which blinks LEDs when buttons are pressed. The low lag mode has issues with the default settings with 148.5MHz clock, if you need 1920x1080@60Hz, use instead something like "video_mode=1920,48,32,80,1080,123,6,26,154130" . Select NTSC, no triple buffer, no vsync_adjust."

I did confirm that it seemed to work with that special LED build after following those instructions.

JamesF
Atari User
Atari User
Posts: 33
Joined: Sat Dec 15, 2018 6:46 am

Re: Scaler

Postby JamesF » Tue Jan 15, 2019 7:33 pm

paulbnl is right,, if you look at the update changlog thread you will see "Update the Scaler" where Sorgelig added pll_hdmi_adj.vhd file which is responsible for the low latency mode according to two pages discussion on this thread about PLL.
You can find this file in /sys/ directory in each core source code so you know which one has this feature.
So far Snes, Nes, Genesis, Turbografx16, Amiga, C64 definitely have been updated with low latency mode.

I should say low latency mode works quite nice aside from the occasional bugs paulbnl already mentioned.

Grabulosaure
Atari freak
Atari freak
Posts: 61
Joined: Tue Sep 05, 2017 9:35 pm
Contact:

Re: Scaler

Postby Grabulosaure » Tue Jan 15, 2019 7:45 pm

vsync_adjust=2 is experimental.
The version of hdmi_pll_adj (which tweaks the PLL frequency continually to align signals) currently in use was only really tested on Genesis/Megadrive (outputting the syncros on the SDRAM bus, and checking with a scope...). It doesn't work well with some frequency settings, has very slow convergence. And it is very difficult to know if it really works without an oscilloscope, or two CRTs connected to HDMI and analog out and a fast camera, ...

I will post an updated version of hdmi_pll_adj with the fixes to the scaler (line on the right, 30Hz interleaved video).
It will hopefully work better.
[Maybe one of the 8 LEDs on the DE10 could be used as a visual indication of synchro. state]

paulbnl
Retro freak
Retro freak
Posts: 12
Joined: Wed Oct 24, 2018 9:43 am

Re: Scaler

Postby paulbnl » Tue Jan 15, 2019 9:57 pm

cacophony wrote:I don't think it's actually working yet with vsync_adjust =2 and the release cores based on my testing and conversations with Grabulosaure.

These were the instructions that I got from Grabulosaure on 12/26:

"I have posted on temlib.org/pub/mister/ascal a version of SNES which blinks LEDs when buttons are pressed. The low lag mode has issues with the default settings with 148.5MHz clock, if you need 1920x1080@60Hz, use instead something like "video_mode=1920,48,32,80,1080,123,6,26,154130" . Select NTSC, no triple buffer, no vsync_adjust."

I did confirm that it seemed to work with that special LED build after following those instructions.


I think what you are talking about is a separate low latency mode.

I have made photos with the HDMI vsync_adjust=2 output to a LCD monitor and a CRT connected to the VGA output and the latency varies between 0 and 1 frames max.

cacophony
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 112
Joined: Sun Jul 22, 2018 11:14 pm

Re: Scaler

Postby cacophony » Wed Jan 16, 2019 2:22 am

paulbnl wrote:
cacophony wrote:I don't think it's actually working yet with vsync_adjust =2 and the release cores based on my testing and conversations with Grabulosaure.

These were the instructions that I got from Grabulosaure on 12/26:

"I have posted on temlib.org/pub/mister/ascal a version of SNES which blinks LEDs when buttons are pressed. The low lag mode has issues with the default settings with 148.5MHz clock, if you need 1920x1080@60Hz, use instead something like "video_mode=1920,48,32,80,1080,123,6,26,154130" . Select NTSC, no triple buffer, no vsync_adjust."

I did confirm that it seemed to work with that special LED build after following those instructions.


I think what you are talking about is a separate low latency mode.

I have made photos with the HDMI vsync_adjust=2 output to a LCD monitor and a CRT connected to the VGA output and the latency varies between 0 and 1 frames max.


Maybe things have changed but on 12/26 when I did some tests with a 240fps camera I was getting an additional lag of 2 frames with vsync_adjust=2 compared to the instructions I quoted above. Perhaps I should retest with latest software.

JamesF
Atari User
Atari User
Posts: 33
Joined: Sat Dec 15, 2018 6:46 am

Re: Scaler

Postby JamesF » Wed Jan 16, 2019 5:20 am

@cacophony
If you look at the changelog you'll see that most cores (including Genesis) have been updated with pll_hdmi_adj.vhd on Dec 31, so vsync_adjust=2 didn't do anything on the Genesis core back in Dec 26.
Also, as Grabulosaure said, the convergence (synchronization) time is slow on other cores besides Genesis, but he's working on it, hence the experimental label.

cacophony
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 112
Joined: Sun Jul 22, 2018 11:14 pm

Re: Scaler

Postby cacophony » Wed Jan 16, 2019 6:46 am

JamesF wrote:@cacophony
If you look at the changelog you'll see that most cores (including Genesis) have been updated with pll_hdmi_adj.vhd on Dec 31, so vsync_adjust=2 didn't do anything on the Genesis core back in Dec 26.
Also, as Grabulosaure said, the convergence (synchronization) time is slow on other cores besides Genesis, but he's working on it, hence the experimental label.


Yep, makes sense.

I don't have a good way to compare to Genesis, but I just did comparisons for NES and SNES, relative to the Nt Mini and SNT connected to the same display. I used the updater script to update everything first (including the kernel, the linux filesystem and bootloader), and did the setting as recommended in the config file (vsync_adjust=2, and FWIW video_mode=8).

For NES the results were near identical in terms of lag, and for SNES the MiSTer was somewhat laggier. But as you say, this convergence issue is known and it's being worked on :cheers:


Return to “MiSTer”

Who is online

Users browsing this forum: high5 and 2 guests