VOGONS


First post, by gaula92

User metadata
Rank Newbie
Rank
Newbie

That's about it.
Where in the Dosbox sources could I tweak an emulated videomode refresh rate?
For example, 320x240 (mode-X) runs NEAR 60HZ, but it's NOT 60HZ and I need it at exactly 60HZ. I know there are DOS utils to tweak refresh rate for DOS video modes, but they don't work in DOSBOX.

thanks

Reply 2 of 16, by gaula92

User metadata
Rank Newbie
Rank
Newbie

Thanks, ykhwong, but I mean for a much simpler solution for NEAR-60Hz video modes, it seems this patch doesn't work anymore (it's from 2005), and it specifically says it's not meant for "console ports, running at 50 or 60HZ".

What about setting this "fps" variable in "vga_draw.cpp" to 60 ?
Should it force an internal 60HZ refresh rate for every VGA video mode inside the emulated machine?

// The screen refresh frequency
fps=(double)clock/(vtotal*htotal);

Reply 4 of 16, by gaula92

User metadata
Rank Newbie
Rank
Newbie

h-a-l-9000: no, it doesn't, but for some reason my monitor syncs perfectly with fixed-60HZ modes (I already patched SDLMAME for this same reason and I get smooth perfect scroll in every game, forcing those exotic 58 or 59 HZ games into 60HZ) while it has a hard time syncing with the smalles deviance from that value, skipping 1 frame every 30-40 seconds. Yes, I can notice it in scrollers.

In the other hand, mode-x 320x240 isn't exactly 60HZ, it's 59.xxHZ as we've stated before, BUT it gets scaled to 640x480@60HZ by every TFT I've seen, thus ruining the smooth-scroll experience in mode-x scrollers like Super Frog.

So, h-a-l-9000, is that the variable I am looking for? I mean, to fix every mode into 60HZ. C'mon, you created this vga_draw file, I'm sure you know how to force 60HZ for every emulated mode 😁

PD: (Yes, I know most DOS software is 320x200@70HZ, but that mode is scaled in TFT's to 720x400@70HZ, thus giving perfect smooth scroll in Jazz Jackrabbit, for example. All I need is to fix 320x240@59.xxHZ into 60HZ).

Reply 5 of 16, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie
gaula92 wrote:
Thanks, ykhwong, but I mean for a much simpler solution for NEAR-60Hz video modes, it seems this patch doesn't work anymore (it' […]
Show full quote

Thanks, ykhwong, but I mean for a much simpler solution for NEAR-60Hz video modes, it seems this patch doesn't work anymore (it's from 2005), and it specifically says it's not meant for "console ports, running at 50 or 60HZ".

What about setting this "fps" variable in "vga_draw.cpp" to 60 ?
Should it force an internal 60HZ refresh rate for every VGA video mode inside the emulated machine?

// The screen refresh frequency
fps=(double)clock/(vtotal*htotal);

This patch should work on the latest svn, or you can find it in my build (http://ykhwong.x-y.net).

If you are using OpenGL, search for this in /src/gui/sdlmain.cpp and make SDL_GL_SWAP_CONTROL=1.

#if defined (WIN32) && SDL_VERSION_ATLEAST(1, 2, 11)
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 );
#endif

Set vsyncmode=force, vsyncrate=60, fulldouble=true in dosbox configuration.

Attachments

Reply 7 of 16, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

For DirectDraw, you need GetScanLine() to get a real scanline value.
For Direct3D if you are going to apply gulikoza's Direct3D patch, you need to set "d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT"
I have no idea about vertical-sync for surface and overlay outputs because I do not find anything related to vsync in SDL 1.2 references.

According to SDL API documentation, SDL_GL_SWAP_CONTROL is deprecated in 1.3.0. For SDL 1.3, however, SDL_RENDERER_PRESENTVSYNC flag exists for vsync though SDL 1.3 does not seem to work with current version of DOSBox.

Reply 8 of 16, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

For DirectDraw, you need GetScanLine() to get a real scanline value.
For Direct3D if you are going to apply gulikoza's Direct3D patch, you need to set "d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT"

He seems to be using linux.

Easiest solution would be getting rid of the strange monitor i'd say.

Reply 9 of 16, by gaula92

User metadata
Rank Newbie
Rank
Newbie

I have no idea about vertical-sync for surface and overlay outputs because I do not find anything related to vsync in SDL 1.2 references.

I get vsync with DirectFB, so VSYNC is NOT the problem. Refresh rate is.
Should vsyncrate=60 force a 60HZ refresh rate even with SDL surface output?
Does vsyncrate variable control the emulated machine refresh rate, or does it control the host API refresh rate?

@wd: My monitor is not strange. Any TFT monitor does scale 320x240@<whatever>HZ to a default 640x480@60HZ, and that causes non-smoth scroll because of the different scan rates.

Reply 10 of 16, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

You want a smooth scrolling in every game, right? DirectFB will not help because the emulated refresh rate and host one can differ.
vsyncrate variable from the vsync patch controls only the emulated machine refresh rate, therefore it should work on every SDL surface output.
The patch, however, does not "exactly" synchronize vsync timing to host display. augnober provided a calibration utility for it. His archive dosbox-vsync-20051223.zip includes vsync.com. You can even set vsyncrate=60.023426 or whatever other than vsyncrate=60.

Reply 11 of 16, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Any TFT monitor does scale 320x240@<whatever>HZ to a default 640x480@60HZ, and that causes non-smoth scroll because of the different scan rates.

Never had a problem like that on LCDs.

Reply 13 of 16, by gaula92

User metadata
Rank Newbie
Rank
Newbie

...flat panels do scale 320x240@whateverHZ to something like 640x480@60HZ. They all do it, or at least every panel I've ever tried so far (and they've been a lot).
Enter the panel OSD while you're running a 320x240 mode, and you'll see it's running in 640x480. It's not about connection methods. It's because 320x240 would look VERY blurry in a 1280x1024 TFT, for example.

@ykhwong: is the patch supposed to be directly applicable on stable 0.74 sources?

Reply 14 of 16, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

...flat panels do scale 320x240@whateverHZ to something like 640x480@60HZ.

Well yeah but on MY monitors this doesn't result in any sort of desync/scrolling bugs
or other artefacting that would affect gameplay, so no idea about that.

Reply 15 of 16, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie
gaula92 wrote:

@ykhwong: is the patch supposed to be directly applicable on stable 0.74 sources?

There might be some differences somewhere between the stable 0.74 source and SVN one, but the patch is based on the latest SVN. (I did not test it on stable 0.74 source) So read this "BuildingDOSBox" to get SVN dump, and apply the experimental vsync patch (patch -up1 < "patchfile")
http://www.dosbox.com/wiki/BuildingDOSBox

Reply 16 of 16, by gaula92

User metadata
Rank Newbie
Rank
Newbie

@ykhwong: I applied the patch you provided on CVS and stable 0.74, both versions accept it.
The problem is that it doesn't seem to do anything. I've been reading your instructions and augnober's instructions, and added those values to the .conf file I'm using:

vsyncrate=60
vsyncmode=on

..but there's no difference. My emulated mode-x games/demos are still running at 59.XXHZ instead of 60HZ as specified.
I did also run VSYNC.COM before running my DOS software, but that didn't set the vsyncrate.
What am I doing wrong?