question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GLXBadDrawable Error when creating game window if use Nvidia prime offloading on linux

See original GitHub issue

Bug 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

  1. prime-run Ryujinx
  2. Double-click a game to launch it
  3. 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:open
  • Created 3 years ago
  • Reactions:4
  • Comments:33 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
edisionnanocommented, Jan 26, 2022

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.

1reaction
Ann1kaBcommented, Aug 19, 2022

did some further tinkering and discovered mangohud fps_limit=60 and setting vsync in the emulator OFF fixes the horrible tearing 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with offloading with PRIME - Linux
I seem to be getting a different error now. Error of failed request: BadValue (integer parameter out of range for operation) Major opcode...
Read more >
[Solved] Xorg with nvidia prime / Kernel & Hardware ...
I installed bumblebee and can get some games working in steam with it, but I'd rather X just load the nvidia driver with...
Read more >
NVIDIA Linux Driver (For Linux) - Lenovo Support PA
This fixes a bug where graphics applications run within a network namespace (which ... Added Vulkan and OpenGL+GLX support for PRIME render offload....
Read more >
Open GL error when using nvidia-prime : r/archlinux
It seems you are not using a Nvidia closed-source driver or inappropriate one, use the appropriate driver refer to your card model and...
Read more >
PRIME GPU offloading not working - Graphics & Display
Hello, My laptop met the same situation as Nvidia X Server Settings and prime-run not working! .Minecraft , glxinfo and all applications run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found