microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.06k stars 302 forks source link

glxgears (or any OpenGL app) Segmentation Fault #1045

Open MikuAuahDark opened 1 year ago

MikuAuahDark commented 1 year ago

Windows build number:

22621.1555

Your Distribution version:

Debian GNU/Linux 12 (bookworm)

Your WSL versions:

WSL version: 1.2.0.0 Kernel version: 5.15.90.1 WSLg version: 1.0.51 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.1555

Steps to reproduce:

Simply run glxgears.

WSL logs:

pulseaudio.log weston.log stderr.log

WSL dumps:

No files in /mnt/wslg/dumps.

Expected behavior:

Gears shown, which was the case few months ago.

Actual behavior:

Segmentation fault.

Backtrace of running through GDB with debuginfod.

Thread 1 "glxgears" received signal SIGSEGV, Segmentation fault.
0x00007fffffffa680 in ?? ()
(gdb) bt
#0  0x00007fffffffa680 in ?? ()
#1  0x00007fffea67e43d in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#2  0x00007fffea67dd12 in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#3  0x00007fffea686528 in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#4  0x00007fffea6863d7 in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#5  0x00007ffff7315e37 in _Unwind_RaiseException (exc=0x555555ee2f70) at ../../../src/libgcc/unwind.inc:118
#6  0x00007fffee3e10cb in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x7fffea365328, dest=0x7fffe8248eb0)
    at ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc:93
#7  0x00007fffe824dad8 in ?? () from /usr/lib/wsl/drivers/u0369254.inf_amd64_6f1e9c11bbc40f12/B369275/amdxc64.so
#8  0x00007fffe82625e5 in ?? () from /usr/lib/wsl/drivers/u0369254.inf_amd64_6f1e9c11bbc40f12/B369275/amdxc64.so
#9  0x00007fffe80ab92b in ?? () from /usr/lib/wsl/drivers/u0369254.inf_amd64_6f1e9c11bbc40f12/B369275/amdxc64.so
#10 0x00007fffe80b0096 in ?? () from /usr/lib/wsl/drivers/u0369254.inf_amd64_6f1e9c11bbc40f12/B369275/amdxc64.so
#11 0x00007fffe7fe76e3 in ?? () from /usr/lib/wsl/drivers/u0369254.inf_amd64_6f1e9c11bbc40f12/B369275/amdxc64.so
#12 0x00007fffe7fe91d0 in ?? () from /usr/lib/wsl/drivers/u0369254.inf_amd64_6f1e9c11bbc40f12/B369275/amdxc64.so
#13 0x00007fffe7fe93fd in ?? () from /usr/lib/wsl/drivers/u0369254.inf_amd64_6f1e9c11bbc40f12/B369275/amdxc64.so
#14 0x00007fffe8041182 in ?? () from /usr/lib/wsl/drivers/u0369254.inf_amd64_6f1e9c11bbc40f12/B369275/amdxc64.so
#15 0x00007fffea8cbe8a in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#16 0x00007fffea8cb725 in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#17 0x00007fffea8cb504 in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#18 0x00007fffea802b44 in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#19 0x00007fffea7c3827 in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#20 0x00007fffeab76fe2 in ?? () from /usr/lib/wsl/lib/libd3d12.so
#21 0x00007fffeab76cf6 in ?? () from /usr/lib/wsl/lib/libd3d12.so
#22 0x00007fffea7f390c in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#23 0x00007fffea80736d in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#24 0x00007fffea805cb9 in ?? () from /usr/lib/wsl/lib/libd3d12core.so
#25 0x00007ffff60e01fb in create_gfx_pipeline_state (ctx=ctx@entry=0x555555cb6e20)
    at ../src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp:328
#26 0x00007ffff60e0730 in d3d12_get_gfx_pipeline_state (ctx=ctx@entry=0x555555cb6e20)
    at ../src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp:361
