Pi2 - RT Kernel with Retroarch

Hello Emlid and friends!

I have been working on using Retroarch rendering in the frame buffer (dispmanx) and Emlid’s RT kernel in an attempt to minimize USB joystick input latency.

On a default installation on normal Raspbian I was getting about 6 frames (~100ms!!!) worth of input latency.

After compiling my own version of Retroarch with ARM optimizations and changing to RT kernel. I was able cut this in half to about 2 or 3 frames of input latency (~30-50ms) which is much better!

I have been thinking about if it may be possible to optimize this even further.

I did notice the slight CPU usage overhead from the interrupt handlers: RT kernel: Unusual dwc_otg high 8k/s interrupt rate using quite some CPU?

A couple of my questions are, is the non-FIQ input USB driver causing any downsides to my application? Or would the higher interrupt rate be better in terms of my USB input latency needs?

I would try compiling a RT kernel myself however due to the changes Emlid has made to get his image to work, I am a bit wary of creating a broken OS without knowing how to make necessary changes.

I have also looking into USB polling rates and it seems that features like that are rather lacking in Linux. I am starting to wonder if it is even possible to adjust polling rates of USB joysticks.

If anyone has any tips let me know!

You can also look at my previous findings here:

Thanks in advance!

We have disabled FIQ because on RT_PREEMPT it causes kernel crash if something is run with higher priority. Your application is not as safety critical so you might give FIQ a shot. FIQ driver is definitely more efficient.

Thank you Igor!

That is actually exactly what I needed to know.

I appreciate it.

1 Like