Bug 452117 - kwin on wayland: mouse pointer is synchronized or not using hardware cursor.
Summary: kwin on wayland: mouse pointer is synchronized or not using hardware cursor.
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.24.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks: 500544
  Show dependency treegraph
 
Reported: 2022-03-31 15:40 UTC by Antonio Orefice
Modified: 2025-02-21 19:10 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0
Sentry Crash Report:


Attachments
qdbus org.kde.KWin /KWin supportInformation (6.97 KB, text/plain)
2022-03-31 15:40 UTC, Antonio Orefice
Details
modetest from libdrm (51.39 KB, text/plain)
2022-04-01 07:12 UTC, Antonio Orefice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Orefice 2022-03-31 15:40:01 UTC
Created attachment 147863 [details]
qdbus org.kde.KWin /KWin supportInformation

SUMMARY
***
There is cursor input lag
***


STEPS TO REPRODUCE
1. In the compositor settings, switch from lowest latency to higher one
2. see that mouse lag changes

You can even try to saturate the gpu use; the mouse will start to stutter too.
Under Xorg, i've regular hardware mouse cursor.



OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Antonio Orefice 2022-03-31 15:48:08 UTC
[plasmauser@Gozer tmp]$ zgrep Cursor wayland-session.log.gz 
kwin_wayland_drm: Plane 41 has properties "type"="Cursor", "SRC_X"=0, "SRC_Y"=0, "SRC_W"=0, "SRC_H"=0, "CRTC_X"=0, "CRTC_Y"=0, "CRTC_W"=0, "CRTC_H"=0, "FB_ID"=0, "CRTC_ID"=0, "rotation"=invalid value: 1, "IN_FORMATS"=42
kwin_wayland_drm: Plane 56 has properties "type"="Cursor", "SRC_X"=0, "SRC_Y"=0, "SRC_W"=0, "SRC_H"=0, "CRTC_X"=0, "CRTC_Y"=0, "CRTC_W"=0, "CRTC_H"=0, "FB_ID"=0, "CRTC_ID"=0, "rotation"=invalid value: 1, "IN_FORMATS"=57
kwin_wayland_drm: Plane 71 has properties "type"="Cursor", "SRC_X"=0, "SRC_Y"=0, "SRC_W"=0, "SRC_H"=0, "CRTC_X"=0, "CRTC_Y"=0, "CRTC_W"=0, "CRTC_H"=0, "FB_ID"=0, "CRTC_ID"=0, "rotation"=invalid value: 1, "IN_FORMATS"=72
Comment 2 Antonio Orefice 2022-04-01 07:12:00 UTC
Created attachment 147873 [details]
modetest from libdrm

It seems hardware cursor is available.
Comment 3 Antonio Orefice 2022-04-01 13:26:36 UTC
It happens even under weston, so at this point is not clear to me if it depends on the compositor or on wayland itself.
It also seem that even the hardware mouse plane runs synchronized with the others:
https://gitlab.freedesktop.org/wayland/weston/-/issues/602#note_1322651
Comment 4 Zamundaaa 2022-04-02 00:27:06 UTC
It's more or less an issue with how the atomic modesetting API currently works, changing that is not trivial but being worked on. You can use the environment variable "KWIN_DRM_NO_AMS=1" to have KWin fall back to the legacy API to work around this if it's important to you.
Comment 5 Antonio Orefice 2022-04-04 12:55:54 UTC
(In reply to Zamundaaa from comment #4)
> It's more or less an issue with how the atomic modesetting API currently
> works, changing that is not trivial but being worked on. You can use the
> environment variable "KWIN_DRM_NO_AMS=1" to have KWin fall back to the
> legacy API to work around this if it's important to you.

Since Kwin performances under wayland on my i4590 integrated Haswell igp won't allow me to have smooth animations unless I set the higher latency setting in the compositor (on X11 it is so much better) I've to set an high latency which makes the mouse pointer sluggish, as it slips under your hand, and even selecting text or clicking little icons becomes a remarkable achievement, so yes, it is definitely important to me.
KWIN_DRM_NO_AMS=1 makes things so much better, thanks.

However, under high gpu stress, mouse still stutters, while i've been unable to replicate any mouse stuttering under xorg (i managed to completely paralize the whole desktop with countless 3D clients, mouse remained butterly smooth, not a single frame drop)
Comment 6 Nate Graham 2022-04-04 18:59:11 UTC
FWIW I've also been running with KWIN_DRM_NO_AMS=1, just because it keeps kwin_wayland's CPU usage down. I haven't noticed any regressions.
Comment 7 Antonio Orefice 2022-04-04 19:14:28 UTC
(In reply to Nate Graham from comment #6)
> FWIW I've also been running with KWIN_DRM_NO_AMS=1, just because it keeps
> kwin_wayland's CPU usage down. I haven't noticed any regressions.

Yes, I opened something like 300 glxgears at the minimum gpu clock to have stuttering mouse with KWIN_DRM_NO_AMS=1.
It is not something i worry about :)
Comment 8 johan.claudebreuninger 2023-10-09 15:16:34 UTC
I just added the KWIN_DRM_NO_AMS=1 environment variable and my mouse cursor, but also desktop animations feel butter smooth!

Operating System: Arch Linux 
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11
Kernel Version: 6.5.6-arch2-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3800X 8-Core Processor
Memory: 15.5 Gio of RAM
Graphics Processor: AMD Radeon RX 5500 XT
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: X570 AORUS PRO
System Version: -CF
Comment 9 Zamundaaa 2023-10-09 16:20:53 UTC
This should be fixed since https://invent.kde.org/plasma/kwin/-/commit/4c397a95263d9c8e73d536ab1c2ac2caaeec60e2
Comment 10 Joao Bueno 2025-02-21 19:06:11 UTC
It is 2025 - Plasma 6.2 on a Fedora 41 fresh install  -- this is still an issue, I had to workaround with the environment variable listed above.

Touchpad works smootly, but the wireless mouse is behaving as described in the O.P. to the point of disrupting the workflow.