#27 0x00007ffff60ce5f4 in d3d12_draw_vbo (pctx=0x555555cb6e20, dinfo=<optimized out>, drawid_offset=0,
    indirect=<optimized out>, draws=<optimized out>, num_draws=<optimized out>)
    at ../src/gallium/drivers/d3d12/d3d12_draw.cpp:1032
#28 0x00007ffff5c13024 in util_primconvert_draw_single_vbo (pc=pc@entry=0x5555557fcfb0,
--Type <RET> for more, q to quit, c to continue without paging--
    info=info@entry=0x555555cfdaf0, drawid_offset=drawid_offset@entry=0, draw=draw@entry=0x7fffffffccf0)
    at ../src/gallium/auxiliary/indices/u_primconvert.c:284
#29 0x00007ffff5c1326a in util_primconvert_draw_vbo (pc=0x5555557fcfb0, info=0x555555cfdaf0,
    drawid_offset=<optimized out>, indirect=<optimized out>, draws=<optimized out>, num_draws=<optimized out>)
    at ../src/gallium/auxiliary/indices/u_primconvert.c:313
#30 0x00007ffff60ce008 in d3d12_draw_vbo (pctx=0x555555cb6e20, dinfo=0x555555cfdaf0, drawid_offset=0, indirect=0x0,
    draws=0x7fffffffccf0, num_draws=1) at ../src/gallium/drivers/d3d12/d3d12_draw.cpp:912
#31 0x00007ffff5bda49f in tc_call_draw_single (pipe=<optimized out>, call=0x555555cfdae8, last_ptr=<optimized out>)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:3602
#32 0x00007ffff5bd42fa in batch_execute (parsing=false, last=0x555555cfe098, pipe=0x555555cb6e20, batch=0x555555cfd738)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:312
#33 tc_batch_execute (job=job@entry=0x555555cfd738, gdata=gdata@entry=0x0, thread_index=thread_index@entry=0)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:356
#34 0x00007ffff5bd5336 in _tc_sync (tc=tc@entry=0x555555cfb6e0, func=<optimized out>, info=<optimized out>)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:575
#35 0x00007ffff5bdc258 in tc_flush (_pipe=0x555555cfb6e0, fence=0x0, flags=8)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:3452
#36 0x00007ffff570fa00 in st_flush (flags=8, fence=0x0, st=0x555555d8a330)
    at ../src/mesa/state_tracker/st_cb_flush.c:60
#37 st_glFlush (ctx=<optimized out>, gallium_flush_flags=8) at ../src/mesa/state_tracker/st_cb_flush.c:94
#38 0x00007ffff779b1bd in driswSwapBuffers (pdraw=0x555555d9f790, target_msc=<optimized out>, divisor=<optimized out>,
    remainder=<optimized out>, flush=<optimized out>) at ../src/glx/drisw_glx.c:751
#39 0x00007ffff779f23b in glXSwapBuffers (dpy=0x55555555cda0, drawable=6291458) at ../src/glx/glxcmds.c:857
#40 0x0000555555556ac8 in draw_frame (win=6291458, dpy=0x55555555cda0) at ../src/xdemos/glxgears.c:344
#41 event_loop (win=6291458, dpy=0x55555555cda0) at ../src/xdemos/glxgears.c:754
#42 main (argc=<optimized out>, argv=<optimized out>) at ../src/xdemos/glxgears.c:858

glxinfo -B output:

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Microsoft Corporation (0xffffffff)
    Device: D3D12 (AMD Radeon(TM) Graphics) (0xffffffff)
    Version: 22.3.6
    Accelerated: yes
    Video memory: 8374MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.2
    Max compat profile version: 4.2
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL vendor string: Microsoft Corporation
OpenGL renderer string: D3D12 (AMD Radeon(TM) Graphics)
OpenGL core profile version string: 4.2 (Core Profile) Mesa 22.3.6
OpenGL core profile shading language version string: 4.20
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.2 (Compatibility Profile) Mesa 22.3.6
OpenGL shading language version string: 4.20
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.1 Mesa 22.3.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
MikuAuahDark commented 1 year ago

