wslg icon indicating copy to clipboard operation
wslg copied to clipboard

Graphics artifacts when using SDL

Open davidgiga1993 opened this issue 2 years ago • 29 comments

Windows Version

Microsoft Windows [Version 10.0.22621.2428]

WSL Version

2.0.6.0

Are you using WSL 1 or WSL 2?

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

5.15.133.1

Distro Version

Ubuntu 22.04

Other Software

Custom application using SDL graphics api

Repro Steps

Open the app, UI is completely distorted and the UI is drawn out of the window bounds. Looks like this is the root cause as the actual drawn content looks correct, just shifted.

The correct image is rendered when dragging the window (flickering).

I did not have this issue in previous WSL 2 versions, but I don't know on which exact version it still was working.

Expected Behavior

image

Actual Behavior

image

Diagnostic Logs

Please let me know if you need additional logs

davidgiga1993 avatar Oct 27 '23 05:10 davidgiga1993

@davidgiga1993 the issue was introduced with the 2.0.6 release. After upgrading to 2.0.6 I've upgraded the Nvidia graphics driver also and wasn't sure what causes the artifacts. Building WSLg and replacing the system distro the artifacts are gone so it's not the Nvidia driver.

elsaco@mantic:/mnt/wslg$ cat versions.txt
WSLg ( x86_64 ): <current>
Mariner: VERSION="2.0.20230630"
DirectX-Headers: cf123266ce6f1e9a6e700642edb6356bff1e3d55
mesa: be4f7fb656180ab55a50eff01f36672b0bf5f146
pulseaudio: 6f045ff0dca233a939a2aba815f84d177e294122
FreeRDP: c4030980b29322a9cb2190711a5fadeeeb8b6a33
weston: 1c19fc5ecdd4552f36f77256e1fb53225801aff0

WSLg build instructions: https://github.com/microsoft/wslg/blob/main/CONTRIBUTING.md#building-the-wslg-system-distro

elsaco avatar Oct 27 '23 15:10 elsaco

same graining issue for me after updating to 2.0.6 on windows 11. any fix in the working?

dimagoldin avatar Oct 30 '23 12:10 dimagoldin

User suggests that replacing system distro fixes the issue, so I suspect something in a recent WSLg update?

benhillis avatar Oct 30 '23 17:10 benhillis

I can confirm this behavior on WSLg v1.0.59. If I downgrade to WSL version 2.0.4 which uses WSLg v1.0.58, linux applications work fine.

ivomi avatar Nov 07 '23 09:11 ivomi

Currently experiencing the same with an app called Bruno, here's the version of WSL I'm using:

WSL version: 2.0.7.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25880.1000-230602-1350.main
Windows version: 10.0.22635.2700

fev4 avatar Nov 07 '23 13:11 fev4

I had a similar issue. See: https://github.com/microsoft/wslg/issues/1128

I somehow fixed it but I'm not sure how. Do you maybe use a custom kernel?

fscheuMoba avatar Nov 09 '23 15:11 fscheuMoba

@davidgiga1993 the issue was introduced with the 2.0.6 release. After upgrading to 2.0.6 I've upgraded the Nvidia graphics driver also and wasn't sure what causes the artifacts. Building WSLg and replacing the system distro the artifacts are gone so it's not the Nvidia driver.

elsaco@mantic:/mnt/wslg$ cat versions.txt
WSLg ( x86_64 ): <current>
Mariner: VERSION="2.0.20230630"
DirectX-Headers: cf123266ce6f1e9a6e700642edb6356bff1e3d55
mesa: be4f7fb656180ab55a50eff01f36672b0bf5f146
pulseaudio: 6f045ff0dca233a939a2aba815f84d177e294122
FreeRDP: c4030980b29322a9cb2190711a5fadeeeb8b6a33
weston: 1c19fc5ecdd4552f36f77256e1fb53225801aff0

WSLg build instructions: https://github.com/microsoft/wslg/blob/main/CONTRIBUTING.md#building-the-wslg-system-distro

This actually worked for me.

ahmedyarub avatar Nov 11 '23 17:11 ahmedyarub

@davidgiga1993 the issue was introduced with the 2.0.6 release. After upgrading to 2.0.6 I've upgraded the Nvidia graphics driver also and wasn't sure what causes the artifacts. Building WSLg and replacing the system distro the artifacts are gone so it's not the Nvidia driver.

elsaco@mantic:/mnt/wslg$ cat versions.txt
WSLg ( x86_64 ): <current>
Mariner: VERSION="2.0.20230630"
DirectX-Headers: cf123266ce6f1e9a6e700642edb6356bff1e3d55
mesa: be4f7fb656180ab55a50eff01f36672b0bf5f146
pulseaudio: 6f045ff0dca233a939a2aba815f84d177e294122
FreeRDP: c4030980b29322a9cb2190711a5fadeeeb8b6a33
weston: 1c19fc5ecdd4552f36f77256e1fb53225801aff0

WSLg build instructions: https://github.com/microsoft/wslg/blob/main/CONTRIBUTING.md#building-the-wslg-system-distro

This actually worked for me.

Did you follow the instructions in the link (where does the text elasco provide go?)

dark-trojan789 avatar Nov 14 '23 15:11 dark-trojan789

I had this issue, and I found simply updating my Nvidia drivers fixed the issue. Something to check.

Philostastically avatar Nov 15 '23 18:11 Philostastically

I had this issue, and I found simply updating my Nvidia drivers fixed the issue. Something to check.

This worked for me, thanks for the advice.

Edit: FYI, I updated both wsl nvidia drviers and windows nvidia drivers and this issue went away.

billyliuschill avatar Nov 16 '23 22:11 billyliuschill

