Bug 490440 - Animated cursor freezes while stationary
Summary: Animated cursor freezes while stationary
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 6.1.2
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-18 09:02 UTC by Quenten
Modified: 2024-09-22 14:59 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Quenten 2024-07-18 09:02:11 UTC
SUMMARY
I use an animated cursor on my machine. Since a recent update (I think I went from 6.0 to 6.1) my animated cursor has been freezing up while the cursor is stationary. Sometimes it does progress through the animation a bit, even skipping some frames occasionally or sporadically glitching.

Before this happened, my cursor constantly moved around and was animated, but now it's not anymore. It's as if there is some sort of optimization that was introduced that broke this, but I don't know. 

STEPS TO REPRODUCE
1. In KDE Plasma settings, navigate to "Appearance & Style" -> "Colors & Themes" -> "Cursors".
2. Click "Install from File..." and select the tar.gz file I attached (Hina.tar.gz) to install the cursor. This is the animated cursor I use.
3. Select the cursor and press "Apply" to apply the cursor to your desktop.
4. Place the cursor on a flat UI object, like a background. This makes sure the cursor is the "default"/"left_ptr" state. The cursor has different versions (and animations) depending on the type of cursor (pointer, dragging, help, resize, etc). This bug happens on all variants, but it's easiest to see on the default one.
5. Observe the cursor while not moving the mouse. The animation is frozen (she is supposed to spin around in circles) while the mouse is stationary. 
6. Continuously move the cursor around on the screen and observe. You should see that Hina is spinning and spinning in an animation. (Moving the cursor slowly makes it easier to see)
7. Stop moving again and observe the cursor animation stopping again.

OBSERVED RESULT
While the mouse is not moved, the animation is frozen. When moving the mouse, the animation is not frozen.

EXPECTED RESULT
The cursor animation should always be running and never stop or freeze. 

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kernel 6.10.0-1-mainline
(available in About System)
KDE Plasma Version: 6.1.2
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Hardware is a Lenovo ThinkPad X1 Carbon Gen 11 with an Intel i7-1370P CPU. 
The animated cursor has definitely worked before properly on Plasma 6.0.
Comment 1 Quenten 2024-07-18 09:05:25 UTC
I couldn't attach the cursor file in the attachments here, since it's too big. Here is a link to it.

https://kapu-kapu.s3.nl-ams.scw.cloud/Hina.tar.gz
Comment 2 David Redondo 2024-07-18 13:11:34 UTC
Does it happen while hovering over every application? It works for me while hovering over plasmashell/systemsettings. But in XWayland applications its choppy.
Comment 3 Quenten 2024-07-18 13:24:52 UTC
David, I don't believe I have many XWayland applications running at the moment. Firefox, Slack, VSCode too I think and of course the KDE applications are all running natively in Wayland as far as I know.

Either way, in applications I know for certain are running in Wayland mode (settings, kmail) the cursor is extremely choppy. It tries to do the animation, but skips frames, glitches back and forth between frames quickly, etc. It doesn't smoothly animate like it's supposed to. 

Here is a link to a screen recording of my cursor in settings. It shows the issue I have with the cursor.
When I made the report, the cursor was always frozen when stationary and that's why I said that in the report. As you said, the cursor does definitely try to move, but it can't very well.

Link to the video: https://kapu-kapu.s3.nl-ams.scw.cloud/choppy-cursor-settings.webm

PS. I love the screen recording feature in Spectacle!
Comment 4 Quenten 2024-07-18 14:13:48 UTC
I thought I'd send an update. The cursor does seem to want to animate at least somewhat when stationary if the background it's placed on is moving. Although, it does look a little bit more choppy than normal. 

To try this just start a Youtube video and place the cursor stationary on the playing video. The cursor animation will play, but I'm not sure if this is exactly what it was like before this bug appeared. It doesn't look as smooth as it once was, but that might just be my eye.
Comment 5 Quenten 2024-07-31 09:08:18 UTC
Bugs persists on newly updated system:
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.10.2-arch1-1
Graphics Platform: Wayland

I have a question as well. I haven't reported bugs often, and I cannot find the info anywhere. You marked the bug as NEEDSINFO/WAITINGFORINFO, but after I provided more information, do I need to put it back on REPORTED, or is someone else supposed to do that? So far I've left it on NEEDSINFO/WAITINGFORINFO.
Comment 6 maltejur 2024-09-06 14:18:03 UTC
I experience this as well on my Laptop, but strangely enough not on my Desktop. Also, this only happens with some cursor themes, like Breeze or Win10OS. Oxygen cursors seem to animate just fine on my Laptop. This is what it looks like for me:

Laptop: https://upload.polar.onl/17ee/Video_2024-09-04_22-27-09.mp4?view
Desktop: https://upload.polar.onl/1zym/Video_2024-09-06_15-54-32.mp4?view

To reproduce, the following should be enough:
1. Go to the "Cursors" settings under "Colors & Themes"
2. Hover over the Breeze cursor representing a loading state

I'll try to figure out what difference in my Desktop and Laptop is causing this to happen. This is some system information about them: 

DESKTOP
Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.8-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 5900X 12-Core Processor
Graphics Processor: AMD Radeon RX 7800 XT

LAPTOP
Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.8-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 22 × Intel® Core™ Ultra 7 165H
Graphics Processor: Mesa Intel® Arc
Comment 7 Vlad Zahorodnii 2024-09-06 15:34:56 UTC
Those particular cursors are rendered by system settings, i.e. kwin is not involved there. In either case, I seem to be unable to reproduce the issue.
Comment 8 Vlad Zahorodnii 2024-09-06 15:37:41 UTC
Oh, if software cursor is forced, I can reproduce the issue
Comment 9 Quenten 2024-09-06 15:39:37 UTC
(In reply to maltejur from comment #6)
> I experience this as well on my Laptop, but strangely enough not on my
> Desktop. Also, this only happens with some cursor themes, like Breeze or
> Win10OS. Oxygen cursors seem to animate just fine on my Laptop. 

It's good to see that someone else can reproduce this as well! I have since tested this on my desktop as well and just like you I don't have stutters on my desktop, but still have on my laptop.

DESKTOP:
Operating System: Arch Linux 
KDE Plasma Version: 6.1.2
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Kernel Version: 6.9.9-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 48 × AMD Ryzen Threadripper 3960X 24-Core Processor
Memory: 125.7 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 XTX

My laptop has Intel integrated graphics, so maybe that is what is the issue here?
Comment 10 Bug Janitor Service 2024-09-06 16:49:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6359
Comment 11 Vlad Zahorodnii 2024-09-07 08:19:11 UTC
Git commit 21691fe5707608cd3175f3d35f280b65355ffbdf by Vlad Zahorodnii.
Committed on 07/09/2024 at 08:11.
Pushed by vladz into branch 'master'.

scene: Fix animated software cursor not updating

The Item schedules repaints per scene delegate. Currently, there are no
any attached scene delegates when using software cursor, which results in
it freezing as soon as it stops moving.

The issue is addressed by using SceneDelegate instead of RenderLayerDelegate.

The proposed code is not great, but on the other hand, the plan is to
embed the software cursor in the workspace scene if needed.

M  +2    -2    src/compositor_wayland.cpp
M  +3    -2    src/scene/cursordelegate_opengl.cpp
M  +3    -5    src/scene/cursordelegate_opengl.h
M  +3    -2    src/scene/cursordelegate_qpainter.cpp
M  +3    -3    src/scene/cursordelegate_qpainter.h
M  +1    -1    src/scene/cursorscene.cpp

https://invent.kde.org/plasma/kwin/-/commit/21691fe5707608cd3175f3d35f280b65355ffbdf
Comment 12 Grief 2024-09-22 14:35:16 UTC
@Vlad Zahorodnii
The described issue still reproduces for me with SOME of cursors, like 'wait' from 'breeze'.
It also happens with my own cursor theme 'hand of evil' (searchable and installable via kde built-in tools).
I have 175% scale set up in settings, I suspect it only happens for cursors of size greater than some treshold. 'wait' cursor in my theme is 4MB in xcursor format
Comment 13 maltejur 2024-09-22 14:40:14 UTC
Grief, which version of KWin are you using?
Comment 14 Grief 2024-09-22 14:52:27 UTC
@maltejur 6.1.5
Comment 15 maltejur 2024-09-22 14:59:06 UTC
The fix for this bug is only included in version 6.2.0. You can see that in the "Version Fixed In" field of Bugzilla. That version is slated to release on the 8th of October [1], so you will have to wait a few weeks until the fix reaches you.

[1] https://community.kde.org/Schedules/Plasma_6#Future_releases