You are not logged in.

#1 2018-04-17 00:55:25

eucer
Member
Registered: 2018-04-17
Posts: 7

Mouse input lag / inconsistency in certain movement directions

Hi everyone

I have a weird issue with mouse input. For example in Unreal Engine 4, the mouse movement to the left and upwards is faster than towards the right or downwards. The same issue exists in the unmodified UE4 FPS template (to rule out programming errors) and a demo game based on UE4 downloaded from the internet. After thorough tests within the engine and writing test programs for SDL (which is used in UE4) I was sure UE4 was broken. However, testing the Godot engine I found the exact same issue there. On the other hand, the issue never occurred outside of those; Let me create a list:

Broken:

Not broken (no issues):

  • SDL_MOUSEMOTION event test program (see code below)

  • Counter Strike: Global Offensive

  • i3 window manager

  • Everything else (any other game I have ever played)

To elaborate on the issue let me show an excerpt of the test program I wrote:

while (SDL_PollEvent(&event)) {
    if (event.type == SDL_QUIT) {
        quit = true;
    } else if (event.type == SDL_MOUSEMOTION) {
        static int last_t = 0;
        static int count = 0;
        static int sum_t = 0;
        if (event.motion.timestamp - last_t < 300) {
            ++count;
            sum_t += event.motion.timestamp - last_t;
        } else {
            std::cout << count << std::endl;
            last_t = 0;
            count = 0;
            sum_t = 0;
        }
        last_t = event.motion.timestamp;
    }
}

This is my test code and basically the exact same thing UE4 does to process mouse movement. My test setup is then to put my mouse between two heavy books on my mousepad, leaving ~3 cm space for horizontal movement. Now when moving the mouse steadily back and forth from left to right, the program will output the amount of received events during motion. And this show the issue: after moving from left to right it reports about 500 events - but after moving from right to left about 750 events! This is reproducible 100% and I can repeat going left and right to get the same weird result.

As a subjective assessment it feels like the (slower) left-to-right movement is broken, it feels non-fluid and slightly unresponsive.

I hope you can help me identify the problem and fix it.

Software/Hardware:

  • Mouse: Corsair M65 (also tested with Logitech M205)

  • Mousepad: Steelseries Qck

  • Mainboard: Gigabyte GA-Z270X-Ultra Gaming (rev. 1.0) (tested multiple USB ports)

  • OS: Up-to-date Arch Linux

  • Mouse Input: libinput without Acceleration - config:

    Section "InputClass"
    	Identifier "Corsair M65"
    	Driver "libinput"
    	MatchIsPointer "yes"
    	Option "AccelSpeed" "-1"
    	Option "AccelProfile" "flat"
    EndSection

    Also:

    $ xinput list-props {1..50} 2>/dev/null | fgrep 'libinput Accel Profile Enabled ('
    	libinput Accel Profile Enabled (288):	0, 1
  • GPU: AMD Radeon HD 7970

  • Driver: Mesa / AMDGPU

Last edited by eucer (2018-04-17 08:35:33)

Offline

#2 2018-04-17 07:30:22

seth
Member
Registered: 2012-09-03
Posts: 51,238

Re: Mouse input lag / inconsistency in certain movement directions

Did you also try replacing (or just turning 180°) the mousepad?

Offline

#3 2018-04-17 08:34:50

eucer
Member
Registered: 2018-04-17
Posts: 7

Re: Mouse input lag / inconsistency in certain movement directions

Thanks for your reply! I just did this and it does not make a difference (rotating and/or using a white sheet of paper as mousepad). Note that this issue does not exist at all e.g. in Counter Strike: Global Offensive, using the same mouse and mousepad. I think it's reasonable to conclude it cannot be a hardware issue.

EDIT: Or it could be a hardware issue but only in certain internal states, e.g. if the graphics card is under heavy load. But in CS:GO the graphics cards is also under heavy load, so...

Last edited by eucer (2018-04-17 08:52:12)

