NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.39k stars 13.61k forks source link

OpenGL errors on xorg/swrast with mesa 24.2.1 #339703

Closed ghpzin closed 4 days ago

ghpzin commented 1 week ago

Issue is mostly for information purposes. As far as I can tell it is upstream mesa bug and fixed with currently merged MRs in master: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30979 https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31013 So waiting for next mesa patch version with these seems to be the best course.


Describe the bug

After mesa update #332413 (24.1.6 -> 24.2.1) a lot of tests fail with errors similar to "GLX extension not found".

Example: https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.terminal-emulators.kitty.x86_64-linux https://hydra.nixos.org/build/271100383

machine # [0.616] [glfw error 65542]: GLX: GLX extension not found
machine # [0.617] Failed to create GLFW temp window! This usually happens because of old/broken OpenGL drivers. kitty requires working OpenGL 3.1 drivers.

List of tests that fail (found so far): https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.terminal-emulators.kitty.x86_64-linux https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.terminal-emulators.wayst.x86_64-linux https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.terminal-emulators.darktile.x86_64-linux https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.quake3.x86_64-linux https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.openarena.x86_64-linux https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.warzone2100.x86_64-linux https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.aaaaxy.x86_64-linux https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.qtile.x86_64-linux --- depends on kitty terminal opening

Windows of these apps do not open as a result. Tested on other variations of VMs and seemingly it does not occur with wayland, occurs on xorg not in VM too.

One other example is alacritty, which prints new error, but still opens window and test passes: https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.terminal-emulators.alacritty.x86_64-linux https://hydra.nixos.org/build/271139043

machine # libEGL warning: DRI3: Screen seems not DRI3 capable
machine # libEGL warning: DRI2: failed to authenticate
machine # libEGL warning: DRI3: Screen seems not DRI3 capable
machine # error: XDG_RUNTIME_DIR is invalid or not set in the environment.
machine # MESA: error: ZINK: failed to choose pdev
machine # libEGL warning: egl: failed to create dri2 screen

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-build -A nixosTests.terminal-emulators.kitty
  2. test fails, kitty window does not open with error:
    machine # [0.382] [glfw error 65542]: GLX: GLX extension not found
    machine # [0.383] Failed to create GLFW temp window! This usually happens because of old/broken OpenGL drivers. kitty requires working OpenGL 3.1 drivers.

Additional context

The closest upstream issue I could find: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11809 Error in logs there:

X server has no GLX extension - required to use OpenGL!

Doing either of these 2 fixes the issue and makes tests pass again:

  1. Revert 77feb16bb558f5e0a686afb326fa8235c6105ccd (commit with mesa update #332413)
  2. Add 2 patches from merged MRs: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30979 https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31013 First patch just changes error to another error, similar to (https://gitlab.freedesktop.org/mesa/mesa/-/issues/11836):
    vm-test-run-terminal-emulator-kitty> machine # [1.325] [glfw error 65542]: GLX: No GLXFBConfigs returned
    vm-test-run-terminal-emulator-kitty> machine # [1.326] [glfw error 65545]: GLX: Failed to find a suitable GLXFBConfig
    vm-test-run-terminal-emulator-kitty> machine # [1.328] Failed to create GLFW temp window! This usually happens because of old/broken OpenGL drivers. kitty requires working OpenGL 3.1 drivers.

    Second patch depends on first.

nixpkgs diff for patches ```diff diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index dc722d44243f..fb15f590a793 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -93,6 +93,7 @@ ] , mesa , makeSetupHook +, fetchpatch }: let @@ -139,6 +140,16 @@ in stdenv.mkDerivation { patches = [ ./opencl.patch + # https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30979 + (fetchpatch { + url = "https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30979.patch"; + hash = "sha256-JbrygyjtgNcQlggv1X+3HWf4WRWdtyeEvg3jwthEspM="; + }) + # https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31013 + (fetchpatch { + url = "https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31013.patch"; + hash = "sha256-J6P7k6SuOqRzmeqiiAc+QgBDp5nIBY+sPwvnQ+hlCW8="; + }) ]; postPatch = '' ```

Notify maintainers

Listed mesa maintainers: @primeos @vcunat

@K900 (author of update PR)


Add a :+1: reaction to issues you find important.

K900 commented 1 week ago

This is specifically on setups that would normally need to fall back to software rendering, right?

ghpzin commented 1 week ago

This is specifically on setups that would normally need to fall back to software rendering, right?

Yes, seems like it. Sorry, I tested on my machine by switching to xorg/intel, but probably did something wrong before (due to it being on laptop with nvidia). At least kitty, wayst, darktile seem to open properly.

K900 commented 1 week ago

I'll pull the dril fixes into staging-next then.

ghpzin commented 4 days ago

mesa on nixos-unstable got to 24.2.2 All mentioned tests pass.