Bug 493166 - cursor doesnt go away in fullscreen games like THE FINALS
Summary: cursor doesnt go away in fullscreen games like THE FINALS
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: xwayland (show other bugs)
Version: 6.2.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-09-15 17:29 UTC by pollux/ned
Modified: 2024-10-20 01:27 UTC (History)
8 users (show)

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


Attachments
real cursor (left) and after image (right) (2.61 MB, image/png)
2024-10-12 12:28 UTC, stefanfunk1998
Details
drm_info after bug triggers (116.25 KB, text/plain)
2024-10-17 00:12 UTC, Daktyl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pollux/ned 2024-09-15 17:29:32 UTC
SUMMARY
When you play a game like THE FINALS the cursor will stay on the screen when clicking on the game when a match starts, if you click on the shortcut it wont do it 

STEPS TO REPRODUCE
1. Launch the finals
2. Play a random match like powershift for example
3. Click on the game not the shortcut on the panel when the game actually starts
4. Watch the cursor stay on the screen where it was last put

OBSERVED RESULT


EXPECTED RESULT
click on the game and the cursor shouldn't stay where it was last put

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch linux
KDE Plasma Version: 6.1.90
KDE Frameworks Version: 6.5.0
Qt Version: 6.8.0

ADDITIONAL INFORMATION
Comment 1 stefanfunk1998 2024-10-12 12:28:58 UTC
Created attachment 174734 [details]
real cursor (left) and after image (right)
Comment 2 stefanfunk1998 2024-10-12 12:29:25 UTC
i've been experiencing this issue on arch linux since upgrading to plasma 6.2.0, specifically on the game Final Fantasy XIV, which uses a custom cursor icon, i guess similarly to the finals?

i have 2 monitors, and when i click-to-focus the game window, an after image of the cursor appears where i clicked the window, and will stay there until i tab out of the game again.

alt-tabbing or clicking the icon in the task manager doesnt cause this to happen.

also the fake cursor after image is not capturable by spectacle, regardless of the option to include the cursor in the screenshot, so i took a picture with my phone
Comment 3 stefanfunk1998 2024-10-12 12:30:28 UTC
oh and my system info is arch linux,
kde plasma version: 6.2.0
kde frameworks version 6.6.0
qt version: 6.7.3
Comment 4 Łukasz Plich 2024-10-12 14:48:28 UTC
Also experiencing this bug on Fedora 41 Beta.
Alt+tabbing the game causes the second cursor to disappear.
This does only happen in games with custom cursors (at least in DOTA 2 and PowerWash Simulator) but I'm not entirely sure how to consistently make this bug appear. It's mostly appearing when launching the game.

Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Kernel Version: 6.11.3-300.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 5900X 12-Core Processor
Memory: 62.7 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7A38
System Version: 6.0
Comment 5 Daktyl 2024-10-12 17:02:59 UTC
I can confirm this bug still exists on version 6.2 in the Arch repos. Changing focus to the game via click it's icon on the taskbar is a workaround currently. Clicking inside of the window itself WILL leave a ghost image of the mouse 100% of the time.
Comment 6 stefanfunk1998 2024-10-14 10:35:22 UTC
weirdly enough, since yesterday, on arch linux, i dont have the issue anymore, but the "about my system" section of the kde setting still tell me the same versions for everything, i dont know if some other package is responsible for this issue?
Comment 7 qmaru99 2024-10-14 11:52:41 UTC
Issue is still present both using lutris (wow, hots), steam (any game that uses custom cursor)

Arch, KDE6.2
Comment 8 stefanfunk1998 2024-10-16 10:36:35 UTC
i thought it was mentioned here in this thread, but i saw somewhere, where i was talking with other people about this issue, that they fixed it by enabling vsync inside the games settings

then i remembered that i changed the Plasma setting to enable tearing in fullscreen windows to no longer allow tearing (forcing global vsync?) and then the issue no longer appeared for me