Offline

#4 2018-04-17 16:05:21

seth
Member
Registered: 2012-09-03
Posts: 51,238

Re: Mouse input lag / inconsistency in certain movement directions

I would have blamed different processing of input events (relative and biased towards the assumed DPI vs. absolute)
Next thing to try is to swap libinput for evdev (to see whether this is on the X11 level and maybe some games operate on xinput2 and other just handle input events)

Usually i'd look at (X11 layer) pointer acceleration ("xset -q | grep accel"), but if this is really only in one direction on X and Y axis, that doesn't sound reasonable...

Offline

#5 2018-04-17 16:50:09

eucer
Member
Registered: 2018-04-17
Posts: 7

Re: Mouse input lag / inconsistency in certain movement directions

Thanks again. After installing lib86-input-evdev, changing the xorg config to

Section "InputClass"
	Identifier "Corsair M65"
	#Driver "libinput"
	Driver "evdev"
	MatchIsPointer "yes"
	Option "AccelerationProfile" "-1"
	Option "AccelerationScheme" "none"
	Option "AccelSpeed" "-1"
	Option "AccelProfile" "flat"
EndSection

and restarting the issue is indeed gone! The weirdest part however is that I don't understand which driver is actually being used now because the Xorg log looks like this:

[   502.434] (II) config/udev: Adding input device Corsair Corsair M65 Gaming Mouse (/dev/input/mouse0)
[   502.434] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "Corsair M65"
[   502.434] (II) Using input driver 'evdev' for 'Corsair Corsair M65 Gaming Mouse'
[   502.434] (**) Corsair Corsair M65 Gaming Mouse: always reports core events
[   502.434] (**) evdev: Corsair Corsair M65 Gaming Mouse: Device: "/dev/input/mouse0"
[   502.485] (EE) evdev: Corsair Corsair M65 Gaming Mouse: Unable to query fd: Inappropriate ioctl for device
[   502.511] (EE) PreInit returned 2 for "Corsair Corsair M65 Gaming Mouse"
[   502.511] (II) UnloadModule: "evdev"
[   502.512] (II) config/udev: Adding input device Corsair Corsair M65 Gaming Mouse (/dev/input/event5)
[   502.512] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "evdev keyboard catchall"
[   502.512] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "libinput keyboard catchall"
[   502.512] (II) Using input driver 'libinput' for 'Corsair Corsair M65 Gaming Mouse'
[   502.512] (**) Corsair Corsair M65 Gaming Mouse: always reports core events
[   502.512] (**) Option "Device" "/dev/input/event5"
[   502.512] (**) Option "_source" "server/udev"
[   502.514] (II) event5  - Corsair Corsair M65 Gaming Mouse: is tagged by udev as: Keyboard
[   502.514] (II) event5  - Corsair Corsair M65 Gaming Mouse: device is a keyboard
[   502.514] (II) event5  - Corsair Corsair M65 Gaming Mouse: device removed
[   502.527] (II) libinput: Corsair Corsair M65 Gaming Mouse: needs a virtual subdevice
[   502.527] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.1/1-4.1:1.2/0003:1B1C:1B05.000C/input/input28/event5"
[   502.527] (II) XINPUT: Adding extended input device "Corsair Corsair M65 Gaming Mouse" (type: MOUSE, id 9)
[   502.527] (**) Option "AccelerationScheme" "none"
[   502.528] (**) Corsair Corsair M65 Gaming Mouse: (accel) selected scheme none/0
[   502.528] (**) Corsair Corsair M65 Gaming Mouse: (accel) acceleration factor: 2.000
[   502.528] (**) Corsair Corsair M65 Gaming Mouse: (accel) acceleration threshold: 4
[   502.529] (II) event5  - Corsair Corsair M65 Gaming Mouse: is tagged by udev as: Keyboard
[   502.529] (II) event5  - Corsair Corsair M65 Gaming Mouse: device is a keyboard
[   502.530] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "evdev keyboard catchall"
[   502.530] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "libinput keyboard catchall"
[   502.530] (II) Using input driver 'libinput' for 'Corsair Corsair M65 Gaming Mouse'
[   502.530] (**) Corsair Corsair M65 Gaming Mouse: always reports core events
[   502.530] (**) Option "Device" "/dev/input/event5"
[   502.530] (**) Option "_source" "_driver/libinput"
[   502.530] (II) libinput: Corsair Corsair M65 Gaming Mouse: is a virtual subdevice
[   502.530] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.1/1-4.1:1.2/0003:1B1C:1B05.000C/input/input28/event5"
[   502.530] (II) XINPUT: Adding extended input device "Corsair Corsair M65 Gaming Mouse" (type: KEYBOARD, id 10)
[   502.532] (II) config/udev: Adding input device Corsair Corsair M65 Gaming Mouse (/dev/input/event4)
[   502.532] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "evdev keyboard catchall"
[   502.532] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "libinput keyboard catchall"
[   502.532] (II) Using input driver 'libinput' for 'Corsair Corsair M65 Gaming Mouse'
[   502.532] (**) Corsair Corsair M65 Gaming Mouse: always reports core events
[   502.532] (**) Option "Device" "/dev/input/event4"
[   502.532] (**) Option "_source" "server/udev"
[   502.533] (II) event4  - Corsair Corsair M65 Gaming Mouse: is tagged by udev as: Keyboard
[   502.533] (II) event4  - Corsair Corsair M65 Gaming Mouse: device is a keyboard
[   502.533] (II) event4  - Corsair Corsair M65 Gaming Mouse: device removed
[   502.555] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.1/1-4.1:1.1/0003:1B1C:1B05.000B/input/input27/event4"
[   502.555] (II) XINPUT: Adding extended input device "Corsair Corsair M65 Gaming Mouse" (type: KEYBOARD, id 11)
[   502.556] (II) event4  - Corsair Corsair M65 Gaming Mouse: is tagged by udev as: Keyboard
[   502.557] (II) event4  - Corsair Corsair M65 Gaming Mouse: device is a keyboard
[   502.558] (II) config/udev: Adding input device Corsair Corsair M65 Gaming Mouse (/dev/input/event3)
[   502.558] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "evdev pointer catchall"
[   502.558] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "libinput pointer catchall"
[   502.558] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "Corsair M65"
[   502.558] (II) Using input driver 'evdev' for 'Corsair Corsair M65 Gaming Mouse'
[   502.558] (**) Corsair Corsair M65 Gaming Mouse: always reports core events
[   502.558] (**) evdev: Corsair Corsair M65 Gaming Mouse: Device: "/dev/input/event3"
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Vendor 0x1b1c Product 0x1b05
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Found 20 mouse buttons
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Found scroll wheel(s)
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Found relative axes
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Found x and y relative axes
[   502.610] (II) evdev: Corsair Corsair M65 Gaming Mouse: Configuring as mouse
[   502.610] (II) evdev: Corsair Corsair M65 Gaming Mouse: Adding scrollwheel support
[   502.610] (**) evdev: Corsair Corsair M65 Gaming Mouse: YAxisMapping: buttons 4 and 5
[   502.610] (**) evdev: Corsair Corsair M65 Gaming Mouse: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[   502.610] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.1/1-4.1:1.0/0003:1B1C:1B05.000A/input/input26/event3"
[   502.610] (II) XINPUT: Adding extended input device "Corsair Corsair M65 Gaming Mouse" (type: MOUSE, id 16)
[   502.610] (II) evdev: Corsair Corsair M65 Gaming Mouse: initialized for relative axes.
[   502.611] (**) Option "AccelerationScheme" "none"
[   502.611] (**) Corsair Corsair M65 Gaming Mouse: (accel) selected scheme none/0
[   502.611] (**) Corsair Corsair M65 Gaming Mouse: (accel) acceleration factor: 2.000
[   502.611] (**) Corsair Corsair M65 Gaming Mouse: (accel) acceleration threshold: 4

