libretro / dosbox-libretro

Port of DOSBox (upstream) to the libretro API.
GNU General Public License v2.0
61 stars 40 forks source link

dosbox core misbehaving with the gl driver. #3

Open heuripedes opened 10 years ago

heuripedes commented 10 years ago

The DOSBox core performs very badly when it is run under a RetroArch instance that uses the gl driver with VSync on. There is no impact on the frame rate (58-60fps), but audio loops sometimes and it takes at least twice as much time to load and run games in comparison to the sdl and xvideo driver.

Both dosbox_libretro.so and retroarch were compiled from git today (Dec 29 in UTC-3).

Video settings:

video_shader_enable = "true"
video_aspect_ratio = "-1.000000"
video_xscale = "1.000000"
video_yscale = "1.000000"
video_crop_overscan = "true"
video_scale_integer = "false"
video_smooth = "false"
video_threaded = "false"
video_fullscreen = "false"
video_refresh_rate = "59.950001"
video_driver = "gl"
video_vsync = "true"
video_hard_sync = "false"
video_hard_sync_frames = "0"
video_black_frame_insertion = "false"
video_swap_interval = "1"
video_gpu_screenshot = "true"
video_rotation = "0"
video_shader_dir = "default"
video_font_size = "48.000000"
video_shader = ""

Games tested:

System configuration:

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/26243817-dosbox-core-misbehaving-with-the-gl-driver?utm_campaign=plugin&utm_content=tracker%2F2175333&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F2175333&utm_medium=issues&utm_source=github).
Tatsuya79 commented 8 years ago

Same observation here on win7 x64. Tested games such as Dark Forces and Hexen, GL driver is a lot worse than d3d.

Vsync + Hard sync causes the game to crash after a while. Just Vsync ON is slow, drop frames + heavy slowdowns. Vsync OFF is better but still have some heavy slowdowns. Trying to limit the framerate and disabling sound sync just crashed.

When playing in the best scenario (Vsync OFF) I see messages like this in the log:

RetroArch [INFO] :: Average audio buffer saturation: 47.02 %, standard deviation (percentage points): 16.75 %. RetroArch [INFO] :: Amount of time spent close to underrun: 7.67 %. Close to blocking: 1.13 %.

Tatsuya79 commented 8 years ago

I observe the same problem with d3d after some more tests: same audio buffer saturation messages and huge slowdowns, vsync goes off...

andres-asm commented 8 years ago

The core is quite immature, and sadly there is no easy way to make dosbox return on a per-frame basis.

I don't understand completely how they work but basically it runs in another thread (libco thread) and the frontend runs the callback at vsync rate and renders the frames but it's not really running in sync like other cores.

It works well enough for simple games (keen, jazz, tyrian) but complex games that might take more than 16.66ms to return a frame seem problematic.

Tatsuya79 commented 8 years ago

Thanks for the explanation. I feared something like that when I read about Dosbox cpu cycles configuration; if sound stutters, lower the cycles, etc.

A game like OMF2097 always run too fast in Retroarch. EDIT: forget it, there is a speed setting in the game itself and it was on crazy fast by default.

Perhaps this core would need to handle most of the sync and ignore some Retroarch settings. And perhaps keep the key config tool it has in stand-alone too, that's missing a lot.