Bug 453860

Summary: [Wayland] Mouse cursor not displayed on Wayland session
Product: [Plasma] kwin Reporter: Behzad A <behzad.a_ir>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: 31113, darkmaniels, nate, xaver.hugl
Priority: NOR    
Version: 5.24.90   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 5.25.4

Description Behzad A 2022-05-15 22:47:33 UTC
I now updated to last git version(openSUSE Krypton 22-5-15) and after restart the Mouse cursor disappeared on Wayland session

Also related issue
https://bugs.kde.org/show_bug.cgi?id=453823
Comment 1 Behzad A 2022-05-15 22:48:37 UTC
System Info
System:    Host: localhost.localdomain Kernel: 5.17.5-1-default x86_64 bits: 64 compiler: gcc v: 12.1.0
           Desktop: KDE Plasma 5.24.80 tk: Qt 5.15.2 wm: kwin_x11 dm: SDDM Distro: openSUSE Tumbleweed 20220513
CPU:       Info: Dual Core model: Intel Core2 Duo T6670 bits: 64 type: MCP arch: Penryn rev: A cache: L2: 2 MiB
           flags: lm nx pae sse sse2 sse3 sse4_1 ssse3 vmx bogomips: 8771
           Speed: 1223 MHz min/max: 1200/2201 MHz boost: enabled Core speeds (MHz): 1: 1223 2: 1243
Graphics:  Device-1: Intel Mobile 4 Series Integrated Graphics vendor: Sony driver: i915 v: kernel bus-ID: 00:02.0
           chip-ID: 8086:2a42
           Device-2: Ricoh Sony Vaio Integrated Webcam type: USB driver: uvcvideo bus-ID: 3-2:2 chip-ID: 05ca:18b3
           Display: x11 server: X.Org 21.1.3 compositor: kwin_x11 driver: loaded: modesetting failed: fbdev,vesa
           alternate: intel resolution: 1280x800~60Hz s-dpi: 96
           OpenGL: renderer: Mesa Mobile Intel GM45 Express (CTG) v: 2.1 Mesa 22.2.0-devel-git-e9e8c649 direct render: Yes