Forgot to attach WSL logs from powershell. WslLogs-2023-04-15_22-47-06.zip

lewcc commented 1 year ago

I've been running into a similar sort of problem, where OpenGL seems to cause a segfault somewhere deep in the gears of the graphics driver. I'm fairly confident this is a WSL problem, as attempting to run the same code in Windows works fine. I can't offer any direct reproduction code publicly, since I'm encountering it while trying to work on a class assignment, but it seems to be emerging primarily whenever I start trying to interact with texture data in shaders. I tried to upgrade to a newer version of mesa as specified in a different issue, but no dice.

This is probably pretty implementation-dependent, but I am at least able to consistently get code that works and code that doesn't by negating a vec3 in a simple phong shader in GLSL, storing the new negated value in a vector and attempting to later use it.

WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1555
Backtrace ``` 0x00007fffecbb0ca7 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so (gdb) backtrace #0 0x00007fffecbb0ca7 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #1 0x00007fffecbb0cf9 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #2 0x00007fffecbb11c1 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #3 0x00007fffecb99b20 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #4 0x00007fffecb94d2d in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #5 0x00007fffecbb79ce in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #6 0x00007fffecbb89d3 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #7 0x00007fffecbade87 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #8 0x00007fffecbbc02a in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #9 0x00007fffecdc5696 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #10 0x00007fffecdc5bd1 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #11 0x00007fffecdc5409 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #12 0x00007fffecdc6d73 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #13 0x00007fffecf14bd3 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #14 0x00007fffecf151ad in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so --Type for more, q to quit, c to continue without paging-- #15 0x00007fffecf1533d in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #16 0x00007fffecf72355 in ?? () from /usr/lib/wsl/drivers/u0372683.inf_amd64_761b760f7d265b07/B372529/amdxc64.so #17 0x00007fffef68bb7a in ?? () from /usr/lib/wsl/lib/libd3d12core.so #18 0x00007fffef68a759 in ?? () from /usr/lib/wsl/lib/libd3d12core.so #19 0x00007fffef68a504 in ?? () from /usr/lib/wsl/lib/libd3d12core.so #20 0x00007fffef5c1b44 in ?? () from /usr/lib/wsl/lib/libd3d12core.so #21 0x00007fffef582827 in ?? () from /usr/lib/wsl/lib/libd3d12core.so #22 0x00007fffef864fe2 in ?? () from /usr/lib/wsl/lib/libd3d12.so #23 0x00007fffef864cf6 in ?? () from /usr/lib/wsl/lib/libd3d12.so #24 0x00007fffef5b290c in ?? () from /usr/lib/wsl/lib/libd3d12core.so #25 0x00007fffef5c63a6 in ?? () from /usr/lib/wsl/lib/libd3d12core.so #26 0x00007fffef5c4cb9 in ?? () from /usr/lib/wsl/lib/libd3d12core.so #27 0x00007ffff603c42f in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so #28 0x00007ffff603c850 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so #29 0x00007ffff6011978 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so #30 0x00007ffff5ae52c6 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so #31 0x00007ffff5a84fd7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so #32 0x00007ffff55f497b in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so #33 0x00007ffff55f6be4 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so #34 0x000055555555942b in display () at Application.cpp:540 #35 0x0000555555559925 in application (argc=1, argv=0x7fffffffe3c8) at Application.cpp:666 #36 0x0000555555557d42 in main (argc=1, argv=0x7fffffffe3c8) at main.cpp:109 ```

glxinfo -B:

