Bug 485827 - Virtio VM has upside down cursor after kwin 6.0.4
Summary: Virtio VM has upside down cursor after kwin 6.0.4
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (show other bugs)
Version: 6.0.4
Platform: Solus Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 486239 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-04-20 00:39 UTC by Reilly Brogan
Modified: 2024-04-29 00:06 UTC (History)
3 users (show)

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


Attachments
Log from boot with the upside down cursor (11.76 KB, text/x-log)
2024-04-20 00:39 UTC, Reilly Brogan
Details
Log from boot with bad commit reverted (12.84 KB, text/x-log)
2024-04-20 00:40 UTC, Reilly Brogan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reilly Brogan 2024-04-20 00:39:46 UTC
Created attachment 168702 [details]
Log from boot with the upside down cursor

SUMMARY
I updated Plasma on Solus to v6.0.4 and noticed that virt-manager VMs using VirGL/Virtio for the GPU had upside down and offset cursors. The issue affects both Plasma Wayland session and SDDM when using kwin and using Wayland.

I bisected it to commit 6e4fae02c3d066311ccecfb74d3f2da52d019c86 (https://invent.kde.org/plasma/kwin/-/commit/6e4fae02c3d066311ccecfb74d3f2da52d019c86). When a revert is applied to 6.0.4 the issue goes away. 

The issue does not appear when using the QXL GPU type.

STEPS TO REPRODUCE
1. Update existing VM to Plasma 6.0.4, with kernel 6.8 (needs this commit: https://github.com/gregkh/linux/commit/9724ed6c1b1212d138e63f5e80647dc8b6b86696, present it v6.8 and later)
2. Reboot

OBSERVED RESULT
Cursor is upside down and offset

EXPECTED RESULT
Cursor is normal

SOFTWARE/OS VERSIONS
KDE Plasma Version: v6.0.4
KDE Frameworks Version: v6.1.0
Qt Version: v6.6.3
Mesa: v24.0.5 (LLVM v16.0.6)
Kernel: v6.8.7
Virglrenderer: v1.0.1

ADDITIONAL INFORMATION
See attached for kwin debug log for the "bad" boot as well as the log after reverting the commit. These logs are from kwin running in SDDM. Interestingly if I log into the Wayland session I see the following in the kwin logs:

Apr 19 19:37:52 solus-plasma kwin_wayland[1058]: Virtual Machine:                        no
Comment 1 Reilly Brogan 2024-04-20 00:40:12 UTC
Created attachment 168703 [details]
Log from boot with bad commit reverted
Comment 2 Bug Janitor Service 2024-04-22 11:21:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5631
Comment 3 Zamundaaa 2024-04-22 12:41:42 UTC
Git commit c14c61f74595c94d3533093ade45aea06ae45e28 by Xaver Hugl.
Committed on 22/04/2024 at 12:33.
Pushed by zamundaaa into branch 'master'.

backends/drm: use dumb buffers for the cursor on virtual machines

Apparently not all VM drivers handle dmabufs on the cursor plane correctly

M  +1    -1    src/backends/drm/drm_egl_cursor_layer.cpp
M  +5    -0    src/backends/drm/drm_gpu.cpp
M  +1    -0    src/backends/drm/drm_gpu.h

https://invent.kde.org/plasma/kwin/-/commit/c14c61f74595c94d3533093ade45aea06ae45e28
Comment 4 postix 2024-04-22 13:19:22 UTC
Fedora 40 will be released next this week with Plasma 6.0.4 and Kernel 6.8 and I am wondering if could run into this issue when upgrading from F39:
Does this bug affect all sorts of guests (like Win10) with Plasma Wayland as a host? Is setting QXL GPU type the only workaround?
Comment 5 Zamundaaa 2024-04-22 13:26:34 UTC
Git commit a31561c392adf5abcda0284e8049fafcb3701585 by Xaver Hugl.
Committed on 22/04/2024 at 13:16.
Pushed by zamundaaa into branch 'Plasma/6.0'.

backends/drm: use dumb buffers for the cursor on virtual machines

Apparently not all VM drivers handle dmabufs on the cursor plane correctly
(cherry picked from commit c14c61f74595c94d3533093ade45aea06ae45e28)

M  +1    -1    src/backends/drm/drm_egl_cursor_layer.cpp
M  +5    -0    src/backends/drm/drm_gpu.cpp
M  +1    -0    src/backends/drm/drm_gpu.h

https://invent.kde.org/plasma/kwin/-/commit/a31561c392adf5abcda0284e8049fafcb3701585
Comment 6 Reilly Brogan 2024-04-24 21:11:03 UTC
(In reply to postix from comment #4)
> Fedora 40 will be released next this week with Plasma 6.0.4 and Kernel 6.8
> and I am wondering if could run into this issue when upgrading from F39:
> Does this bug affect all sorts of guests (like Win10) with Plasma Wayland as
> a host? Is setting QXL GPU type the only workaround?

I believe it only affects VMs using Plasma Wayland as the guest actually. The patch for it has also already been added to the Plasma/6.0 branch and will be in the 6.0.5 release, or your Plasma maintainers can apply it to kwin 6.0.4/6.0.4.1 (it applies cleanly).
Comment 7 Zamundaaa 2024-04-29 00:06:42 UTC
*** Bug 486239 has been marked as a duplicate of this bug. ***