Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLFW selects llvmpipe instead of NVIDIA GPU for OpenGL context #1046

Open
rmheuer opened this issue Feb 20, 2025 · 3 comments
Open

GLFW selects llvmpipe instead of NVIDIA GPU for OpenGL context #1046

rmheuer opened this issue Feb 20, 2025 · 3 comments

Comments

@rmheuer
Copy link

rmheuer commented Feb 20, 2025

Version

3.3.3

Platform

Linux x64

JDK

OpenJDK 64-Bit Server VM v17.0.13+11-Ubuntu-2ubuntu120.04 by Ubuntu

Module

GLFW, OpenGL

Bug description

When creating an OpenGL context with GLFW in LWJGL version 3.3.3 and newer, it uses the llvmpipe software renderer instead of the NVIDIA GPU in my system.

The output from running the hello world application from https://www.lwjgl.org/guide (with -Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.util.DebugLoader=true and prints added for the glGetString values) is

Hello LWJGL 3.3.3-snapshot!
[LWJGL] Version: 3.3.3-snapshot
         OS: Linux v5.4.0-204-generic
        JRE: Linux amd64 17.0.13
        JVM: OpenJDK 64-Bit Server VM v17.0.13+11-Ubuntu-2ubuntu120.04 by Ubuntu
[LWJGL] Loading JNI library: lwjgl
        Module: org.lwjgl
        Using SharedLibraryLoader...
        Found at: /tmp/lwjgl_ryan/3.3.3-snapshot/x64/liblwjgl.so
        Loaded from org.lwjgl.librarypath: /tmp/lwjgl_ryan/3.3.3-snapshot/x64/liblwjgl.so
[LWJGL] Closure Registry: ConcurrentHashMap
[LWJGL] Loading library: jemalloc
        Module: org.lwjgl.jemalloc
        Using SharedLibraryLoader...
        Found at: /tmp/lwjgl_ryan/3.3.3-snapshot/x64/libjemalloc.so
        Loaded from org.lwjgl.librarypath: /tmp/lwjgl_ryan/3.3.3-snapshot/x64/libjemalloc.so
[LWJGL] MemoryUtil allocator: JEmallocAllocator
[LWJGL] Loading library: glfw
        Module: org.lwjgl.glfw
        Using SharedLibraryLoader...
        Found at: /tmp/lwjgl_ryan/3.3.3-snapshot/x64/libglfw.so
        Loaded from org.lwjgl.librarypath: /tmp/lwjgl_ryan/3.3.3-snapshot/x64/libglfw.so
[LWJGL] Loading JNI library: lwjgl_opengl
        Module: org.lwjgl.opengl
        Using SharedLibraryLoader...
        Found at: /tmp/lwjgl_ryan/3.3.3-snapshot/x64/liblwjgl_opengl.so
        Loaded from org.lwjgl.librarypath: /tmp/lwjgl_ryan/3.3.3-snapshot/x64/liblwjgl_opengl.so
[LWJGL] Loading library: libGLX.so.0
        Module: org.lwjgl.opengl
        libGLX.so.0 not found in org.lwjgl.librarypath=/tmp/lwjgl_ryan/3.3.3-snapshot/x64
        Loaded from system paths: /lib/x86_64-linux-gnu/libGLX.so.0
Vendor: Mesa/X.org
Renderer: llvmpipe (LLVM 12.0.0, 128 bits)
Version: 3.1 Mesa 21.2.6

With LWJGL 3.3.1, I get the following output:

Hello LWJGL 3.3.1 SNAPSHOT!
[LWJGL] Version: 3.3.1 SNAPSHOT
[LWJGL]          OS: Linux v5.4.0-204-generic
[LWJGL]         JRE: Linux amd64 17.0.13
[LWJGL]         JVM: OpenJDK 64-Bit Server VM v17.0.13+11-Ubuntu-2ubuntu120.04 by Ubuntu
[LWJGL] Loading JNI library: lwjgl
[LWJGL]         Module: org.lwjgl
[LWJGL]         Using SharedLibraryLoader...
[LWJGL]         Found at: /tmp/lwjglryan/3.3.1-SNAPSHOT/liblwjgl.so
[LWJGL]         Loaded from org.lwjgl.librarypath: /tmp/lwjglryan/3.3.1-SNAPSHOT/liblwjgl.so
[LWJGL] Closure Registry: ConcurrentHashMap
[LWJGL] Loading library: jemalloc
[LWJGL]         Module: org.lwjgl.jemalloc
[LWJGL]         Using SharedLibraryLoader...
[LWJGL]         Found at: /tmp/lwjglryan/3.3.1-SNAPSHOT/libjemalloc.so
[LWJGL]         Loaded from org.lwjgl.librarypath: /tmp/lwjglryan/3.3.1-SNAPSHOT/libjemalloc.so
[LWJGL] MemoryUtil allocator: JEmallocAllocator
[LWJGL] Loading library: glfw
[LWJGL]         Module: org.lwjgl.glfw
[LWJGL]         Using SharedLibraryLoader...
[LWJGL]         Found at: /tmp/lwjglryan/3.3.1-SNAPSHOT/libglfw.so
[LWJGL]         Loaded from org.lwjgl.librarypath: /tmp/lwjglryan/3.3.1-SNAPSHOT/libglfw.so
[LWJGL] Loading JNI library: lwjgl_opengl
[LWJGL]         Module: org.lwjgl.opengl
[LWJGL]         Using SharedLibraryLoader...
[LWJGL]         Found at: /tmp/lwjglryan/3.3.1-SNAPSHOT/liblwjgl_opengl.so
[LWJGL]         Loaded from org.lwjgl.librarypath: /tmp/lwjglryan/3.3.1-SNAPSHOT/liblwjgl_opengl.so
[LWJGL] Loading library: libGL.so.1
[LWJGL]         Module: org.lwjgl.opengl
[LWJGL]         libGL.so.1 not found in org.lwjgl.librarypath=/tmp/lwjglryan/3.3.1-SNAPSHOT
[LWJGL]         Loaded from system paths: /lib/x86_64-linux-gnu/libGL.so.1
Vendor: NVIDIA Corporation
Renderer: GeForce 9400M/integrated/SSE2
Version: 3.3.0 NVIDIA 340.108

which shows that the GPU is being correctly selected.

The only difference I can see between the two is that 3.3.3 is using libGLX instead of libGL. I have found that 3.3.3 selects the correct GPU if I specify -Dorg.lwjgl.opengl.libname=libGL.so.1 and call GLFWNativeGLX.setPath(GL.getFunctionProvider()) before glfwInit(), but this does not seem like the ideal solution.

Stacktrace or crash log output

@rmheuer
Copy link
Author

rmheuer commented Feb 20, 2025

I've also tested this on version 3.3.6 and the same issue occurs

@Spasi
Copy link
Member

Spasi commented Feb 21, 2025

Hey @rmheuer,

It sounds like a /~https://github.com/NVIDIA/libglvnd misconfiguration. Does it help if you run the application with __GLX_VENDOR_LIBRARY_NAME=nvidia?

@rmheuer
Copy link
Author

rmheuer commented Feb 21, 2025

Hello @Spasi,

Running the application with __GLX_VENDOR_LIBRARY_NAME=nvidia does not seem to change anything, it still selects llvmpipe. I'm not sure what's happening since the GPU does appear in glxinfo output without the environment variable.

Here is the glxinfo output: glxinfo.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants