RetroArch icon indicating copy to clipboard operation
RetroArch copied to clipboard

Mouse input has a delay and feels unresponsive

Open PoloniumRain opened this issue 2 years ago • 8 comments

This certainly isn't a big problem, but it's an annoying issue that has always existed with RA. There's an input delay when using a mouse, it feels unresponsive, and occasionally the delay will cause me to click on the wrong thing.

In the image below i'm moving my mouse upwards, and the Windows system cursor is in orange and the RA cursor is in white. You can see the RA cursor lags significantly behind...

cursors

To reproduce:

  1. Open RA in fullscreen
  2. Press F11 twice to see both the RA cursor and the system cursor at the same time
  3. Move the mouse around. With both cursors visible it will be more obvious

The problem becomes worse when moving the cursor over playlists because now the cursor will also show visible stuttering if you have thumbnails displayed for each game (RA loading thumbnails causes this stutter). But the system cursor doesn't stutter at all. You can also see that menu buttons are not highlighted and selectable until the RA cursor moves over them, so the OS system cursor can be on top of a button, but you can't actually select it until the RA cursor moves over it.

RetroArch 1.10.3 was used (but it happens in all versions).

PoloniumRain avatar Apr 21 '22 08:04 PoloniumRain

I'm unable to reproduce it that badly with any input driver (dinput/raw). There is a very slight delay of frame or two max, but it follows so quickly that button presses are not affected.

https://user-images.githubusercontent.com/45124675/164493928-82012845-8aae-44f4-b3be-fa41fd0336b0.mp4

Edit: This recording was with vulkan, and glcore is the same, but with d3d11 the delay is much more clear, which is no wonder really. If I disable RA vsync and do RTSS scanline sync instead, it is closer to vulkan/glcore.

sonninnos avatar Apr 21 '22 15:04 sonninnos

That's way less lag than i'm seeing. Yours looks like a single frame delay but here's mine with the D3D11 driver and much slower mouse movement yet it's still obvious...

https://user-images.githubusercontent.com/50634894/164509327-2f05016d-bfa8-441d-9ecc-411fc7f80d50.mp4

When using the GL driver it makes the cursor stutter/jump around when moving it over a playlist that has thumbnails...

https://user-images.githubusercontent.com/50634894/164512407-d068a0ef-25f1-4170-9b9b-0ca9ab3aa395.mp4

That stuttering is almost gone with D3D11, D3D12 or Vulkan. The latter two also give the best results overall, but they're still roughly 3 times as bad as in your video.

I'm using a 3080 GPU so it's not like i'm on a toaster. I've also tried this with a 980 Ti and it's identical to the 3080. I've tried lowering my 4K desktop resolution to 1080p but it's still the same. Windowed mode is the same. The input driver makes no difference. Neither does using a different physical mouse. I remember 2+ years ago when i had a completely different PC i still had this same issue... But when using a controller there's no noticeable input delay.

PoloniumRain avatar Apr 21 '22 17:04 PoloniumRain

970 GTX here and in 1080p 60Hz. I can't make it any worse no matter what settings I change. Windowed/exclusive no difference, "Low Latency Mode" in Nvidia Control Panel in Ultra or Off, no difference. But with d3d11 it has obvious delay.

sonninnos avatar Apr 21 '22 18:04 sonninnos

@sonninnos What OS are you using? I just tried a clean install of RA on an old laptop with ancient Intel integrated graphics, and it still has the same mouse delay as in my videos. The only thing these computers have in common is Windows 10.

PoloniumRain avatar Apr 22 '22 08:04 PoloniumRain

Windows 10.

sonninnos avatar Apr 22 '22 12:04 sonninnos

Any luck with these recent d3d11 changes?

sonninnos avatar Jun 17 '22 08:06 sonninnos

Oh nice, yeah D3D11 is improved significantly! In order of cursor lag things now look like this:

D3D11/D3D12 > Vulkan >>> GL/GLcore/D3D10/D3D9.

D3D11 had comically bad cursor lag for me before, but now the delay is reduced by roughly 90%. So i'm now only seeing an extremely minor and insignificant delay like what you showed in your video. D3D12 and Vulkan also used to perform the same, but D3D12 is showing an improvement too, so it matches D3D11.

