Bug 457021 - Mouse cursor problems with Neverputt game on Plasma Wayland with amdgpu
Summary: Mouse cursor problems with Neverputt game on Plasma Wayland with amdgpu
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: 5.25.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://neverball.org/
Keywords: wayland
Depends on: 444063
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-22 14:28 UTC by vulture6
Modified: 2023-05-15 07:53 UTC (History)
4 users (show)

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


Attachments
The start of the 'Golf Jambalaya' course being displayed incorrectly. (226.03 KB, image/jpeg)
2022-07-22 14:28 UTC, vulture6
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vulture6 2022-07-22 14:28:32 UTC
Created attachment 150820 [details]
The start of the 'Golf Jambalaya' course being displayed incorrectly.

+++ This bug was initially created as a clone of Bug #444063 +++

SUMMARY

At the start of a new shot in Neverputt, the strength/direction mouse cursor doesn't display properly when the game is run on Plasma Wayland. It positions the course at a weird angle and the default strength meter is always set to maximum. This happens in both full-screen and windowed (see attached screenshot).

Game runs perfectly on Gnome Wayland and also all X11 versions, including KDE. 

This was seemingly fixed on Intel - see Bug #444063 - but is still present on amdgpu. It was tested on EndeavourOS and Manjaro.

SOFTWARE/OS VERSIONS

Operating System: EndeavourOS
KDE Plasma Version: 5.25.3
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.18.12-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD Ryzen 3 PRO 4350GE with Radeon Graphics
Memory: 15.0 GiB of RAM
Graphics Processor: AMD RENOIR
Manufacturer: LENOVO
Product Name: 11JKS07500
System Version: ThinkCentre M75q Gen 2
Comment 1 vulture6 2022-08-30 14:42:50 UTC
With the latest build of Neverputt 1.6.0 on Arch and OpenSUSE, the problem has got worse. Not only does it display the shot at a weird angle, but it's no longer even possible to correct this with the mouse. The mouse cursor will only move left or right a tiny amount.
Comment 2 David Edmundson 2023-05-04 09:35:35 UTC
Findings:
 - I could reproduce an issue with Neverputt, but Neverball seemed to behave
 - Both were run via xwayland
 - Starting another (rootful) xwayland to get logs also seemed to have it mostly behave

Right now this might be a kwin issue, it might be an Xorg issue
Comment 3 David Edmundson 2023-05-04 09:49:37 UTC
Updates: sometimes reproducible with nested xwayland, sometimes not

xwyaland is creating a confined pointer with no region, lifespan is persistent:

On focus out, we send a slightly weird

[ 275145.358] discarded zwp_confined_pointer_v1@37.unconfined()
[ 275145.359] discarded zwp_confined_pointer_v1@37.confined()
[ 275145.360] discarded zwp_confined_pointer_v1@37.unconfined()

though this is after client destruction so not very relevant

our relative motion events look sane, they don't match what we're seeing in the game.
Comment 4 Bug Janitor Service 2023-05-04 11:35:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4055
Comment 5 Bug Janitor Service 2023-05-04 12:52:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4056
Comment 6 Vlad Zahorodnii 2023-05-05 09:15:44 UTC
Git commit 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13 by Vlad Zahorodnii.
Committed on 05/05/2023 at 09:01.
Pushed by vladz into branch 'master'.

wayland: Avoid pointer warp if constraint region is invalid

It may happen that the constraint region doesn't include the specified
cursor hint anymore. If that's the case, avoid warping the pointer.

M  +2    -2    src/pointer_input.cpp

https://invent.kde.org/plasma/kwin/commit/7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13
Comment 7 Vlad Zahorodnii 2023-05-05 09:52:44 UTC
Git commit d7033a3c83134f383fbbd8e005ff6a10c79e48d4 by Vlad Zahorodnii.
Committed on 05/05/2023 at 09:26.
Pushed by vladz into branch 'Plasma/5.27'.

wayland: Avoid pointer warp if constraint region is invalid

It may happen that the constraint region doesn't include the specified
cursor hint anymore. If that's the case, avoid warping the pointer.


(cherry picked from commit 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13)

M  +2    -2    src/pointer_input.cpp

https://invent.kde.org/plasma/kwin/commit/d7033a3c83134f383fbbd8e005ff6a10c79e48d4
Comment 8 Bug Janitor Service 2023-05-11 20:00:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4094
Comment 9 Vlad Zahorodnii 2023-05-12 06:26:05 UTC
Git commit 07da1796b8388b00275d8281fac476bde71cd02b by Vlad Zahorodnii.
Committed on 11/05/2023 at 19:56.
Pushed by vladz into branch 'master'.

Revert "wayland: Avoid pointer warp if constraint region is invalid"

This reverts commit 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13.

It created regressions in some video games. After a closer look at the
pointer constraint region handling, there are some issues, but it might
be safer to fix them in master.

In meanwhile, let's revert 7c91c4bad because it breaks more things than
it fixes.
Related: bug 469555

M  +2    -2    src/pointer_input.cpp

https://invent.kde.org/plasma/kwin/commit/07da1796b8388b00275d8281fac476bde71cd02b
Comment 10 Bug Janitor Service 2023-05-12 06:26:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4096
Comment 11 Vlad Zahorodnii 2023-05-12 07:50:41 UTC
Git commit 3d62e7548955e2ddf298c61a55fcd26007ea27bb by Vlad Zahorodnii.
Committed on 12/05/2023 at 06:26.
Pushed by vladz into branch 'Plasma/5.27'.

Revert "wayland: Avoid pointer warp if constraint region is invalid"

This reverts commit 7c91c4bad9ee709eebfdf9d5b3997fa00ca7cd13.

It created regressions in some video games. After a closer look at the
pointer constraint region handling, there are some issues, but it might
be safer to fix them in master.

In meanwhile, let's revert 7c91c4bad because it breaks more things than
it fixes.
Related: bug 469555


(cherry picked from commit 07da1796b8388b00275d8281fac476bde71cd02b)

M  +2    -2    src/pointer_input.cpp

https://invent.kde.org/plasma/kwin/commit/3d62e7548955e2ddf298c61a55fcd26007ea27bb
Comment 12 Vlad Zahorodnii 2023-05-15 07:53:01 UTC
Git commit 6c71b8720038e108ce4e494b0ef99e15e8e5b67d by Vlad Zahorodnii.
Committed on 15/05/2023 at 07:36.
Pushed by vladz into branch 'master'.

wayland: Fix null pointer constraint region handling

If the pointer constraint region is null, the input region must be used
instead. If the pointer constraint region is valid, it should be
intersected with the input region.

M  +15   -23   src/pointer_input.cpp
M  +24   -4    src/wayland/autotests/client/test_pointer_constraints.cpp
M  +35   -10   src/wayland/pointerconstraints_v1_interface.cpp
M  +2    -0    src/wayland/pointerconstraints_v1_interface_p.h
M  +10   -9    src/wayland/surface_interface.cpp
M  +0    -10   src/window.cpp
M  +0    -1    src/window.h

https://invent.kde.org/plasma/kwin/commit/6c71b8720038e108ce4e494b0ef99e15e8e5b67d