rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.88k stars 912 forks source link

core dump in Xorg session #3616

Open Frigyes06 opened 8 months ago

Frigyes06 commented 8 months ago

Description

On GNOME Xorg with Nvidia viideo card, appliccation using winit fails to launch:

2024-03-26 10:43:46 ERROR [/build/universal-android-debloater/src/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:713] X11 error: XError {
    description: "BadMatch (invalid parameter attributes)",
    error_code: 8,
    request_code: 149,
    minor_code: 4,
}

winit 0.28.7 works fine

OS and window mananger

Arch Linux with GNOME Xorg session

Winit version

0.29.15

notgull commented 8 months ago

Can you run the example application under xtrace and paste the logs in a Gist?

psychon commented 6 months ago

Another possibility: You could provide the output of xdpyinfo -queryExtensions | grep opcode. That's less useful than xtrace, but would provide some hint at which request this is.

timtro commented 5 months ago

I'm getting the same when I try to run the examples in (lyon)[https://github.com/nical/lyon], so perhaps my debug info can help.

❱ uname -a

Linux positron 6.8.0-76060800daily20240311-generic #202403110203~1715181801~22.04~aba43ee SMP PREEMPT_DYNAMIC Wed M x86_64 x86_64 x86_64 GNU/Linux

❱ lsb_release -a
No LSB modules are available.
Distributor ID: Pop
Description:    Pop!_OS 22.04 LTS
Release:    22.04
Codename:   jammy

❱ echo $DESKTOP_SESSION
xmonad

# NB: xmonad ⇒ X11

❱ nvidia-smi                                                                                 <<<
Fri Jun 21 16:05:37 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.67                 Driver Version: 550.67         CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1050 ...    Off |   00000000:01:00.0 Off |                  N/A |
| N/A   52C    P0             N/A / ERR!  |    1490MiB /   4096MiB |      8%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      4856      G   /usr/lib/xorg/Xorg                            862MiB |
|    0   N/A  N/A      5069      G   picom                                          53MiB |
|    0   N/A  N/A      5250      G   /usr/lib/insync/insync                          1MiB |
⋮
|    0   N/A  N/A     65630      G   ...,WinRetrieveSuggestionsOnlyOnDemand        103MiB |
+-----------------------------------------------------------------------------------------+

❱ xdpyinfo -queryExtensions | grep opcode
    BIG-REQUESTS  (opcode: 133)
    Composite  (opcode: 142)
    DAMAGE  (opcode: 143, base event: 91, base error: 152)
    DOUBLE-BUFFER  (opcode: 145, base error: 153)
    DPMS  (opcode: 147)
    DRI2  (opcode: 155, base event: 119)
    DRI3  (opcode: 149)
    GLX  (opcode: 152, base event: 95, base error: 158)
    Generic Event Extension  (opcode: 128)
    MIT-SCREEN-SAVER  (opcode: 144, base event: 92)
    MIT-SHM  (opcode: 130, base event: 65, base error: 128)
    NV-CONTROL  (opcode: 157, base event: 121)
    NV-GLX  (opcode: 156)
    Present  (opcode: 148)
    RANDR  (opcode: 140, base event: 89, base error: 147)
    RECORD  (opcode: 146, base error: 154)
    RENDER  (opcode: 139, base error: 142)
    SECURITY  (opcode: 137, base event: 86, base error: 138)
    SHAPE  (opcode: 129, base event: 64)
    SYNC  (opcode: 134, base event: 83, base error: 134)
    X-Resource  (opcode: 150)
    XC-MISC  (opcode: 136)
    XFIXES  (opcode: 138, base event: 87, base error: 140)
    XFree86-DGA  (opcode: 154, base event: 112, base error: 179)
    XFree86-VidModeExtension  (opcode: 153, base error: 172)
    XINERAMA  (opcode: 141)
    XInputExtension  (opcode: 131, base event: 66, base error: 129)
    XKEYBOARD  (opcode: 135, base event: 85, base error: 137)
    XTEST  (opcode: 132)
    XVideo  (opcode: 151, base event: 93, base error: 155)

❱ xdpyinfo -queryExtensions | grep opcode | grep 149
    DRI3  (opcode: 149)

I've attached the xtrace info. (It's too big to paste inline.)

err.log

psychon commented 5 months ago
Random ramblings There are 31 X11 errors. Most of them are DRI3-related. There is one `BadWindow` error, 21 `BadMatch` errors, and 9 errors that xtrace could not identify. The last one is for major opcode 134 and has error code 136. According to the `-queryExtensions` output, this must be `SYNC`+2 since `SYNC` has `base error: 134`. According to https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/blob/master/src/sync.xml there is no `https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/blob/master/src/dri3.xml says that this is FenceFromFD. No idea why the previous BadMatches for DRI3-Open do not appear.

https://cgit.freedesktop.org/xorg/proto/dri3proto/tree/dri3proto.txt does not describe when DRI3-Open or DRI3-FenceFromFD fail. :-(

Sorry, I do not know details about DRI.

(Also, the xtrace output contains seven separate X11 connections. I do not know which is why. The first connection appears 886 times, the second and third connections only 61 and 75 times, respectively. The other four connections each only appear 8 times and are thus basically unused. Connections number 3, 4, 5, 6 all appear right next to each in the middle of the xtrace output and each one only gets to a failing DRI3-Open request and does not do anything else. Connections 0, 1, 2 all use the NV-GLX extension, which I never heard about and which sounds NVidia-specific)