after now testing, enabling the setting again to allow tearing (and apparently restarting the system to make it take effect?), i can reproduce the error reliably again.
Comment 9 Zamundaaa 2024-10-16 17:57:47 UTC
(In reply to stefanfunk1998 from comment #8)
> i thought it was mentioned here in this thread, but i saw somewhere, where i
> was talking with other people about this issue, that they fixed it by
> enabling vsync inside the games settings
> 
> then i remembered that i changed the Plasma setting to enable tearing in
> fullscreen windows to no longer allow tearing (forcing global vsync?) and
> then the issue no longer appeared for me
> 
> after now testing, enabling the setting again to allow tearing (and
> apparently restarting the system to make it take effect?), i can reproduce
> the error reliably again.

Thanks, that's very useful information. Because of limitations in the kernel API (that are being resolved upstream), we can't currently use the hardware cursor and do tearing at the same time, so KWin disables the hardware cursor while trying to do tearing. Something must be going wrong with that.

If you put
KWIN_FORCE_SW_CURSOR=1
into /etc/environment and reboot, does this still happen (with allow tearing enabled)?
Comment 10 username 2024-10-16 18:57:56 UTC
It doesn't happen with KWIN_DRM_NO_AMS=1 and tearing enabled
Comment 11 Daktyl 2024-10-16 22:03:12 UTC
(In reply to Zamundaaa from comment #9)
> If you put
> KWIN_FORCE_SW_CURSOR=1
> into /etc/environment and reboot, does this still happen (with allow tearing
> enabled)?

I can confirm that putting that environment variable into /etc/environment and rebooting does stop this issue from happening, at least with the game I was having issues on.
Comment 12 Zamundaaa 2024-10-16 23:53:44 UTC
Okay, that's at least working then. My best guess would be that the hardware plane wrongly stays enabled then.

Please remove that environment variable again, reboot, run
> sleep 10; drm_info
in a terminal, trigger the second cursor to be visible before the 10s are up (increase the time if you need more) and attach the output here.
Comment 13 Daktyl 2024-10-17 00:12:42 UTC
Created attachment 174923 [details]
drm_info after bug triggers

Fulfilled request for drm_info output after the bug triggers
Comment 14 Zamundaaa 2024-10-17 01:31:48 UTC
Thanks. It's just as I thought, the hardware plane stays enabled:
    │       ├───"type" (immutable): enum {Overlay, Primary, Cursor} = Cursor
    │       ├───"FB_ID" (atomic): object framebuffer = 148
    │       │   ├───Object ID: 148
    │       │   ├───Size: 64×64
    │       │   ├───Format: ARGB8888 (0x34325241)
    │       │   ├───Modifier: DRM_FORMAT_MOD_LINEAR (0x0000000000000000)
    │       │   └───Planes:
    │       │       └───Plane 0: offset = 0, pitch = 256 bytes

Probably because tearing is enabled first, and the cursor would only be disabled afterwards (which fails, because we can't update the cursor at all with tearing). This shouldn't be too hard to fix.
Comment 15 Bug Janitor Service 2024-10-18 12:49:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6663
Comment 16 Zamundaaa 2024-10-18 14:58:03 UTC
Git commit 21b11326959431073ca9a3d2a63e975be66ced00 by Xaver Hugl.
Committed on 18/10/2024 at 14:42.
Pushed by zamundaaa into branch 'master'.

backends/drm: don't allow tearing until the cursor plane is disabled

Once tearing is enabled, atomic tests that try to disable the cursor plane will fail.

M  +8    -0    src/backends/drm/drm_output.cpp

https://invent.kde.org/plasma/kwin/-/commit/21b11326959431073ca9a3d2a63e975be66ced00
Comment 17 Zamundaaa 2024-10-18 15:31:47 UTC
Git commit 8090e0264fff32dd73197a5e39d3b2de6309fde0 by Xaver Hugl.
Committed on 18/10/2024 at 15:03.
Pushed by zamundaaa into branch 'Plasma/6.2'.

backends/drm: don't allow tearing until the cursor plane is disabled

Once tearing is enabled, atomic tests that try to disable the cursor plane will fail.


(cherry picked from commit 21b11326959431073ca9a3d2a63e975be66ced00)

Co-authored-by: Xaver Hugl <xaver.hugl@gmail.com>

M  +8    -0    src/backends/drm/drm_output.cpp

https://invent.kde.org/plasma/kwin/-/commit/8090e0264fff32dd73197a5e39d3b2de6309fde0