randyrossi / bmc64

A bare metal Commodore 64 emulator for the Raspberry Pi with true 50hz/60hz smooth scrolling, low input latency and better audio/video sync.
GNU General Public License v3.0
479 stars 56 forks source link

Less input lag by setting USB joystick polling rate #122

Open vanfanel opened 4 years ago

vanfanel commented 4 years ago

Hi there, @randyrossi I have seen BMC64 is on the 2-3 frames domain for input lag on composite + CRT. Well, I believe that can be easily improved if you implement an option to force polling rate on the USB joystick. On GNU/Linux we have the usbhib.jspoll kernel commandline option, that will force a 1000Hz polling rate if set to 1. That way, most inputs will arrive in the current frame.

This is already being used on the MiSTer FPGA system, where the USB input is managed by an embedded GNU/Linux system:

https://github.com/eniva/MisSTer_Guides/wiki/Overclock-USB-Controllers-Polling-Rate

Since BMC64 does NOT use GNU/Linux, I dont really know if it would make some sense, but I believe the underlying baremetal lib (Circle lib) has to pull for USB at a given frequency anyway, so it may be a good idea to take a look.

rhester72 commented 4 years ago

That does nothing for the sample rate of the USB chip in the joystick itself, which is the primary limiting factor. The existing poll rate is MUCH faster than the Competition Pro USB is able to deliver, for example.

vanfanel commented 4 years ago

@randyrossi From what I understood, USB chips in the joysticks can be told to work at different frequencies from the OS. Maybe there is a way to specify the maximum available frequency? That is what usbhib.jspoll=1 does in the Linux world, I think. Competition PRO USB may not be the fastest joystick, this only works for some joysticks but not for others.

Kugelblitz360 commented 3 years ago

Confirmed recently myself that older Competition PRO USB are LOCKED at 25/sec and newer ones at 250/sec. With my mouse I was able to push other polling rates but apparently the CPROs are immune to that. It is VERY important though to get the Anniversary edition of the stick. The other ones are confirmed as decoration items only.