Comment 2 Nate Graham 2022-05-16 18:43:08 UTC
> Display: x11 server: X.Org 21.1.3 compositor: kwin_x11 driver: loaded: modesetting failed: fbdev,vesa
Seems like you're actually on X11, not Wayland. Can you confirm?
Comment 3 Behzad A 2022-05-16 20:19:09 UTC
(In reply to Nate Graham from comment #2)
> > Display: x11 server: X.Org 21.1.3 compositor: kwin_x11 driver: loaded: modesetting failed: fbdev,vesa
> Seems like you're actually on X11, not Wayland. Can you confirm?

No, Currently, I have to use the X11 session temporarily because of this problem(And I ran inxi command on X11 session), And this issue only occur on Wayland session.
Comment 4 Nate Graham 2022-05-17 14:26:45 UTC
I think you'll need to get back into your Wayland session so we can debug this.

After that can you please paste the output of `qdbus org.kde.KWin /KWin supportInformation`?
Comment 5 Behzad A 2022-05-17 18:58:22 UTC
(In reply to Nate Graham from comment #4)
> I think you'll need to get back into your Wayland session so we can debug
> this.
> 
> After that can you please paste the output of `qdbus org.kde.KWin /KWin
> supportInformation`?

I right now noticed when zooming desktop(Meta + =) Mouse cursor displayed but without zoom, the cursor not displayed

'qdbus org.kde.KWin /KWin supportInformation' Output:

behzad@localhost:~> qdbus-qt5 org.kde.KWin /KWin supportInformation
KWin Support Information:
The following information should be used when requesting support on e.g. https://forum.kde.org.
It provides information about the currently running instance, which options are used,
what OpenGL driver and which effects are running.
Please post the information provided underneath this introductory text to a paste bin service
like https://paste.kde.org instead of pasting into support threads.

==========================

Version
=======
KWin version: 5.24.80
Qt Version: 5.15.2
Qt compile version: 5.15.2
XCB compile version: 1.15

Operation Mode: Xwayland

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: SUSE LINUX
Vendor Release: 12201001
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Plugin recommends border size: None
onAllDesktopsAvailable: true
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 9
decorationButtonsRight: 6, 3, 4, 5
borderSize: 0
gridUnit: 10
font: Segoe UI,10,-1,5,63,0,0,0,0,0,Semibold
smallSpacing: 2
largeSpacing: 10

Platform
==========
Name: DRM
Active: true
Atomic Mode Setting on GPU 0: false

Cursor
======
themeName: breeze_cursors
themeSize: 24

Options
=======
focusPolicy: 0
xwaylandCrashPolicy: 
xwaylandMaxCrashCount: 3
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
activeMouseScreen: true
placement: 6
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 28
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 28
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 28
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777250
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
compositingMode: 1
useCompositing: true
hiddenPreviews: 1
glSmoothScale: 2
glStrictBinding: false
glStrictBindingFollowsDriver: true
glPreferBufferSwap: 101
glPlatformInterface: 2
windowsBlockCompositing: true
latencyPolicy: 
renderTimeEstimator: 

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  yes
Number of Screens: 1

Screen 0:
---------
Name: LVDS-1
Geometry: 0,0,1280x800
Scale: 1
Refresh Rate: 59936
Adaptive Sync: incapable

Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Mobile IntelĀ® GM45 Express Chipset (CTG)
OpenGL version string: 2.1 Mesa 22.2.0-devel-git-e9e8c649
OpenGL platform interface: EGL
OpenGL shading language version string: 1.20
Driver: Intel
GPU class: i965
OpenGL version: 2.1
GLSL version: 1.20
Mesa version: 22.2
Linux kernel version: 5.17.5
Direct rendering: Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used

Loaded Effects:
---------------
kwin4_effect_windowaperture
kwin4_effect_squash
kwin4_effect_sessionquit
kwin4_effect_scale
kwin4_effect_morphingpopups
kwin4_effect_maximize
kwin4_effect_logout
kwin4_effect_login
kwin4_effect_fullscreen
kwin4_effect_frozenapp
kwin4_effect_fadingpopups
kwin4_effect_dialogparent
colorpicker
zoom
blendchanges
screenshot
slidingpopups
slide
desktopgrid
highlightwindow
overview
windowview
screenedge
startupfeedback
kscreen
screentransform

Currently Active Effects:
-------------------------

Effect Settings:
----------------
kwin4_effect_windowaperture:
pluginId: kwin4_effect_windowaperture
isActiveFullScreenEffect: false

kwin4_effect_squash:
pluginId: kwin4_effect_squash
isActiveFullScreenEffect: false

kwin4_effect_sessionquit:
pluginId: kwin4_effect_sessionquit
isActiveFullScreenEffect: false

kwin4_effect_scale:
pluginId: kwin4_effect_scale
isActiveFullScreenEffect: false

kwin4_effect_morphingpopups:
pluginId: kwin4_effect_morphingpopups
isActiveFullScreenEffect: false

kwin4_effect_maximize:
pluginId: kwin4_effect_maximize
isActiveFullScreenEffect: false

kwin4_effect_logout:
pluginId: kwin4_effect_logout
isActiveFullScreenEffect: false

kwin4_effect_login:
pluginId: kwin4_effect_login
isActiveFullScreenEffect: false

kwin4_effect_fullscreen:
pluginId: kwin4_effect_fullscreen
isActiveFullScreenEffect: false

kwin4_effect_frozenapp:
pluginId: kwin4_effect_frozenapp
isActiveFullScreenEffect: false

kwin4_effect_fadingpopups:
pluginId: kwin4_effect_fadingpopups
isActiveFullScreenEffect: false

kwin4_effect_dialogparent:
pluginId: kwin4_effect_dialogparent
isActiveFullScreenEffect: false

colorpicker:

zoom:
zoomFactor: 1.2
mousePointer: 0
mouseTracking: 0
focusTrackingEnabled: false
textCaretTrackingEnabled: false
focusDelay: 350
moveFactor: 20
targetZoom: 1

blendchanges:

screenshot:

slidingpopups:
slideInDuration: 18
slideOutDuration: 31

slide:
horizontalGap: 45
verticalGap: 20
slideDocks: false
slideBackground: true

desktopgrid:
gridRows: 2
gridColumns: 1
animationDuration: 25
layout: 1
partialActivationFactor: 0
gestureInProgress: false
showAddRemove: true
desktopNameAlignment: 0
desktopLayoutMode: 0
customLayoutRows: 2

highlightwindow:

overview:
animationDuration: 25
layout: 1
ignoreMinimized: false
blurBackground: true
partialActivationFactor: 0
gestureInProgress: false

windowview:
animationDuration: 25
layout: 1
ignoreMinimized: false
mode: -400386208
partialActivationFactor: 0
gestureInProgress: false

screenedge:

startupfeedback:
type: 0

kscreen:

screentransform:


Loaded Plugins:
---------------
kwin5_plugin_colord
kwin5_plugin_krunner
kwin5_plugin_nightcolor
kwin5_plugin_screencast

Available Plugins:
------------------
kwin5_plugin_colord
kwin5_plugin_krunner
kwin5_plugin_nightcolor
kwin5_plugin_screencast
Comment 6 31113 2022-05-24 21:07:19 UTC
I have the same issue on fedora + marcdeop's copr.  Also nearly identical hardware.

I found these two lines in the logs to be interesting:

kwin_wayland[1383]: kwin_wayland_drm: drmSetClientCap for Atomic Mode Setting failed. Using legacy mode on GPU "/dev/dri/card0"
 
kwin_wayland_drm: Could not create drm framebuffer! Invalid argument

The latter one gets thrown in there a bunch of times.

I tried to get the output of drm_info, but I can't get it to install & run correctly...

output of `qdbus org.kde.KWin /KWin supportInformation`:
https://pastebin.com/8CaWbQZv
Comment 7 archetech 2022-05-27 00:50:55 UTC
LFS Source build 5.24.90  gtx960 nouveau wayland cursor works but is invisible.
Comment 8 Bug Janitor Service 2022-05-27 01:21:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2477
Comment 9 Vlad Zahorodnii 2022-05-27 15:39:07 UTC
Git commit f86f159fd5a04e467c374a0c8b234d912ecb7249 by Vlad Zahorodnii, on behalf of Xaver Hugl.
Committed on 27/05/2022 at 15:24.
Pushed by vladz into branch 'master'.

backends/drm: fall back to a software cursor if drmModeAddFB2 fails

M  +2    -1    src/backends/drm/drm_lease_egl_gbm_layer.cpp
M  +1    -1    src/backends/drm/drm_lease_egl_gbm_layer.h
M  +12   -13   src/backends/drm/drm_output.cpp
M  +3    -2    src/backends/drm/drm_output.h
M  +8    -4    src/backends/drm/drm_qpainter_layer.cpp
M  +4    -4    src/backends/drm/drm_qpainter_layer.h
M  +4    -1    src/backends/drm/egl_gbm_cursor_layer.cpp
M  +1    -1    src/backends/drm/egl_gbm_cursor_layer.h
M  +4    -1    src/backends/drm/egl_gbm_layer.cpp
M  +1    -1    src/backends/drm/egl_gbm_layer.h
M  +2    -1    src/backends/drm/virtual_egl_gbm_layer.cpp
M  +1    -1    src/backends/drm/virtual_egl_gbm_layer.h
M  +2    -1    src/backends/virtual/egl_gbm_backend.cpp
M  +1    -1    src/backends/virtual/egl_gbm_backend.h
M  +2    -1    src/backends/virtual/scene_qpainter_virtual_backend.cpp
M  +1    -1    src/backends/virtual/scene_qpainter_virtual_backend.h
M  +2    -1    src/backends/wayland/egl_wayland_backend.cpp
M  +1    -1    src/backends/wayland/egl_wayland_backend.h
M  +2    -1    src/backends/wayland/scene_qpainter_wayland_backend.cpp
M  +1    -1    src/backends/wayland/scene_qpainter_wayland_backend.h
M  +2    -1    src/backends/x11/standalone/eglbackend.cpp
M  +1    -1    src/backends/x11/standalone/eglbackend.h
M  +2    -1    src/backends/x11/standalone/glxbackend.cpp
M  +1    -1    src/backends/x11/standalone/glxbackend.h
M  +2    -1    src/backends/x11/windowed/egl_x11_backend.cpp
M  +1    -1    src/backends/x11/windowed/egl_x11_backend.h
M  +2    -1    src/backends/x11/windowed/scene_qpainter_x11_backend.cpp
M  +1    -1    src/backends/x11/windowed/scene_qpainter_x11_backend.h
M  +1    -1    src/outputlayer.h

https://invent.kde.org/plasma/kwin/commit/f86f159fd5a04e467c374a0c8b234d912ecb7249
Comment 10 Vlad Zahorodnii 2022-05-27 15:43:35 UTC
Git commit 3c1590d829296118f67bc1390fd602ed29d70fd0 by Vlad Zahorodnii, on behalf of Xaver Hugl.
Committed on 27/05/2022 at 15:43.
Pushed by vladz into branch 'Plasma/5.25'.

backends/drm: fall back to a software cursor if drmModeAddFB2 fails


(cherry picked from commit f86f159fd5a04e467c374a0c8b234d912ecb7249)

M  +2    -1    src/backends/drm/drm_lease_egl_gbm_layer.cpp
M  +1    -1    src/backends/drm/drm_lease_egl_gbm_layer.h
M  +12   -13   src/backends/drm/drm_output.cpp
M  +3    -2    src/backends/drm/drm_output.h
M  +8    -4    src/backends/drm/drm_qpainter_layer.cpp
M  +4    -4    src/backends/drm/drm_qpainter_layer.h
M  +4    -1    src/backends/drm/egl_gbm_cursor_layer.cpp
M  +1    -1    src/backends/drm/egl_gbm_cursor_layer.h
M  +4    -1    src/backends/drm/egl_gbm_layer.cpp
M  +1    -1    src/backends/drm/egl_gbm_layer.h
M  +2    -1    src/backends/drm/virtual_egl_gbm_layer.cpp
M  +1    -1    src/backends/drm/virtual_egl_gbm_layer.h
M  +2    -1    src/backends/virtual/egl_gbm_backend.cpp
M  +1    -1    src/backends/virtual/egl_gbm_backend.h
M  +2    -1    src/backends/virtual/scene_qpainter_virtual_backend.cpp
M  +1    -1    src/backends/virtual/scene_qpainter_virtual_backend.h
M  +2    -1    src/backends/wayland/egl_wayland_backend.cpp
M  +1    -1    src/backends/wayland/egl_wayland_backend.h
M  +2    -1    src/backends/wayland/scene_qpainter_wayland_backend.cpp
M  +1    -1    src/backends/wayland/scene_qpainter_wayland_backend.h
M  +2    -1    src/backends/x11/standalone/eglbackend.cpp
M  +1    -1    src/backends/x11/standalone/eglbackend.h
M  +2    -1    src/backends/x11/standalone/glxbackend.cpp
M  +1    -1    src/backends/x11/standalone/glxbackend.h
M  +2    -1    src/backends/x11/windowed/egl_x11_backend.cpp
M  +1    -1    src/backends/x11/windowed/egl_x11_backend.h
M  +2    -1    src/backends/x11/windowed/scene_qpainter_x11_backend.cpp
M  +1    -1    src/backends/x11/windowed/scene_qpainter_x11_backend.h
M  +1    -1    src/outputlayer.h

https://invent.kde.org/plasma/kwin/commit/3c1590d829296118f67bc1390fd602ed29d70fd0
Comment 11 Bug Janitor Service 2022-05-28 12:03:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2483
Comment 12 Zamundaaa 2022-05-28 12:18:19 UTC
Can someone with an affected system check if the merge request makes a difference vs git master? I'd rather not introduce the hack if not necessary
Comment 13 Behzad A 2022-05-28 17:14:25 UTC
(In reply to Vlad Zahorodnii from comment #9)
> Git commit f86f159fd5a04e467c374a0c8b234d912ecb7249 by Vlad Zahorodnii, on
> behalf of Xaver Hugl.
> Committed on 27/05/2022 at 15:24.
> Pushed by vladz into branch 'master'.
> 
> backends/drm: fall back to a software cursor if drmModeAddFB2 fails
> 
> https://invent.kde.org/plasma/kwin/commit/
> f86f159fd5a04e467c374a0c8b234d912ecb7249

(In reply to Zamundaaa from comment #12)
> Can someone with an affected system check if the merge request makes a
> difference vs git master? I'd rather not introduce the hack if not necessary

Currently, the issue solved for me with this commit, But I faced with new issue, When some random websites are open in Chrome browser, the mouse cursor starting to slowness and lag/delay in entire desktop and the issue only occur on Plasma Wayland session (Tested with Chrome native Wayland(Ozone/Wayland) and Chrome X11(Ozone/X11) on Plasma Wayland Session), But there is no problem on Plasma X11 session with same browser and website.

However, is there still a need to test the merger request?
Comment 14 Zamundaaa 2022-05-28 19:33:28 UTC
What the first merge request did is that it makes KWin reliably fall back to rendering the cursor manually whenever using the hardware cursor fails. As you already noticed though, this reduces performance.
The new merge request should fix that by making hardware cursors work again on your systems.
Comment 15 Behzad A 2022-05-29 13:01:29 UTC
(In reply to Zamundaaa from comment #14)
> What the first merge request did is that it makes KWin reliably fall back to
> rendering the cursor manually whenever using the hardware cursor fails. As
> you already noticed though, this reduces performance.
> The new merge request should fix that by making hardware cursors work again
> on your systems.

I built Kwin(git-df7e3867) with your merge request, And in compared with git-master, in overall, Yes, I can see enhancement in performance, But in the situation that I described earlier, the cursor lag still occurs when that the cursor icon is changing , But on X11 session, even when the desktop workspace(Panel and Menus, ...) are not responsive, the mouse cursor is fully responsive.
Comment 16 Mark Daniels 2022-06-22 00:13:31 UTC
Hi folks. Having this exact same problem on a fresh install of KDE Neon with Plasma 5.25. Any idea on when the merge request to fix the hardware cursor will be implemented? Much thanks.
Comment 17 Bug Janitor Service 2022-07-13 07:51:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2646
Comment 18 Zamundaaa 2022-07-13 20:25:41 UTC
Git commit 7f04ea578f6b59f36f6321669a8eab3750e021c5 by Xaver Hugl.
Committed on 13/07/2022 at 19:10.
Pushed by zamundaaa into branch 'master'.

backends/drm: handle broken legacy drivers better

Some legacy drivers either don't accept gbm buffers suitable for cursors,
or don't handle them properly. In order to work around that, always do a
CPU import with legacy and use dumb buffers instead.
Related: bug 456306

M  +6    -2    src/backends/drm/egl_gbm_cursor_layer.cpp
M  +17   -16   src/backends/drm/egl_gbm_layer_surface.cpp
M  +11   -6    src/backends/drm/egl_gbm_layer_surface.h

https://invent.kde.org/plasma/kwin/commit/7f04ea578f6b59f36f6321669a8eab3750e021c5
Comment 19 Zamundaaa 2022-07-13 20:35:23 UTC
Git commit f3c1facdc477a18ff5c528972ffef5d09a3a6a35 by Xaver Hugl.
Committed on 13/07/2022 at 20:35.
Pushed by zamundaaa into branch 'Plasma/5.25'.

backends/drm: handle broken legacy drivers better

Some legacy drivers either don't accept gbm buffers suitable for cursors,
or don't handle them properly. In order to work around that, always do a
CPU import with legacy and use dumb buffers instead.
Related: bug 456306


(cherry picked from commit 7f04ea578f6b59f36f6321669a8eab3750e021c5)

M  +6    -2    src/backends/drm/egl_gbm_cursor_layer.cpp
M  +17   -16   src/backends/drm/egl_gbm_layer_surface.cpp
M  +11   -6    src/backends/drm/egl_gbm_layer_surface.h

https://invent.kde.org/plasma/kwin/commit/f3c1facdc477a18ff5c528972ffef5d09a3a6a35