Laggy mouse on a Raspberry Pi?

If you have a Raspberry Pi and find the mouse to be laggy (as if it’s under water) here’s two things you can try:

  1. Open /boot/cmdline.txt and see if the line in there has many mention of usbhid.mousepoll. If it has then try changing its value to 8 (or 2, 4, or 8). Then reboot.
    1. This key controls how often the mouse is polled. You can read about it in this wiki page. This made a huge difference to me. I’d suggest starting with 8 and reducing if you are not happy with the result. The lower the number the more often the mouse is polled, which results in higher CPU usage. If 8 works well then why stress the system further.
  2. Reduce the screen resolution. Since the Raspberry Pi 4B can drive 2x 4k monitors that’s what I started off with initially. Sure it can drive ’em but there is a lag. Then I switched to a single 4k display but it was still meh. Finally I reduced the resolution from the default 3840×2160 to 2560×1440 to 1920×1080. The last one made a noticeable difference to the mouse performance and also generally to the display. (I even went with 1600×900 but didn’t stick with it as I wanted a slightly higher resolution).