glxinfo output ``` name of display: :0 display: :0 screen: 0 direct rendering: Yes Extended renderer info (GLX_MESA_query_renderer): Vendor: Microsoft Corporation (0xffffffff) Device: D3D12 (AMD Radeon(TM) Graphics) (0xffffffff) Version: 21.2.6 Accelerated: yes Video memory: 8382MB Unified memory: yes Preferred profile: core (0x1) Max core profile version: 3.3 Max compat profile version: 3.1 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.0 OpenGL vendor string: Microsoft Corporation OpenGL renderer string: D3D12 (AMD Radeon(TM) Graphics) OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.2.6 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL version string: 3.1 Mesa 21.2.6 OpenGL shading language version string: 1.40 OpenGL context flags: (none) OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.2.6 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00 ```
hideyukn88 commented 1 year ago

@MikuAuahDark, what version of AMD GPU driver is used in Windows side?

@lewcc, would you please share your GPU driver in Windows?

Thanks!

MikuAuahDark commented 1 year ago

gambar

It's still a driver from OEM and the drivers hasn't been updated since August 2021.

For my case, it used to work. Unfortunately I'm unable to pinpoint exactly when this start happening other than since my bug report.

EDIT: Updated WSL to 1.2.5.0 and Windows to build 1635, still same segfault.

nullchilly commented 11 months ago

It used to work for me a few months ago too

I ended up just using this workaround: LIBGL_ALWAYS_SOFTWARE=1 glxgears

CaptainHarryChen commented 11 months ago

It used to work for me a few months ago too

I ended up just using this workaround: LIBGL_ALWAYS_SOFTWARE=1 glxgears

It works for me, too !!! (I have searched for the solution for hours...) Thanks very much.

I ended up set 'export LIBGL_ALWAYS_SOFTWARE=1' in '~/.bashrc' . And everything worked.

MikuAuahDark commented 11 months ago

LIBGL_ALWAYS_SOFTWARE=1 means you're not using the GPU at all.

tmewett commented 11 months ago

Also getting this problem on AMD. DXDiag below:

