Bug 513277 - With direct scanout enabled, on latest kernel desktop background image bounces up and down a pixel on secondary monitor
Summary: With direct scanout enabled, on latest kernel desktop background image bounce...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 6.5.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen, regression
Depends on:
Blocks:
 
Reported: 2025-12-13 01:17 UTC by moichumoigaming
Modified: 2026-01-08 18:34 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
drm_info output when off by 1 pixel (216.29 KB, text/plain)
2025-12-20 16:33 UTC, moichumoigaming
Details
drm_info output when correct (216.30 KB, text/plain)
2025-12-20 16:42 UTC, moichumoigaming
Details

Note You need to log in before you can comment on or make changes to this bug.
Description moichumoigaming 2025-12-13 01:17:59 UTC
SUMMARY
My secondary desktop background image, when I move my cursor to it from my primary screen, and when right-clicking the context menu with my cursor on it, bounces up and down a pixel, visible at the top of the screen.

STEPS TO REPRODUCE
1. Have a primary monitor with fractional scaling - I use 150% - and of a higher resolution than your secondary monitor. I use a 3840x2160 monitor.
2. Have a secondary monitor with fractional scaling - I use 150% - and of a lower resolution than your primary monitor. I use a 1920x1080 monitor.
3. Move your cursor between the two screens. Right-click the desktop on the secondary monitor.

OBSERVED RESULT
The desktop background image will bounce up and down a pixel on the secondary monitor. Visible at the top of the screen.

EXPECTED RESULT
The image should remain stable.

SOFTWARE/OS VERSIONS
Operating System: CachyOS Linux
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.20.0
Qt Version: 6.10.1
Kernel Version: 6.18.0-3-cachyos (64-bit)
Graphics Platform: Wayland

GPU1 : AMD RX 9070 XT
GPU2 (headless, connected to a display, but not outputting by kwin): NVIDIA GeForce GTX 1080 Ti

My screen setup :
Left : 1080p 60hz, 150% scaling, 10 bit colors.
Middle : 2160p 240hz with DSC (display stream compression), 150% scaling, 10 bit colors.
Right : 1080p 60hz, 100% scaling, 10 bit colors.

ADDITIONAL INFORMATION
This does not happen on my third non scaled 1080p monitor.
This appeared in plasma 6.5.0.

This does not happen on the LTS kernel of my distro, which is kernel 6.12.60-2-cachyos-lts.
Comment 1 Nate Graham 2025-12-16 22:30:04 UTC
Seems like a kernel regression, and thanks for doing that troubleshooting! Can you report this to the CachyOS folks!
Comment 2 Zamundaaa 2025-12-16 22:33:39 UTC
First, can you check if it still happens if you set https://invent.kde.org/plasma/kwin/-/wikis/Environment-Variables#kwin_drm_no_direct_scanout to 1?
Comment 3 Zamundaaa 2025-12-16 22:33:49 UTC
.
Comment 4 moichumoigaming 2025-12-16 23:44:21 UTC
On the latest kernel, 6.18.1-2-cachyos, with KWIN_DRM_NO_DIRECT_SCANOUT=1, the issue is fixed!
Comment 5 Zamundaaa 2025-12-19 18:55:31 UTC
Okay, can you remove it again, and then get the drm_info output while the image is mispositioned by that one pixel?
You can do
> sleep 5; drm_info
+ minimized the terminal, or run the command from ssh
Comment 6 moichumoigaming 2025-12-20 16:33:49 UTC
Created attachment 187818 [details]
drm_info output when off by 1 pixel

Here is the output when the image is mispositioned by one pixel. Let me know if you would like the output when the image is not mispositioned as well. I attached the output in a txt file, because it is too long to leave in a comment.
Comment 7 moichumoigaming 2025-12-20 16:42:07 UTC
Created attachment 187819 [details]
drm_info output when correct

Just to be proactive, here is the output when the image is correct (not off by 1 pixel).

Running the "diff" command on both text files, this difference may be relevant:
1286c1286
<     │       ├───"CRTC_Y" (atomic): srange [INT32_MIN, INT32_MAX] = 1
---
>     │       ├───"CRTC_Y" (atomic): srange [INT32_MIN, INT32_MAX] = 0

Top line is when off by one pixel, bottom line is when correct.
Comment 8 Zamundaaa 2026-01-07 21:46:56 UTC
Afaict this is caused by a simple difference in rounding between the renderer vs. direct scanout. Specifically, the output position is rounded in the renderer, but *not* rounded in the direct scanout code path.
Comment 9 Bug Janitor Service 2026-01-07 23:49:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/8606
Comment 10 Zamundaaa 2026-01-08 18:34:13 UTC
Git commit a8215b883f5418084c40cbc20438beb7cabd1d7e by Xaver Hugl.
Committed on 08/01/2026 at 18:33.
Pushed by zamundaaa into branch 'master'.

compositor: more consistently map geometries to the pixel grid

While the renderer rounds output / viewport position and geometry separately,
the direct scanout code so far never snapped output coordinates to the scaled
coordinate grid of that output. That difference can in some cases result in
visible differences between rendering and direct scanout.
This commit aligns the direct scanout code to match the renderer.

M  +18   -8    src/compositor.cpp

https://invent.kde.org/plasma/kwin/-/commit/a8215b883f5418084c40cbc20438beb7cabd1d7e
Comment 11 Zamundaaa 2026-01-08 18:34:15 UTC
Git commit 4264dafded4cb5db4603a3000853c974c065fba5 by Xaver Hugl.
Committed on 08/01/2026 at 18:33.
Pushed by zamundaaa into branch 'master'.

autotests/integration/drm: add test case for overlays with output scaling

Specifially also with an output at a non-zero position, which exposed some
issues in the plane coordinate calculations.

M  +1    -0    autotests/integration/CMakeLists.txt
M  +37   -17   autotests/integration/drm_test.cpp
M  +4    -0    autotests/integration/kwin_wayland_test.h
M  +11   -0    autotests/integration/test_helpers.cpp

https://invent.kde.org/plasma/kwin/-/commit/4264dafded4cb5db4603a3000853c974c065fba5