Ubuntu – Xorg: High CPU Usage (94%) on Moving Mouse (Ubuntu 18.04)

18.04cpu loadmousexfcexorg

whenever I move my mouse enough it causes high cpu usage. Screenshot provided is on a fresh X session.

Xorg Taking up a lot of CPU

This also causes some frequent freeze ups if I'm running some other programs e.g gaming.

[1075299.085] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost.
[1077813.434] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost.
[1077814.079] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost.
[1077814.246] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost.
[1077814.682] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost.
[1077831.975] (EE) client bug: timer event4 debounce: offset negative (-18ms)
[1077831.975] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost.
[1077831.975] (II) event4  - Corsair Corsair Vengeance M90 Mouse: WARNING: log rate limit exceeded (5 msgs per 30000ms). Discarding future messages.
[1120008.128] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost.

Is there any way for the CPU usage not to be this high?

EDIT:

I tried with other mice. The CPU usage appears to increase with the Mouse DPI or to be exact, a generic mouse will cause a CPU usage spike, but not as much as a gaming mouse.

I also checked if I have hardware acceleration enabled.

$ glxinfo | grep "direct rendering"
direct rendering: Yes

EDIT 2:

CPU is an AMD FX-6350

GPU is AMD RX Vega 56

Best Answer

You could try changing the mouse polling rate parameter on the usbhid Kernel module. You can modify its value on the fly by running as super user

echo "4" > /sys/module/usbhid/parameters/mousepoll

This changes the polling rate from the default value 0 (i.e. "unlimited") to 4 ms (or 250 Hz).

Note: Afterwards you will have to replug your mouse in order to see any effect.

Provided that helps, you could make this change permanent by appending the parameter to the line GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub like so

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbhid.mousepoll=4"                                                                                                      

Then run

update-grub 

and

reboot 
Related Question