Bug 476538

Summary: With Nvidia Quadro 1000M GPU on Wayland, external monitor shows corrupted image
Product: [Plasma] kwin Reporter: robgssp
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: nate, xaver.hugl
Priority: NOR Keywords: wayland-only
Version First Reported In: 5.27.9   
Target Milestone: ---   
Platform: NixOS   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Garbled external screen
drm_info on Plasma Wayland
drm_info on Plasma X11
drm_info on Gnome Wayland
patch with debug logs

Description robgssp 2023-11-04 08:56:09 UTC
Created attachment 162855 [details]
Garbled external screen

SUMMARY
External monitor corrupted under Plasma Wayland on a Thinkpad W520.

STEPS TO REPRODUCE
1. Start with a Plasma Wayland session
2. Plug in and enable an external monitor

OBSERVED RESULT
Monitor renders a garbled viewport. It looks like successive scan-lines are offset horizontally, so there ends up being five repeating columns going across the display.

EXPECTED RESULT
Screen renders normally.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9
Kernel Version: 6.1.44

ADDITIONAL INFORMATION
The hardware is a Thinkpad W520 with an Nvidia Quadro 1000M graphics card (I think equivalent to a GTX 540M), and Intel integrated graphics, dating to around 2012. Graphics driver is the open-source Nouveau.

The problem doesn't manifest under X11, or under Gnome's Wayland session. It seems to be specific to Plasma Wayland. I'd like to use plasma with wayland here if possible, just because X tears particularly badly on this hardware.

Here's a link to a video I took of the bug: https://photos.google.com/share/AF1QipPFOuyyz1oouAEAAkqAl95eaC-B0yLuvVfGddCl9-Q5c0Q9N5ipwPCPxcSm8ZCQUQ?key=NDRxNkF5Vm1vZWF3T1hUX2I1Rk8yckpWMm9FVERR
Interestingly, while everything else gets skewed across the screen, you can see the mouse cursor isn't effected. It stays contiguous the whole time.

So far I've only seen this bug on this hardware running plasma wayland. With that configuration it's manifested on every monitor I've tested so far. Changing resolution doesn't fix it; the resolution does visibly change but the view's still garbled. Interestingly, setting the overscan option results in contiguous black bars on the screen border, rather than the bars getting skewed across with everything else.
Comment 1 Zamundaaa 2023-11-04 13:25:55 UTC
Please attach the output of drm_info while you're in the Wayland session, with the screen that doesn't work correctly connected and enabled
Comment 2 robgssp 2023-11-04 18:47:34 UTC
Created attachment 162865 [details]
drm_info on Plasma Wayland
Comment 3 robgssp 2023-11-04 18:47:52 UTC
Created attachment 162866 [details]
drm_info on Plasma X11
Comment 4 robgssp 2023-11-04 18:48:09 UTC
Created attachment 162867 [details]
drm_info on Gnome Wayland
Comment 5 robgssp 2023-11-04 19:29:02 UTC
Attached, thanks. It looks like the main difference is in Card 1 Plane 0's format modifier: Plasma has it set to DRM_FORMAT_MOD_LINEAR, while X has it set to NVIDIA_BLOCK_LINEAR_2D(h=4, k=254, g=0, s=1, c=0)
Comment 6 Zamundaaa 2023-11-06 17:03:59 UTC
Okay, this is almost certainly already fixed in 5.27.7
Comment 7 robgssp 2023-11-06 19:42:53 UTC
No luck there, unfortunately. The bug appears unchanged in Plasma 5.27.9. There's also another issue in .9 where the display settings pane shows the external display as mirrored when it's been set to extend, but I'm guessing that's unrelated.
Comment 8 Zamundaaa 2023-11-09 20:58:41 UTC
hmm, maybe there's still something wrong in the CPU copy code then. If I provide a patch with debug prints for 5.27.9, would you build and run that on your system? I can't reproduce the issue on my laptop
Comment 9 robgssp 2023-11-10 00:30:37 UTC
Yeah, can do. I'm out of town til Monday, I'll get you the output once I'm back.
Comment 10 Zamundaaa 2023-11-14 15:13:44 UTC
Created attachment 163152 [details]
patch with debug logs

There you go. Just run it with the issue present, and then attach the output of
> journalctl --user-unit plasma-kwin_wayland --boot 0
here
Comment 11 Zamundaaa 2024-01-22 23:52:43 UTC
.
Comment 12 Bug Janitor Service 2024-02-06 03:45:32 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 13 Bug Janitor Service 2024-02-21 03:46:15 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!