Main > Software Forum

[Discontinued][17-09-22] RatRefresh - refresh rate switcher, stops LCD tearing

<< < (7/31) > >>

Rataplan626:

--- Quote from: headkaze on February 09, 2017, 03:35:46 pm ---Okay I added an "Advanced Mode" to my utility which uses those calculations. I parse "vscanrate" as a double and pass it to set_AddCustomMode without modification. Sorry but I have not tested "Advanced Mode" yet. Also you need to have Intel HD Graphics Control Panel installed for this to work as I do not include igfxDHLib.dll or any other library this app may depend on.


--- Code: ---IntelAddCustomMode v1.0 - by headkaze

USAGE: IntelAddCustomMode.exe mode=<basic|adv|list|remove> [options]

Basic Options:

[width=n]                               Width
[height=n]                              Height
[refreshrate=n]                         Refresh Rate
[interlaced=true|false]                 Interlaced Mode
[underscan=n]                           Underscan Percentage
[timing=gtf|cvt|cvtrb|cea861]           Timing standard

Example: IntelAddCustomMode mode=basic width=800 height=600 refreshrate=60

Advanced Options:

[interlaced=true|false]                 Interlaced Mode
[hactive=n]                             Active (Horizontal)
[hfrontporch=n]                         Front Porch (Horizontal)
[hbackporch=n]                          Back Porch (Horizontal)
[hsyncwidth=n]                          Sync Width (Horizontal)
[hsyncpolarity=+|-]                     Sync Polarity (Horizontal)
[vactive=n]                             Active (Vertical)
[vfrontporch=n]                         Front Porch (Vertical)
[vbackporch=n]                          Back Porch (Vertical)
[vsyncwidth=n]                          Sync Width (Vertical)
[vsyncpolarity=+|-]                     Sync Polarity (Vertical)
[vscanrate=n]                           Scan Rate (Vertical) in Hz

Remove Options:

[index=n]                               Index of the Mode to Remove (from mode=list)
--- End code ---

Download IntelAddCustomMode.zip

--- End quote ---

I've finally had time to test it. In basic mode it works - it adds a resolution 'intel-wise'. In advanced mode it doesn't work for me though:

C:\Users\Rataplan_\Desktop\IntelAddCustomMode\IntelAddCustomMode>IntelAddCustomMode.exe mode=adv hactive=1920 hfrontporch=48 hbackporch=80 hsynchwidth=32 hsyncpolarity=+ vactive=1200 vfrontporch=3 vbackporch=26 vsyncwidth=6 vscanrate=59.150
Setting DELL U2412M (256) to 2048 x 1235 59150 Hz. Success


It doesn't end up in the custom resolutions though, as it does in basic mode. Also when I supply an integer-like refreshrate like 59 it doesn't seem to add it.

Howard_Casto:

--- Quote from: Rataplan626 on February 18, 2017, 02:12:54 am ---Howard, did that include floating point refreshrates? Looking at the article it looks like its all just x-y resolutions rather than floaing point refreshrates as well.
I've had no time at all this week to work on my own idea. Still have some ideas if that doesn't work out.

--- End quote ---

I'm not 100% sure.  I only used it for nonstandard (vertical) resolutions and didn't really mess with the refresh rate.  I know that powerstrip handled custom resolutions with most of my cards very well so perhaps you could look and see if it has source code available?

headkaze:

--- Quote from: Rataplan626 on February 19, 2017, 06:51:47 am ---C:\Users\Rataplan_\Desktop\IntelAddCustomMode\IntelAddCustomMode>IntelAddCustomMode.exe mode=adv hactive=1920 hfrontporch=48 hbackporch=80 hsynchwidth=32 hsyncpolarity=+ vactive=1200 vfrontporch=3 vbackporch=26 vsyncwidth=6 vscanrate=59.150
--- End quote ---

First of all it should be "hsyncwidth" but I still noticed a discrepancy with the calculations I'm using based on your algorithm.

I'm using:

--- Code: ---hTotal = hFrontPorch + hBackPorch + hSyncWidth + hActive;
vTotal = vFrontPorch + vBackPorch + vSyncWidth + vActive;
hScanRate = vTotal * vScanRate;
pixelClock = hTotal * vTotal * vScanRate / 1000000.0;
--- End code ---

The values I'm getting are:

--- Code: ---hTotal: 2080 vTotal: 1235 hScanRate: 73050.25 pixelClock: 151.94452
--- End code ---

But entering these values into the Intel HD Graphics Control Panel I get: hTotal: 2080 vTotal: 1258  hScanRate: 74.222 pixelClock: 154.38176

So obviously there is some miscalculation here.

djrobx:
Interesting tool!

Since you've brought up the Intel driver, I wanted to point out something that I have observed setting up a new cab over the last week or so.   I've been using a collection of my favorite emulators for years with VSYNC without any issues.   But on this machine, it seemed like I was having trouble with every emulator I tried.   Whenever I used vsync I'd get distorted audio.   If I enabled autoframeskipping the result was super choppy performance.   Testing my CPU showed utilization was sub-10% and it's a relatively new machine so that shouldn't be a problem.   After scratching my head I stumbled across this:

http://forum.arcadecontrols.com/index.php?topic=135230.0

FreqTool - A tool that checks the actual refresh rate.  I ran it on my system and discovered that "60hz" was more like 59.4hz.  Then the light bulb went off in my head.

Most emulators support auto-frameskipping in conjunction with Vsync.   However, if your actual refresh rate is *SLOWER* than the sound card rate, you will get into a very rough loop frequent frame skips as the next frame is likely going to have to be skipped since the machine is always "behind" where it should be by the next video frame.  And if you disallow frameskips, your audio buffer will be starved for sure.    So I set a custom resolution of 61hz, and everything started working better.    That tested at "60.7" which is still too fast, but the result is FAR more pleasant - sound no longer stutters, and there are some very infrequent, barely perceptible video skips.

My built in Realtek tested at very close to the expected 48khz rate.   It's the Intel video that's way off.    I will try using your tool to see if I can dial in a rate that's closer to actual 60hz.

Moral-TL;DR: Err on the side of a faster refresh rate.   If it's picking up refresh rates from a XML file it might even be a good idea to be able to specify an offset.

As for your registry settings, have you checked to see if you need to broadcast a message to get Windows to pick up your settings?  I recall doing something similar with joystick calibration values, and needing to send WM_SETTINGCHANGE to get the system to pick it up.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms725497(v=vs.85).aspx

Jakobud:
Any thoughts on putting this on Github?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version