nix-community / nixGL

A wrapper tool for nix OpenGL application [maintainer=@guibou]
666 stars 77 forks source link

Tests fail on Radeon RX 560X #48

Open mgmillani opened 4 years ago

mgmillani commented 4 years ago

I obtained the following output when running Test.hs:

$ env DRI_PRIME=1 ./Test.hs
Running tests for nixGL
It can take a while, this will build and test all drivers in the background

Sanity
  OpenGL
Error: couldn't find RGB GLX visual or fbconfig
    fails with unwrapped glxinfo64
Error: couldn't find RGB GLX visual or fbconfig
    fails with unwrapped glxinfo32
  Vulkan
ERROR: [Loader Message] Code 0 : /nix/store/wx1vk75bpdr65g6xwxbj4rw0pk04v5j3-glibc-2.27/lib/libm.so.6: version `GLIBC_2.29' not found (required by /nix/store/anfds1cfg3vcp2rknsym1hdw56mgzm6v-mesa-20.0.2-drivers/lib/libvulkan_radeon.so)
ERROR: [Loader Message] Code 0 : /nix/store/wx1vk75bpdr65g6xwxbj4rw0pk04v5j3-glibc-2.27/lib/libm.so.6: version `GLIBC_2.29' not found (required by /nix/store/anfds1cfg3vcp2rknsym1hdw56mgzm6v-mesa-20.0.2-drivers/lib/libvulkan_intel.so)
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
/build/source/vulkaninfo/vulkaninfo.c:923: failed with VK_ERROR_INCOMPATIBLE_DRIVER
    fails with unwrapped vulkaninfo64
ERROR: [Loader Message] Code 0 : /nix/store/5ka41zhii1bjss3f60rzd2npz9mxj060-glibc-2.27/lib/libm.so.6: version `GLIBC_2.29' not found (required by /nix/store/05i0ksjqs5h5qnlrg3ylgdz7jfh29h7i-mesa-20.0.2-drivers/lib/libvulkan_radeon.so)
ERROR: [Loader Message] Code 0 : /nix/store/5ka41zhii1bjss3f60rzd2npz9mxj060-glibc-2.27/lib/libm.so.6: version `GLIBC_2.29' not found (required by /nix/store/05i0ksjqs5h5qnlrg3ylgdz7jfh29h7i-mesa-20.0.2-drivers/lib/libvulkan_intel.so)
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
/build/source/vulkaninfo/vulkaninfo.c:923: failed with VK_ERROR_INCOMPATIBLE_DRIVER
    fails with unwrapped vulkaninfo32
NixGL
  Mesa
    OpenGL
      32 bits
      64 bits
    Vulkan
ERROR: [Loader Message] Code 0 : /nix/store/2k5spfqknb2z6d332wr5833d5cfw3jn4-mesa-19.1.5-drivers/lib/libvulkan_intel.so: wrong ELF class: ELFCLASS64
ERROR: [Loader Message] Code 0 : /nix/store/2k5spfqknb2z6d332wr5833d5cfw3jn4-mesa-19.1.5-drivers/lib/libvulkan_radeon.so: wrong ELF class: ELFCLASS64
      32 bits
ERROR: [Loader Message] Code 0 : /nix/store/vxr6v1wpf60c9ayrpqc3m7qg58m40biq-mesa-19.1.5-drivers/lib/libvulkan_intel.so: wrong ELF class: ELFCLASS32
ERROR: [Loader Message] Code 0 : /nix/store/vxr6v1wpf60c9ayrpqc3m7qg58m40biq-mesa-19.1.5-drivers/lib/libvulkan_radeon.so: wrong ELF class: ELFCLASS32
      64 bits

Obviously, all Nvidia tests fails since I do not have an Nvidia graphics card, so I omitted the messages.

One particularly weird thing is the glibc version(s) mentioned: One place mentions 2.27, another says GLIBC_2.29, the driver seems to use 2.30 however:

$ ldd /nix/store/anfds1cfg3vcp2rknsym1hdw56mgzm6v-mesa-20.0.2-drivers/lib/libvulkan_radeon.so | grep glibc
libdl.so.2 => /nix/store/bwzra330vib0ik4d3l8rq6gp6y2ah1fr-glibc-2.30/lib/libdl.so.2 (0x00007fddf7da6000)
libm.so.6 => /nix/store/bwzra330vib0ik4d3l8rq6gp6y2ah1fr-glibc-2.30/lib/libm.so.6 (0x00007fddf79b3000)
libgcc_s.so.1 => /nix/store/bwzra330vib0ik4d3l8rq6gp6y2ah1fr-glibc-2.30/lib/libgcc_s.so.1 (0x00007fddf7999000)
libpthread.so.0 => /nix/store/bwzra330vib0ik4d3l8rq6gp6y2ah1fr-glibc-2.30/lib/libpthread.so.0 (0x00007fddf7978000)
libc.so.6 => /nix/store/bwzra330vib0ik4d3l8rq6gp6y2ah1fr-glibc-2.30/lib/libc.so.6 (0x00007fddf77b9000)
/nix/store/bwzra330vib0ik4d3l8rq6gp6y2ah1fr-glibc-2.30/lib64/ld-linux-x86-64.so.2 (0x00007fddfd3b6000)
librt.so.1 => /nix/store/bwzra330vib0ik4d3l8rq6gp6y2ah1fr-glibc-2.30/lib/librt.so.1 (0x00007fddf77a0000)

System info: GPU: Radeon RX 560X Integrated GPU: Radeon Vega 8 OS: nixos unstable nixGL commit: 5f330c2185dc7816fed431d29c4249ab090deb00

guibou commented 4 years ago

Thank you for this bug report. This is highly appreciated considering that you have a Radeon card on an hybrid configuration, something I had never been able to test.

Could you share your NixOS setup regarding the opengl setup? Also, how to you switch between the integrated GPU and the discrete one?

The glibc stuff is expected. Right now, nixGL is not doing anything for radeon driver, so you basically hit the problem that the test binary is using an older version of nixos, so program uses an older glibc, probably 2.27, however your system drivers uses 2.29 or 2.30.

mgmillani commented 4 years ago

Could you share your NixOS setup regarding the opengl setup?

I think the only things opengl-related in my configuration are the following lines:

hardware.opengl.driSupport32Bit = true;
environment.systemPackages = [ pkgs.xorg.xf86videoamdgpu ]; 

I use the first line to be able to run games on wine.

Also, how to you switch between the integrated GPU and the discrete one?

This is done through the environment variable DRI_PRIME. Setting it to 1 enables the discrete GPU. If it is unset, the program is run on the integrated GPU. As far as I know, the switch is made on kernel/driver level and is per application.

guibou commented 4 years ago

@mgmillani I can do attempt and ask you for test, but this may take time. If you can give me an access to your machine (tmate, or raw ssh session), I may be able to live test.

mgmillani commented 4 years ago

Sure, I can run further tests when you got something ready.

Since this is my personal computer, I would rather not give anyone else access to it. (I'm sure you understand).

And thanks a lot for looking into this!

guibou commented 4 years ago

Since this is my personal computer, I would rather not give anyone else access to it. (I'm sure you understand).

Yes, I do, that's perfectly fine ;)

guibou commented 4 years ago

Could you give me a few details. On your nixos setup, with working opengl, could you give me the output of;

glxinfo | grep "OpenGL version string"
DRI_PRIME=1 glxInfo | grep "OpenGL version string"
vulkaninfo | grep "driverName"
DRI_PRIME=1 vulkaninfo | grep "driverName".

After analysis of your test results, nixGL seems to work fine for OpenGL on your configuration, using the mesa driver. But not for vulkan.

mgmillani commented 4 years ago
$ glxinfo | grep "OpenGL version string"
OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.0.2

$ DRI_PRIME=1 glxinfo | grep "OpenGL version string"
OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.0.2

$ DRI_PRIME=1 vulkaninfo | grep "driverName"
    driverName         = radv
    driverName                                           = radv
    driverName         = radv
    driverName                                           = radv

$ vulkaninfo | grep "driverName"
    driverName         = radv
    driverName                                           = radv
    driverName         = radv
    driverName                                           = radv

As a sanity check (since the results are strangely the same for both cards):

$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD RAVEN (DRM 3.35.0, 5.4.32, LLVM 9.0.1)
$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD Radeon (TM) RX Graphics (POLARIS11, DRM 3.35.0, 5.4.32, LLVM 9.0.1)
guibou commented 4 years ago

Thank you!

I do wonder now if my test must check for the OpenGL renderer string or the OpenGL version....

guibou commented 4 years ago

Vulkan is failing because the 64 bit loader is trying the 32 bit driver and the converse. I'm surprised.