Why does it `UnloadModule: "evdev"`? And is evdev still being used? Why is the mouse acceleration set in the last three lines even though I explicitly disabled it?

$ xset -q | grep accel
  acceleration:  2/1    threshold:  4

Yet, the movement speed now is the same in all directions (as far as I can tell).

Any ideas? I'd rather get libinput to work instead of falling back to evdev (I remember having some unrelated issues with evdev a few months ago).

Offline

#6 2018-04-17 17:14:59

seth
Member
Registered: 2012-09-03
Posts: 51,238

Re: Mouse input lag / inconsistency in certain movement directions

From that part of the log you end up w/ evdev - there's some juglling around because the mouse seems to not be fully initialized in the beginning and also shows up w/ several devices, but the tail applies your specific config and ends up w/ evdev:

[   502.558] (**) Corsair Corsair M65 Gaming Mouse: Applying InputClass "Corsair M65"
[   502.558] (II) Using input driver 'evdev' for 'Corsair Corsair M65 Gaming Mouse'
[   502.558] (**) Corsair Corsair M65 Gaming Mouse: always reports core events
[   502.558] (**) evdev: Corsair Corsair M65 Gaming Mouse: Device: "/dev/input/event3"
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Vendor 0x1b1c Product 0x1b05
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Found 20 mouse buttons
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Found scroll wheel(s)
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Found relative axes
[   502.610] (--) evdev: Corsair Corsair M65 Gaming Mouse: Found x and y relative axes
[   502.610] (II) evdev: Corsair Corsair M65 Gaming Mouse: Configuring as mouse
[   502.610] (II) evdev: Corsair Corsair M65 Gaming Mouse: Adding scrollwheel support
[   502.610] (**) evdev: Corsair Corsair M65 Gaming Mouse: YAxisMapping: buttons 4 and 5
[   502.610] (**) evdev: Corsair Corsair M65 Gaming Mouse: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[   502.610] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.1/1-4.1:1.0/0003:1B1C:1B05.000A/input/input26/event3"
[   502.610] (II) XINPUT: Adding extended input device "Corsair Corsair M65 Gaming Mouse" (type: MOUSE, id 16)
[   502.610] (II) evdev: Corsair Corsair M65 Gaming Mouse: initialized for relative axes.
[   502.611] (**) Option "AccelerationScheme" "none"
[   502.611] (**) Corsair Corsair M65 Gaming Mouse: (accel) selected scheme none/0
[   502.611] (**) Corsair Corsair M65 Gaming Mouse: (accel) acceleration factor: 2.000
[   502.611] (**) Corsair Corsair M65 Gaming Mouse: (accel) acceleration threshold: 4

The Accel* Options only apply to libinput, the other acceleration is a server feature - looks like the default values.
This is typically set by the DE or WM or some startup script.

xset m 1 0
xset m 8 0
xset m 2 4
xset m default

Offline

#7 2018-04-17 18:33:17

eucer
Member
Registered: 2018-04-17
Posts: 7

Re: Mouse input lag / inconsistency in certain movement directions

Thank you for your help! I added a line to ~/.xinitrc to disable acceleration.

So would you conclude there is an issue with libinput and I should create a bug report? Any further suggestions on how to track down this issue?

Offline

#8 2018-04-17 20:26:13

seth
Member
Registered: 2012-09-03
Posts: 51,238

Re: Mouse input lag / inconsistency in certain movement directions

Very much look so - does it also happen w/o your specific config?

Offline

#9 2018-04-17 20:39:29

eucer
Member
Registered: 2018-04-17
Posts: 7

Re: Mouse input lag / inconsistency in certain movement directions

Yes, I just completely removed the config and the issue came back after restarting X. Checking the logs, libinput was automatically chosen as input driver for the mouse...

Offline

Board footer

Powered by FluxBB