wslg: All OpenGL apps fail on WSLg with Ubuntu 18

#Description All OpenGL (mesa) apps fail when trying to create an OpenGL context.

On my Dell XPS 15 9500 laptop, I have a USB-C docking station with two displays attached. WSLg is installed and X applications (e.g. gedit, nautilus) work fine.

Other developers that have a single GPU and where all monitors are directly connected to internal HDMI or DP ports seem to have no problem with GLX apps. I think the problem has to do with one of these: 1. The Nvidia driver is WDDM 3.0 driver and the Intel drivers are WDDM 2.8 so there’s a possible mismatch of functionality 2. The nvidia driver is operating as a Render-Only Display Device 3. The Intel driver supports two Full Display Devices but the display connectors are on a thunderbolt docking station, not directly connected to the laptop. In fact the laptop has no external monitor HDMI ports and the only way to use a display other than the laptop’s built-in panel is to use an Dell docking station. In this case it’s model number WD19TB running the latest firmware

Expected behavior

All OpenGL apps should work

Environment

Windows 10 Pro Eval copy Build 21390.co_release.210521-1658

Windows build number:  Win32NT             10.0.21390.0 Microsoft Windows NT 10.0.21390.0
Your Distribution version: **Ubuntu 18.04**
Your WSLg version: Windows Subsystem for Linux WSLg Preview 1.0.22

Steps to reproduce

  1. Install WSLg
  2. export DISPLAY=:0
  3. verify gedit works
  4. Install nvidia WSLg drivers
  5. Install intell WSLg drivers (reboot)
  6. Powershell wsl --update then wsl --shutdown
  7. sudo apt update
  8. sudo apt upgrade
  9. glxgears [fails]

$:~$ echo $DISPLAY :0 $:~$ glxgears Error: glXCreateContext failed $:~$ glxinfo -B name of display: :0 X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 148 (GLX) Minor opcode of failed request: 24 (X_GLXCreateNewContext) Value in failed request: 0x0 Serial number of failed request: 58 Current serial number in output stream: 59 $:~$

sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev [sudo] password for ken: Reading package lists… Done Building dependency tree Reading state information… Done libglu1-mesa-dev is already the newest version (9.0.0-2.1build1). libgl1-mesa-dev is already the newest version (21.1.3~kisak1~b). mesa-common-dev is already the newest version (21.1.3~kisak1~b). The following packages were automatically installed and are no longer required: libx11-xcb-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxshmfence-dev libxxf86vm-dev x11proto-xf86vidmode-dev Use ‘sudo apt autoremove’ to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

/dev/dxg does exist

I’ve added the ppa and updated. Also ran $sudo apt install mesa (no effect) sudo add-apt-repository ppa:kisak/kisak-mesa

I’ve installed the WSLg recommended drivers for both Nvidia and Intel

dxdiag1 dxdiag2 dxdiag3

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 21 (8 by maintainers)

Most upvoted comments

Had a similar problem with glxgears not working. Kept getting this error: “Error: glXCreateContext failed.” Tried all sorts of things, which didn’t change anything. On a whim, I checked, and found that my .bashrc file contained a line that reads: export LIBGL_ALWAYS_INDIRECT=1 I commented that out, restarted wsl, and glxgears started working. But now I am seeing other strange behaviors out of glxgears, like random crashing without throwing errors. But GUI apps now are loading faster than they did before.

I’ve found a way to make it work. It required installing a newer distro: Ubuntu 21. Note that all of my testing above was on Ubuntu 18 and that’s the distro I need to make work. The instructions to install the Canonical Ubuntu 21 are here: https://ubuntu.com/blog/announcing-ubuntu-on-windows-community-preview-wsl-2 Be advised that it installs side-by-side your previous WSLg installation.
After install I had to $sudo apt install mesa-utils

Here’s the $inxi -Fxz: System: Kernel: 5.10.16.3-microsoft-standard-WSL2 x86_64 bits: 64 compiler: gcc v: 10.2.1 Desktop: N/A Distro: Ubuntu 21.04 (Hirsute Hippo) Machine: Message: No Machine data: try newer kernel. Is dmidecode installed? Try -M --dmidecode. Battery: ID-1: BAT1 charge: 5.0 Wh condition: 5.0/5.0 Wh (100%) model: Microsoft Hyper-V Virtual BatterVirtual status: Full CPU: Info: 6-Core model: Intel Core i7-10750H bits: 64 type: MT MCP arch: Comet Lake rev: 2 L2 cache: 12 MiB flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 62208 Speed: 2592 MHz min/max: N/A Core speeds (MHz): 1: 2592 2: 2592 3: 2592 4: 2592 5: 2592 6: 2592 7: 2592 8: 2592 9: 2592 10: 2592 11: 2592 12: 2592 Graphics: Device-1: Microsoft driver: dxgkrnl v: N/A bus ID: 1a05:00:00.0 Device-2: Microsoft driver: dxgkrnl v: N/A bus ID: adb3:00:00.0 Display: wayland server: Microsoft Corporation X.org 1.20.11 driver: loaded: dxgkrnl note: n/a (using device driver) resolution: 1: 1920x1080~60Hz 2: 1920x1080~60Hz OpenGL: renderer: D3D12 (NVIDIA GeForce GTX 1650 Ti) v: 3.3 Mesa 21.0.1 direct render: Yes Audio: Message: No Device data found. Network: Message: No Device data found. IF-ID-1: bond0 state: down mac: <filter> IF-ID-2: bonding_masters state: N/A speed: N/A duplex: N/A mac: N/A IF-ID-3: dummy0 state: down mac: <filter> IF-ID-4: eth0 state: up speed: 10000 Mbps duplex: full mac: <filter> IF-ID-5: sit0 state: down mac: <filter> IF-ID-6: tunl0 state: down mac: <filter> Drives: Local Storage: total: 768.34 GiB used: 622.87 GiB (81.1%) ID-1: /dev/sda model: Virtual Disk size: 256 GiB ID-2: /dev/sdb model: Virtual Disk size: 349.4 MiB ID-3: /dev/sdc model: Virtual Disk size: 256 GiB ID-4: /dev/sdd model: Virtual Disk size: 256 GiB Partition: ID-1: / size: 250.98 GiB used: 1.86 GiB (0.7%) fs: ext4 dev: /dev/sdd Swap: ID-1: swap-1 type: file size: 4 GiB used: 524 KiB (0.0%) file: /swap/file Sensors: Message: No sensors data was found. Is sensors configured? Info: Processes: 12 Uptime: 25m Memory: 15.51 GiB used: 684.4 MiB (4.3%) Init: N/A Compilers: gcc: N/A Packages: 1112 Shell: Bash v: 5.1.0 inxi: 3.3.01