``` --------------- Display Devices --------------- Card name: AMD Radeon RX 6600 XT Manufacturer: Advanced Micro Devices, Inc. Chip type: AMD Radeon Graphics Processor (0x73FF) DAC type: Internal DAC(400MHz) Device Type: Full Device (POST) Device Key: Enum\PCI\VEN_1002&DEV_73FF&SUBSYS_2412148C&REV_C1 Device Status: 0180200A [DN_DRIVER_LOADED|DN_STARTED|DN_DISABLEABLE|DN_NT_ENUMERATOR|DN_NT_DRIVER] Device Problem Code: No Problem Driver Problem Code: Unknown Display Memory: 16318 MB Dedicated Memory: 8147 MB Shared Memory: 8171 MB Current Mode: 1920 x 1080 (32 bit) (60Hz) HDR Support: Not Supported Display Topology: Internal Display Color Space: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 Color Primaries: Red(0.625000,0.348633), Green(0.338867,0.623047), Blue(0.153320,0.051758), White Point(0.313477,0.329102) Display Luminance: Min Luminance = 0.500000, Max Luminance = 270.000000, MaxFullFrameLuminance = 270.000000 Monitor Name: Generic PnP Monitor Monitor Model: HP LA2306 Monitor Id: HWP294B Native Mode: 1920 x 1080(p) (60.000Hz) Output Type: Displayport External Monitor Capabilities: HDR Not Supported Display Pixel Format: DISPLAYCONFIG_PIXELFORMAT_32BPP Advanced Color: Not Supported Driver Name: C:\Windows\System32\DriverStore\FileRepository\u0371127.inf_amd64_d81402870f884159\B369609\aticfx64.dll,C:\Windows\System32\DriverStore\FileRepository\u0371127.inf_amd64_d81402870f884159\B369609\aticfx64.dll,C:\Windows\System32\DriverStore\FileRepository\u0371127.inf_amd64_d81402870f884159\B369609\aticfx64.dll,C:\Windows\System32\DriverStore\FileRepository\u0371127.inf_amd64_d81402870f884159\B369609\amdxc64.dll Driver File Version: 27.20.22016.0002 (English) Driver Version: 27.20.22016.2 DDI Version: 12 Feature Levels: 12_1,12_0,11_1,11_0,10_1,10_0,9_3,9_2,9_1 Driver Model: WDDM 2.7 Hardware Scheduling: Supported:False Enabled:False Graphics Preemption: Primitive Compute Preemption: DMA Miracast: Not Supported by Graphics driver Detachable GPU: No Hybrid Graphics GPU: Not Supported Power P-states: Not Supported Virtualization: Paravirtualization Block List: DISABLE_HWSCH Catalog Attributes: Universal:False Declarative:True Driver Attributes: Final Retail Driver Date/Size: 06/07/2021 01:00:00, 1880248 bytes WHQL Logo'd: Yes WHQL Date Stamp: Unknown Device Identifier: {D7B71EE2-30BF-11CF-3E77-12527AC2D635} Vendor ID: 0x1002 Device ID: 0x73FF SubSys ID: 0x2412148C Revision ID: 0x00C1 Driver Strong Name: oem5.inf:cb0ae4147af5e3d3:ati2mtag_Navi23:27.20.22016.2:PCI\VEN_1002&DEV_73FF&SUBSYS_2412148C&REV_C1 Rank Of Driver: 00CF0000 Video Accel: Unknown DXVA2 Modes: DXVA2_ModeMPEG2_VLD {86695F12-340E-4F04-9FD3-9253DD327460} DXVA2_ModeH264_VLD_NoFGT {4245F676-2BBC-4166-A0BB-54E7B849C380} {6719B6FB-5CAD-4ACB-B00A-F3BFDEC38727} {9901CCD3-CA12-4B7E-867A-E2223D9255C3} DXVA2_ModeHEVC_VLD_Main {EA72396A-67EC-4781-BEDE-56F498F04EF2} {C152CA8F-738C-461B-AD89-FC292CF8F162} {514A356C-7027-4AFF-8A60-AFD2C1F672F1} DXVA2_ModeH264_VLD_Stereo_Progressive_NoFGT DXVA2_ModeH264_VLD_Stereo_NoFGT DXVA2_ModeVC1_VLD {CA15D19A-2B48-43D6-979E-7A6E9C802FF8} {D1C20509-AE7B-4E72-AE3B-49F88D58992F} {84AD67F6-4C21-419A-9F0B-24F0578906C1} {725AD240-786C-471E-AD3C-38F739936517} {95664FF5-9E03-4C74-BB4F-9178D6035E58} {5EF7D40D-5B96-49E7-B419-23342094A4CF} DXVA2_ModeHEVC_VLD_Main10 {65D1FA41-58AF-453A-9CAB-5D981156DA9F} {2DB154B6-DBB2-4079-A3FF-60D7A898A6AB} {C74A3FD0-D713-4581-A02E-8EDFB112ACE3} DXVA2_ModeVP9_VLD_Profile0 DXVA2_ModeVP9_VLD_10bit_Profile2 {B8BE4CCB-CF53-46BA-8D59-D6B8A6DA5D2A} {603A4756-A864-4F91-BB62-2C935B7A1391} {C58B9A06-7E89-11E1-BB00-70B34824019B} Deinterlace Caps: n/a D3D9 Overlay: Not Supported DXVA-HD: Not Supported DDraw Status: Enabled D3D Status: Enabled AGP Status: Enabled MPO MaxPlanes: 2 MPO Caps: ROTATION,VERTICAL_FLIP,HORIZONTAL_FLIP,YUV,BILINEAR,STRETCH_YUV,HDR (MPO3) MPO Stretch: 16.000X - 0.250X MPO Media Hints: rotation, resizing, colorspace Conversion MPO Formats: NV12,420_OPAQUE PanelFitter Caps: ROTATION,VERTICAL_FLIP,HORIZONTAL_FLIP,YUV,BILINEAR,STRETCH_YUV,HDR (MPO3) PanelFitter Stretch: 16.000X - 0.250X ```
Jasha10 commented 5 months ago

I resolved this by entering an elevated command prompt and running wsl --update.