Same here newest intel drivers are installed. The app on the screenshot is nautilus.

Intel gfx driver: 31.0.101.2125 (24.05.2023)

WSL-Version: 2.0.9.0
Kernelversion: 5.15.133.1-1
WSLg-Version: 1.0.59
MSRDC-Version: 1.2.4677
Direct3D-Version: 1.611.1-81528511
DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-Version: 10.0.19045.3693

grafik

 NAME                   STATE           VERSION
* Ubuntu-18.04           Running         2
  docker-desktop-data    Stopped         2

shyney7 avatar Nov 17 '23 09:11 shyney7

I had the same issue. Installing the newest Nvidia drivers alone didn't work, however I was able to fix it by additionally running sudo apt update + sudo apt upgrade and then completely restarting wsl using wsl --shutdown.

DominikDoom avatar Nov 17 '23 11:11 DominikDoom

Maybe, need to "wsl --shutdown" and start wsl.

haohaodehao avatar Nov 21 '23 00:11 haohaodehao

~I updated and upgraded, then updated my intel graphics drivers, then closed wsl, and restarted my windows machine, and the graphics errors are gone.~ This comment on the below linked ticket seems to have helped as well: https://github.com/microsoft/wslg/issues/1148#issuecomment-1827607993

Benjamin-McRae-Tracsis avatar Nov 23 '23 13:11 Benjamin-McRae-Tracsis

I can confirm this behavior on WSLg v1.0.59. If I downgrade to WSL version 2.0.4 which uses WSLg v1.0.58, linux applications work fine.

Same for me. Updating both the intel and Nvidia drivers did not fix the problem. Downgraded WSL to 2.0.4 until this is resolved.

DemonPenguin avatar Nov 24 '23 13:11 DemonPenguin

I had to reboot the system after installing latest Nvidia drivers for my 3060 based laptop. The problems I think started after Windows updated WSL to 2.0.9.0, and I updated the Ubuntu 22.04 distro with latest updates. Updating graphics drivers was the last thing to do, and that seems to have solved the issues

eodeluga avatar Nov 29 '23 03:11 eodeluga

This is easy to reproduce by using emacs or xterm. For me I can use the latest wsl2 but only on ubuntu 20.04. Ubuntu 22 shows the issue. If install the latest nvidia driver then even ubuntu 20.04 shows the issue.

tspyrou avatar Dec 14 '23 16:12 tspyrou

Same issue here. WSL (default version provided by windows) + ubuntu + latest nvidia drivers.

GiGurra avatar Dec 19 '23 16:12 GiGurra

I also found that even after applying the fixes given above, the bug still somehow reappears after some time.

palapapa avatar Dec 19 '23 16:12 palapapa

Workaround: Every time windows starts, I know it's going to have a 50/50 on the graphical tearing, so I always run wsl --shutdown and then restart wsl and then it works. I have idea why sometimes it tears and sometimes it doesn't, but this is a sure fire way to make it always work.

billyliuschill avatar Dec 19 '23 16:12 billyliuschill

I also faced the issue and it was resolved after sudo apt update + wsl --shutdown. It updated few packages, the most important is:

[UPGRADE] linux-libc-dev:amd64 6.1.66-1 -> 6.1.76-1
wsl --version
WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3930

gavenkoa avatar Feb 10 '24 15:02 gavenkoa

I also faced the issue and it was resolved after sudo apt update + wsl --shutdown. It updated few packages, the most important is:

[UPGRADE] linux-libc-dev:amd64 6.1.66-1 -> 6.1.76-1
wsl --version
WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3930

Are you sure the library upgrade had any affect here? For me the issue just goes away temporarily by doing wsl --shutdown, and stays working as long as you have at least one wslg window up

GiGurra avatar Feb 12 '24 11:02 GiGurra

I'm not sure that GUI glitches are related to libs, it was the only important lib in the update (among 20 packages)...

Probably restart of WSL subsystem helps with problems but I did it few times and the problem persisted till I run apt upgrade.

gavenkoa avatar Feb 14 '24 13:02 gavenkoa

Install 'dbus-x11' and this problem, will be fixed. Not sure why WSL2 distros do not install dbus-x11 when you install an x11/GUI app, but the problem is dbus-x11 is missing.

TheNavyBear avatar Feb 26 '24 17:02 TheNavyBear

@TheNavyBear I'm not convinced dbus-x11 package is the issue. I'm running xterm and dbus-x11 is not installed and there are no artifacts. I did run into the issue previously but after so many updates & upgrades I can't tell what fixed it:

Screenshot 2024-02-26 143811

zcobol avatar Feb 26 '24 22:02 zcobol

@TheNavyBear I'm not convinced dbus-x11 package is the issue. I'm running xterm and dbus-x11 is not installed and there are no artifacts. I did run into the issue previously but after so many updates & upgrades I can't tell what fixed it:

Screenshot 2024-02-26 143811

Fair enough, I know I installed 'dbus-x11' on my Debian WSL2 systems and my GUI issues went away, and two apps that wouldn't open at all now run fine.

TheNavyBear avatar Feb 28 '24 23:02 TheNavyBear

Installing dbus-x11 makes/made no difference. I apparently already had it installed and still get the artifacts. The only way to not get the artifacts is to start a wslg application sufficiently quickly after wsl has started. As long as 1 wslg app remains up, all subsequent wslg apps are good.

GiGurra avatar Mar 04 '24 12:03 GiGurra

I regularly run into this. Shutdown trick seems to work well.

atl-mk avatar Mar 05 '24 13:03 atl-mk

I just started to experience the same. Didn't update anything.

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3155

What helped? After shutting down the WSL, I started the Nautius using the shortcut in start menu.

incorporated777 avatar Mar 05 '24 16:03 incorporated777