But the lag is still obvious with GL, GLcore, D3D10 and D3D9. None of them are as bad as D3D11 used to be but they all still perform the same as in my video from earlier, although GL is the only one that also has that stutter issue.

PoloniumRain avatar Jun 17 '22 11:06 PoloniumRain

So i got a new monitor and this issue is completely solved with G-Sync/FreeSync/VRR. The moment i enable Video > Synchronization > Sync to Exact Content Framerate the mouse cursor lag instantly disappears.

It's also improved with higher refresh rates, so 120Hz has roughly 50% less lag than 60Hz. But only VRR (G-Sync in my case) completely gets rid of it.

PoloniumRain avatar Aug 07 '22 03:08 PoloniumRain

Hi, so I experience very large mouse lag as well, very much in line with the OP. My system is Win10, using an R9 380X to output to CRT monitor (set as primary), plus 2 flat panel screens. I have crt emudriver installed and use the switchres functionality.

I use the RGUI interface and the lag is immediately noticeable in the menu when moving cursor. Normally I use d3d11 with no frame delay. Using d3d11, glcore & vulkan all set to lowest latency settings (including the new variable swapchain), there is a slight improvement, but lag still very noticeable.

I have to resort to using a huge framedelay setting just so the input delay is bareable, but that brings other issues like unstable framerate & sound problems etc.

Interestingly, only mouse movement seems to be affected.. I did tests using frame skip and the controller / KB inputs all have a single frame of delay, and this is without any frame delay set. So generally there is not a problem for cores that don't use the mouse, but cores like puae & dosbox are a real killer.

With VSYNC completely disabled the mouse lag is gone. Also using GSYNC is not an option for me obvs.

vagrant-17 avatar Oct 14 '22 00:10 vagrant-17

@vagrant-17 Just curious if any of your monitors support FreeSync? Because your 380X supports it at least. Maybe FreeSync would fix the lag like how G-Sync does for me. Although i recently discovered that you also need to have both VRR enabled (G-Sync/FreeSync) and then set the 'Vertical Refresh Rate' in RetroArch to to any number that is lower than what your display is using. So on my 120Hz TV i set it to use 110Hz, then there's no mouse lag at all.

The visible cursor lag on the RetroArch interface seems to be a good way of testing out how the mouse lag will be within games/cores. With the GL driver, which has the visibly largest mouse cursor lag, It feels like there's some lag in Quake with the DOSBox-Pure core. But with D3D11 + VRR + lowered refresh rate settings it now feels extremely responsive. Where as Vulkan lag feels somewhere inbetween, which is exactly how the mouse cursor lag looks on the RA interface. This is all somewhat subjective though because i can only go off how things feel when it comes to games.

PoloniumRain avatar Oct 14 '22 18:10 PoloniumRain

Hi mate, yes both of the flat panels support freesync, but I have CRT emudriver installed and the system is focused on outputting to the CRT monitor via switchres. I purchased the 380X specifically for it's native VGA output.

For some reason I'm unable to show both cursors at once using F11 like the posts above.. pressing F11 does nothing for me.

Also, not sure if it's a bug, but even though I have "auto game focus" enabled, I still need to disable/re-enable it with 'scrl lock' key to stop the cursor drifting from the main display.

I did try disconnecting the other monitors leaving only the CRT connected, but the lag is still present. I tried disabling switchres entirely but made no difference to lag. I also did notice that running 60hz on the CRT vs. 50hz there is slightly less lag.. so issue seems tied the refresh somehow.

It seems strange that I have a huge amount of mouse lag, yet only a single frame of response time from the keyboard and controllers

vagrant-17 avatar Oct 15 '22 00:10 vagrant-17

I'd like to amend that with PUAE, using 60hz over 50hz produces far less mouse lag.. not 'slightly less'. With minimal swapchains & 60hz the lag is barely noticeable.. though amiga expects 50hz for the vast majority of games of course . Any idea as to what could cause such a difference?

vagrant-17 avatar Nov 22 '22 12:11 vagrant-17

No major difference here between 50hz and 60hz with any video drivers.

sonninnos avatar Nov 22 '22 13:11 sonninnos

Ok thanks, I'm starting to think myself & @PoloniumRain are the only 2 on the planet with this issue lol.. and our hardware specs couldn't be any more different by the sound of it.

vagrant-17 avatar Nov 22 '22 14:11 vagrant-17