https://bugs.kde.org/show_bug.cgi?id=471517
Bug ID: 471517 Summary: Whole-screen diagonal-stripes glitch on external display with hybrid graphics Classification: Plasma Product: kwin Version: 5.27.6 Platform: Archlinux OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: wayland-generic Assignee: kwin-bugs-n...@kde.org Reporter: i...@nisavid.io Target Milestone: --- Created attachment 159935 --> https://bugs.kde.org/attachment.cgi?id=159935&action=edit photo of the distorted screen SUMMARY With the default configuration running on Wayland, the entire screen's image on my external display is distorted in a way that makes that screen totally unusable and has an appearance of diagonal stripes from the top right to the bottom left. Looking closely at the distorted image and moving the mouse cursor around on that screen, it seems that each subsequent row of pixels is effectively being shifted to the left by some number of pixels. That is to say, perhaps all of the screen's pixels are being rendered, but the rows are all so misaligned as to be incoherent. Screenshotting with Spectacle doesn't capture the distortion. A photo of the distorted screen is attached. This system has NVIDIA Optimus hybrid graphics with Intel UHD Graphics 630 as the integrated GPU (DRI card0) and NVIDIA GeForce GTX 1070 Mobile as the discrete GPU (DRI card1). The internal display is wired via Embedded DisplayPort to the iGPU; there are Mini DisplayPort and HDMI ports that are both wired to the dGPU. The internal display (which renders as expected) is an AU Optronics panel connected via eDP and has a native resolution of 3840×2160. The external display (affected by this issue) is an ASUS ROG PG348Q connected via mDP and has a native resolution of 3440×1440. The issue manifests identically under all these conditions: • the display is connected via mDP, HDMI, or an mDP-to-HDMI adapter • the display refresh rate is set to any value between 50 and 100 Hz via KScreen • the two screens are rearranged in any manner via KScreen • the scaling factor for either screen is adjusted to any value via KScreen • either screen is chosen as the primary display via KScreen • the EDID for both screens is retrieved via Windows 11 and applied during initramfs startup via the drm.edid_firmware kernel parameter The issue goes away if I set the external display's resolution to anything below 3440×1440 via KScreen. Strangely, KScreen only offers 1024×768, 800×600, and 640×480—the same resolutions as are listed by /sys/class/drm/card1-DP-2/modes—whereas in actuality the display supports many other resolutions, as one would expect, and which xrandr sees just fine. Even more oddly, KScreen offers all the expected resolutions for my internal display, even though /sys/class/drm/card0-eDP-1/modes only lists 3840×2160. Setting KWIN_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0 resolves the issue completely. That is, I have to configure KWin to prioritize my dGPU (NVIDIA) first and my iGPU (Intel) second. I do this by putting the following line in /etc/environment: export KWIN_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0 Doing this in ~/.config/plasma-workspace/env/kwin.sh instead also works to fix the Plasma session, but I prefer to put it in /etc/environment so that SDDM also picks it up. I've configured SDDM to run on Wayland using KWin as its compositor; in this configuration, SDDM suffers the same glitch in the absence of the above setting in /etc/environment. KWin's default behavior seems to be equivalent to KWIN_DRM_DEVICES=/dev/dri/card0:/dev/dri/card1 (iGPU first, dGPU second). Setting KWIN_DRM_DEVICES=/dev/dri/card0 causes only the internal display to be operational (correctly). Setting KWIN_DRM_DEVICES=/dev/dri/card1 causes only the external display to be operational (correctly). The issue is not reproducible using Hyprland or Mutter with their default configurations. STEPS TO REPRODUCE 1. Launch a Plasma Wayland session with the external display connected. OBSERVED RESULT The entire screen on the external display is severely distorted. The screen on the internal display is rendered correctly. EXPECTED RESULT Both screens are rendered correctly. SOFTWARE/OS VERSIONS Operating System: CachyOS Linux KDE Plasma Version: 5.27.6 KDE Frameworks Version: 5.107.0 Qt Version: 5.15.10 Kernel Version: 6.3.9-1-cachyos (64-bit) Graphics Platform: Wayland Processors: 12 × Intel® Core™ i7-8750H CPU @ 2.20GHz Memory: 31.2 GiB of RAM Graphics Processor: NVIDIA GeForce GTX 1070 with Max-Q Design/PCIe/SSE2 Manufacturer: GIGABYTE Product Name: AERO 15XV8 ADDITIONAL INFORMATION $ inxi -Gazy Graphics: Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] vendor: Gigabyte driver: i915 v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: eDP-1 empty: DP-1 bus-ID: 00:02.0 chip-ID: 8086:3e9b class-ID: 0300 Device-2: NVIDIA GP104M [GeForce GTX 1070 Mobile] vendor: Gigabyte driver: nvidia v: 535.54.03 alternate: nouveau,nvidia_drm non-free: 530.xx+ status: current (as of 2023-05) arch: Pascal code: GP10x process: TSMC 16nm built: 2016-21 pcie: gen: 1 speed: 2.5 GT/s lanes: 16 link-max: gen: 3 speed: 8 GT/s ports: active: none off: DP-2 empty: HDMI-A-1 bus-ID: 01:00.0 chip-ID: 10de:1ba1 class-ID: 0300 Device-3: Sunplus Innovation HD WebCam driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-9:5 chip-ID: 1bcf:2c6b class-ID: 0e02 Display: wayland server: X.org v: 1.21.1.8 with: Xwayland v: 23.1.2 compositor: kwin_wayland driver: X: loaded: modesetting,nvidia alternate: fbdev,intel,nouveau,nv,vesa dri: iris gpu: i915,nvidia d-rect: 4459x2112 display-ID: 0 Monitor-1: DP-2 pos: top-right res: 2752x1152 size: N/A modes: N/A Monitor-2: eDP-1 pos: bottom-l res: 1707x960 size: N/A modes: N/A API: OpenGL v: 4.6 Mesa 23.1.3 renderer: Mesa Intel UHD Graphics 630 (CFL GT2) direct-render: Yes $ kscreen-doctor --outputs Output: 1 eDP-1 enabled connected priority 1 Panel Modes: 0:3840x2160@60*! 1:1600x1200@60 2:1280x1024@60 3:1024x768@60 4:2560x1600@60 5:1920x1200@60 6:1280x800@60 7:3840x2160@60 8:3200x1800@60 9:2880x1620@60 10:2560x1440@60 11:1920x1080@60 12:1600x900@60 13:1368x768@60 14:1280x720@60 Geometry: 0,192 1707x960 Scale: 2.25 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: Full Output: 2 DP-2 enabled connected priority 2 DisplayPort Modes: 0:3440x1440@60! 1:3440x1440@100* 2:3440x1440@95 3:3440x1440@90 4:3440x1440@85 5:3440x1440@80 6:3440x1440@50 7:1024x768@60 8:800x600@60 9:640x480@60 Geometry: 1707,0 2752x1152 Scale: 1.25 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown -- You are receiving this mail because: You are watching all bug changes.