[GSDX-HW] Not using GPU with Bumblebee on Linux
PCSX2 version:
(For example, stable build v1.4.0 (or) development builds v1.5.xxx)
Development version 1.5.3128
PCSX2 options:
(For example, Clamping/Rounding, Speedhacks, GameFixes)
All options default except using OpenGL (Hardware) setting for GSDX plugin and MTVU for 3+ cores enabled
Plugins used:
(Relevant/Non-default settings of GS/PAD/SPU2/CDVD/USB plugins)
All settings default for plugins, except those noted above
- Note: In case the issue is a graphical problem with the GSDX plugin, please provide basic information like
Renderer/Internal resolution/CRC Hack level/Other relevant optionswhich were used to reproduce the issue. Additionally, providing a GS dump of the issue would also be helpful.
Description of the issue:
(What's the problem? - Screenshots showing the issue if applicable)
PCSX2 is using the integrated gpu on my Intel i7 processor on my laptop instead of my discrete NVIDIA gpu even when running via primusrun or optirun -b primus. All other applications (glxgears, glxspheres) utilize the gpu when initiated with primusrun or optirun -b primus.
Here is the relevant portion of the log window when running a game:
Opening plugins...
Opening GS
OpenGL information. GPU: Mesa DRI Intel(R) Haswell Mobile . Vendor: Intel Open Source Technology Center. Driver: (Core Profile) Mesa 18.0.5
INFO: GL_ARB_sparse_texture is NOT SUPPORTED
INFO: GL_ARB_sparse_texture2 is NOT SUPPORTED
INFO: GL_ARB_gpu_shader5 is available
INFO: GL_ARB_shader_image_load_store is available
INFO: GL_ARB_compute_shader is available
Failed to init the freetype face
INFO: GL_ARB_shader_storage_buffer_object is available
INFO: GL_ARB_texture_view is available
INFO: GL_ARB_vertex_attrib_binding is available
INFO: GL_ARB_clear_texture is available
INFO: GL_ARB_multi_bind is available
INFO: GL_ARB_direct_state_access is available
INFO: GL_ARB_texture_barrier is available
INFO: GL_ARB_get_texture_sub_image is available
Current Renderer: OpenGL (Hardware renderer)
How to reproduce the issue:
(Detailed step by step guide on how to replicate the issue)
- Compile the latest master branch
- run
primusrun sh -c "bin/PCSX2-linux.sh" - configure GSDX plugin to be OpenGL (Hardware)
- close PCSX2 and run
primusrun sh -c "bin/PCSX2-linux.sh"to launch it again - note the log and lack of performance
Last known version to work:
(If the issue isn't present in an older PCSX2 version, it would be helpful to mention the full title of that version. Narrowing it down to the build/commit that first introduced the issue is even better!)
694546e87 works. Not sure why, but the next commit on the master branch (da1eb056a), which is seemingly unrelated, introduces the breakage on my system.
PC specifications:
(For example: CPU: Intel Core 2 Duo E4600 GPU: Gigabyte GTX 750Ti OS: Windows 10 64 Bit)
OS: Fedora 28 x86_64
GPU: NVIDIA 740M
CPU: Intel i7-4702MQ
GPU Driver: 418.56 (proprietary)
RAM: 16 GB
Couldn't we have some explicit adapter selection thingy (like on windows) with GLVND?
At the moment, if you go to cmake/SearchForStuff.cmake, you can see near the top:
# Using find_package OpenGL without either setting your opengl preference to GLVND or LEGACY
# is deprecated as of cmake 3.11.
set(OpenGL_GL_PREFERENCE GLVND)
An option to change it could potentially be added to build.sh if needed.
For full disclosure, I did use the build.sh script to compile PCSX2. I can try to compile using straight up cmake, but which option should I set? -DOpenGL_GL_PREFERENCE=GLVND? If you don't mind, what's the difference between GLVND and LEGACY?
I'm not sure if it'll actually make a difference, but it's probably worth a test. If you compiled it from build.sh, you might just go to the file I mentioned and change the line mentioned to: set(OpenGL_GL_PREFERENCE LEGACY)
Most of what I know about it is from here: https://cmake.org/cmake/help/v3.10/module/FindOpenGL.html
CMake comes up with warnings if you don't set it to one or the other. Without that line, it was defaulting to legacy, which is why I'm thinking it's worth testing. GLVND is the newer preferred ABI.
Unfortunately, while I have a laptop that does have both integrated and descrete gpus on it, it also has Windows 10 on it, and the hard drive's rather full for dualbooting. Somewhere down the road, I might put in a bigger SSD or HD and dual boot, but I normally use a desktop for Linux testing...
I just tried it again changing the setting from GLVND to LEGACY in that file but got the same results. I also tried both settings with the latest commits from today with no success.
I have seen today that if I compile with egl instead of opengl, then gsdx is able to use the discrete card (provided the environment is properly set up). Incidentally, I believe that this is the same problem as #3347.
Also having this issue with 1.7.0.r655.16d33f896 on Arch Linux from the repos. It seems that EGL is now the default and GLX is completely deprecated, so it's no longer needed to specify?
My system is a ThinkPad T520, with an Intel i7-2640M and a Nvidia Quadro NVS 4200M with the 390.138 driver.
For what it's worth I no longer use Bumblebee. I'm using Fedora 31 which now allows Optimus to be used with the help of some environment variables (__NV_PRIME_RENDER_OFFLOAD=1) as documented at https://rpmfusion.org/Howto/Optimus. I wonder if this Arch article could help you https://wiki.archlinux.org/index.php/NVIDIA_Optimus.
Unfortunately, my driver version doesn't allow me to use PRIME render offload since Nvidia doesn't see fit to update the older driver to do so, so I'm stuck with either Bumblebee or nvidia-xrun for the time being :<
I haven't tried nvidia-xrun yet but I'm sure it works that way. It's more of a final ditch option though as it requires running a full, separate X session by itself.
So I tested nvidia-xrun today and discovered something interesting: PCSX2 didn't run! Quite suprising.
I tested eglinfo inside the new X server and found that the Nvidia EGL (and possibly libglvnd) don't seem to be working properly on my system:
X11 platform:
EGL API version: 1.4
EGL vendor string: NVIDIA
EGL version string: 1.4
EGL client APIs:
Compared to running optirun eglinfo or eglinfo in the main X server:
X11 platform:
EGL API version: 1.4
EGL vendor string: Mesa Project
EGL version string: 1.4
EGL client APIs: OpenGL OpenGL_ES
So far, it seems as if this is possibly not an issue with PCSX2 at all, but Nvidia's EGL or libglvnd. The only reason it worked at all with Bumblebee was because it was falling back to Mesa EGL. PCSX2 was just able to reveal the problem in a weird way!
A friend of mine who's a contributor to mpv who's been following along with me about this took a look at it and in my case with the 390.138 drivers, the problem is apparently related to EGL 1.4 not having a eglGetPlatformDisplay function and GSdx trying to use said function
Last year they managed to kludge a function together for it that uses eglGetPlatformDisplay on EGL 1.5 or a hack for EGL 1.4, and this is probably what's needed. The patch in question: https://git.srsfckn.biz/mpv/commit/?id=e1586585b4c54b1f76379728e4f1478b2fd5b3ce
I'll try to see if I can implement something like it and test it out.
EDIT: as for why it works on the Intel graphics, it's possible that Mesa implements a hack for EGL 1.4 Intel and AMD chips to just work whereas Nvidia doesn't
Hi, I just wanted to give some input on this issue instead of leaving it stale.
If anyone is having this problem, please look for an alternative other than Bumblebee.
Bumblebee is known to have a significant performance impact (see here and here) compared to other NVidia Optimus solutions such as nvidia-xrun. Not only that, Bumblebee's last commit was on November the 29th (7 months from this post), and an official Bumblebee-Project team member has considered the project obsolete back in 2018!
As for the Author and those who are stuck on dated drivers that don't support PRIME render offload (Drivers older than 435.17?) I don't believe the team is interested in hacking an implementation for eglGetPlatformDisplay for you.
Your solution would be to use Windows (I'm unsure if prime would even work for you there), stick to the last known working commit linked in the original post, or drop switching and use your dedicated GPU exclusively. (Or update your hardware)
Although I'm not part of the team, I'm confident in saying that there will not be any support for such old hardware or Bumblebee. Thanks.
Agreed that Bumblebee is now obsolete with better solutions for Linux GPU acceleration on NVIDIA cards now available. Closing this issue since it's no longer relevant.