GLXBadDrawable Error when creating game window if use Nvidia prime offloading on linux
See original GitHub issueBug Report
What’s the issue you encountered?
When running Ryujinx with nvidia prime offloading on linux, i.e. prime-run Ryujinx, the game table window works fine. But Gdk will report a “GLXBadDrawable” X Window System error then abort whenever I launch a game:
(Ryujinx:117270): Gdk-ERROR **: 15:32:55.010: The program 'Ryujinx' received an X Window System error.
This probably reflects a bug in the program.
The error was 'GLXBadDrawable'.
(Details: serial 5118 error_code 160 request_code 152 (GLX) minor_code 5)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
/usr/bin/prime-run: line 2: 117270 Aborted (core dumped) __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"
Without prime offloading and run X with nvidia gpu, then Ryujinx works fine. The same issue has been reported on reddit 7month ago
I did not make any changes to Ryujinx. The same problem happens with both Debug and Release build. The version I tested is 88d0708.
I have pinpointed the error happens after executing the GLRenderer:OnConfigureEvent call back and before GLRenderWidget.Start().
How can the issue be reproduced?
Configure the X server to use nvidia prime There is also an archwiki page for reference
prime-run Ryujinx- Double-click a game to launch it
- The game window will not show up and Ryujinx will abort (in an unmanaged nvidia GLX library)
Log file
The error happens in the unmanaged part, Ryujinx’s log is not very helpful.
Ryujinx_1.0.0-dirty_2021-03-15_15-32-44.log
So I also attach an lldb backtrace. I have debug symbols of libglib, libgtk. There is also a clrstack dotnet managed backtrace (from the dotnet-sos plugin) for your reference.
lldb.log
Environment?
- Ryujinx version: 1.0.6785 or this commit 88d0708
- Game version: Monster Hunter Rise Demo 1.0.2
- System Specs:
- OS: Archlinux
- CPU: i7-10750H
- GPU: NVIDIA RTX 2070
- RAM: 24GB
- Applied Mods : No
Desktop Environment: gnome 3.38.4 nvidia driver: 460.56-1 kernel: 5.11.4
Additional context?
Additional info about your environment: The nvidia prime is an official way to do gpu offloading so should be popular among laptops. It works well with other graphic emulators (e.g. rpcs3). So I really appreciate someone can (help me) fix this. I am happy to try things out or provide more logs. I do not know how to debug the GTK or GLX stack from here.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:33 (10 by maintainers)

Top Related StackOverflow Question
For anyone watching the issue, this issue will be resolved once EGL is merged. It will also give us a bit better performance. For anyone who wants to try here’s a build with EGL merged. https://cdn.discordapp.com/attachments/790357964749406249/934871942694047754/publish.zip This build is built before the fix for the pokemon saves were merged so if you have pokemon saves don’t use it as it will corrupt them.
did some further tinkering and discovered mangohud fps_limit=60 and setting vsync in the emulator OFF fixes the horrible tearing 😄