RetroPie/EmulationStation

ES compiles with wrong version of OpenGL on some systems

Closed this issue · 17 comments

Hi,
i'm using a Dell Latitude E6410 with a GPU from Nvidia (NVS 3100M) running Linux Mint 20.1. Up to (and including) version 2.9.3 emulationstation compiled with "-DUSE_OPENGL_21" and runs fine.

Since version 2.9.4 it is compiled with "-DUSE_OPENGL_14" and just crashes on start. Error message is:

emulationstation: /home/xxx/RetroPie-Setup/tmp/build/emulationstation/es-core/src/resources/Font.cpp:410: void Font::renderTextCache(TextCache*): Assertion `*it->textureIdPtr != 0' failed.
Aborted (core dumped)

Output of glxinfo:

$ glxinfo | grep -i opengl
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVS 3100M/PCIe/SSE2
OpenGL core profile version string: 3.3.0 NVIDIA 340.108
OpenGL core profile shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.3.0 NVIDIA 340.108
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 2.0 NVIDIA 340.108 340.108
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.00
OpenGL ES profile extensions:

Ah this would be the issue we've seen on the forum @cmitu . I could force it in RetroPie-Setup as a quick fix perhaps?

Thanks for the info btw.

So as I remember we had opengl2.x as the default and some old systems failed so the opengl1.x renderer was readded. If vendor drivers have now dropped support we will need to do something to detect which is best and maybe that's better implemented in this repo than RetroPie-Setup maybe. Or we switch back to newer opengl here and do some check in RetroPie-Setup for older GPUs.

I've done a quick workaround in RetroPie-Setup in RetroPie/RetroPie-Setup@c6ea312 - if you update and reinstall it should build with the newer GL backend.

Just tried it. It still compiles with "-DUSE_OPENGL_14"

cmitu commented

@joolswills When the GL1 renderer was added back to EmulationStation, it was made default.
@miwasp I guess the drivers are you are using not supporting GL1 anymore (proprietary NVidia drivers), MESA should still support GL1(.1)

Sorry, it's not the compiler flag "-DUSE_OPENGL_21".
Version 2.9.3 compiles already with "-DUSE_OPENGL_14" but nevertheless runs fine.
Version 2.9.4 compiles also with "-DUSE_OPENGL_14" but does not run any more.
It must be a change between versions 2.9.3 and 2.9.4 but i don't see it yet.

The problem in my case are these lines in CMakeLists.txt:

# OpenGL library preference (https://cmake.org/cmake/help/git-stage/policy/CMP0072.html)
if(POLICY CMP0072)
   cmake_policy(SET CMP0072 NEW)
endif()

With these lines in place the executable is linked with "-lOpenGL -lGLX -lGLU" which results in a core dump (see above)
When i remove those lines the executable is linked with "-lGL -lGLU" which works fine.

I'm pretty sure this is related to your really old Nvidia card which probably uses this driver version 340.108 https://www.nvidia.de/Download/driverResults.aspx/156190/de which AFAIK does not support libglvnd so if you try to link against libOpenGL.so and libGLX.so which where provided by https://github.com/NVIDIA/libglvnd it will probably fail because your driver can't handle it.
So old systems should set OpenGL_GL_PREFERENCE LEGACY instead of OpenGL_GL_PREFERENCE GLVND if Nvidia driver older than the 430er series where in use.

I think you are right, this card is really old but it works quiet good. Thank you for this explanation.
Normally one would clone RetroPie-Setup from github and then install emulationstation from there. The setup script clones the github repository of emulationstation on the fly, so where would be the best place for setting OpenGL_GL_PREFERENCE?

Or is it better to install ES manually in this case?

cmitu commented

The issue seems to appear for other cards too (AMD) after the proprietary drivers are installed, so it's not strictly restricted to NVidia. It seems a packaging issue though. @miwasp - did you install from an Ubuntu package/repo or directly from NVidia's site ?

cmitu commented

Normally one would clone RetroPie-Setup from github and then install emulationstation from there

You can clone the branch that works and install from it, then use the binary from that release.

I installed the driver from the standard Ubuntu/Mint repos.

You can clone the branch that works and install from it, then use the binary from that release.

Yes, but then i‘m stuck with e.g. version 2.9.3. If i want to stay with „stable“, is there an easy way to set OpenGL_GL_PREFERENCE to LEGACY (or set the policy to „OLD“) e.g. by using environment variables?

This way i could update emulationstation out of RetroPie-Setup as usual. Otherwise i have to manually clone emulationstation, edit CMakeLists.txt, make and use this binary.

cmitu commented

Yes, but then i‘m stuck with e.g. version 2.9.3. If i want to stay with „stable“, is there an easy way to set OpenGL_GL_PREFERENCE to LEGACY (or set the policy to „OLD“) e.g. by using environment variables?

Using the previous version is meant to be workaround, until a solution is found.

Ah ok, thank you very much.

cmitu commented

@miwasp can you try installing the emulationstation-dev package from RetroPie-Setup (the experimental section) and see if it fixes your issue ?

@miwasp can you try installing the emulationstation-dev package from RetroPie-Setup (the experimental section) and see if it fixes your issue ?

The dev package fixes this issue in my environment (version 2.10.0RP-DEV)