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

OpenGL context initialization error #59

Closed
cmitu opened this issue Jul 4, 2024 · 15 comments
Closed

OpenGL context initialization error #59

cmitu opened this issue Jul 4, 2024 · 15 comments

Comments

@cmitu
Copy link

cmitu commented Jul 4, 2024

Hi,

I'm using the ScummVM core on a GLES2 (only) device (Raspberry Pi 3B), after compiling the core with GLES2 support following this commit. RetroArch (1.9.1) starts the GLES2 context alright, but the core fails to detect it (?) and stops with:

...
[INFO] [EGL]: Current context: 0x1.
[INFO] [GL]: Found GL context: "egl_videocore".
[INFO] [GL]: Detecting screen resolution: 1920x1080.
[INFO] [GL]: Vendor: Broadcom, Renderer: VideoCore IV HW.
[INFO] [GL]: Version: OpenGL ES 2.0.
[INFO] [GL]: Using resolution 1920x1080.
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 1 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Initializing HW render (1024x1024).
[INFO] [GL]: Max texture size: 2048 px, renderbuffer size: 2048 px.
[INFO] [GL]: Supports FBO (render-to-texture).
...
[WARN] [udev]: Mouse grab/ungrab feature unavailable.
[INFO] [Input]: Game Focus => OFF
[libretro DEBUG] Default browser last path set to: /home/pi
[libretro DEBUG] Default save path set to: /home/pi/roms/scummvm/bass/
[libretro DEBUG] Mixer set up at 48000Hz
[libretro ERROR] Couldn't initialize OpenGL!

Is this a supported configuration ? Is there any additional configuration to be added to core options/RetroArch's config to make it work ? Let me know if any additional info is needed.

@gouchi
Copy link
Member

gouchi commented Aug 12, 2024

Hi,

Which options did you use for compiling it ?

Thank you.

@cmitu
Copy link
Author

cmitu commented Aug 19, 2024

@gouchi it was built with the FORCE_OPENGLES2=1 make parameter - see #57.

@spleen1981
Copy link
Collaborator

@cmitu

  • are you using platform=rpi3_64 to compile?
  • Can you provide the entire command you used for make?
  • Are you applying any patch before compiling?
  • Can you provide the output of the build process?
  • Can you provide the entire retroarch.log?

The code looks like is failing here:

if (!gladVersion) {
// If gladVersion is 0 it means that loading failed and glad didn't set up anything
error("Couldn't initialize OpenGL");
}

Not sure about which OpenGL version is actually available or working on your platform, do you have any other core working with GLES2 on your system?

@cmitu
Copy link
Author

cmitu commented Sep 17, 2024

* are you using `platform=rpi3_64` to compile?

No.

* Can you provide the entire command you used for `make`?

I'm just using

 make USE_MT32EMU=1 FORCE_OPENGLES2=1
* Are you applying any patch before compiling?

No.

* Can you provide the output of the build process?

That might take some time, but I'll try to get it. If you are interesetedin the initial GL context type detection from the makefile, the beginning looks like this:

...
Platform is unix 32bit
Support for OpenGLES2 requested
Configuring dependencies...
Configuring submodules...
- Submodules configured
- Use system shared fluidsynth: no
- Use system shared FLAC: no
- Use system shared vorbis: no
- Use system shared z: no
...

I'll come back with a complete log later on, compilation will take a bit of time.

* Can you provide the entire `retroarch.log`?
retroarch.log
/opt/retropie/emulators/retroarch/bin/retroarch -v --config /opt/retropie/configs/scummvm/retroarch.cfg -L /opt/retropie/libretrocores/lr-scummvm/scummvm_libretro.so ~/roms/scummvm/bass
[WARN] [GameMode]: GameMode cannot be enabled on this system ("dlopen failed - libgamemode.so: cannot open shared object file: No such file or directory.") https://github.com/FeralInteractive/gamemode needs to be installed.
[WARN] [Config]: GameMode unsupported - disabling..
[INFO] RetroArch 1.19.1 (Git e948222)
[INFO] === Build =======================================
[INFO] CPU Model Name: ARMv7 Processor rev 4 (v7l)

[INFO] Capabilities: NEON VFPV3 VFPV4
[INFO] Version: 1.19.1
[INFO] Git: e948222
[INFO] Built: Jun 13 2024
[INFO] =================================================
[INFO] [Input]: Found input driver: "udev".
[ERROR] Couldn't find any cloud sync driver named ""
[INFO] Available cloud sync drivers are:
[INFO] 	webdav
[INFO] 	null
[WARN] Going to default to first cloud sync driver...
[INFO] [Core]: Loading dynamic libretro core from: "/opt/retropie/libretrocores/lr-scummvm/scummvm_libretro.so"
[INFO] [Overrides]: Redirecting save file to "/home/pi/roms/scummvm/bass.srm".
[INFO] [Overrides]: Redirecting save state to "/home/pi/roms/scummvm/bass.state".
[INFO] [Environ]: SET_SUPPORT_NO_GAME: yes.
[INFO] [Environ]: GET_LANGUAGE: "30".
[INFO] [Environ]: GET_CORE_OPTIONS_VERSION.
[INFO] [Environ]: GET_LANGUAGE: "30".
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL.
[INFO] [Environ]: GET_LOG_INTERFACE.
[libretro DEBUG] ScummVM core version: 4f5f776b-2.9.0git
[INFO] [Environ]: SET_AUDIO_BUFFER_STATUS_CALLBACK.
[INFO] [Environ]: SET_PIXEL_FORMAT: XRGB8888.
[INFO] [Environ]: SET_HW_RENDER, context type: gl.
[INFO] Requesting OpenGLES2 context.
[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[INFO] [Environ]: SET_CONTROLLER_INFO.
[INFO] [Environ]: SET_KEYBOARD_CALLBACK.
[INFO] [Environ]: SYSTEM_DIRECTORY: "/home/pi/RetroPie/BIOS".
[INFO] [Environ]: SAVE_DIRECTORY: "/home/pi/roms/scummvm/".
[INFO] [Environ]: PLAYLIST_DIRECTORY: "/home/pi/.config/retroarch/playlists".
[INFO] [Content]: Content loading skipped. Implementation will load it on its own.
[libretro DEBUG] [scummvm] launch via autodetect
[INFO] [SRAM]: Skipping SRAM load.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 640x480, Aspect: 1.333, FPS: 60.00, Sample rate: 48000.00 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: 1440x1080.
[INFO] [Video]: Using HW render, OpenGL driver forced.
[INFO] [Video]: Using configured "gl" driver for GL HW render.
[INFO] [EGL] Falling back to eglGetDisplay
[INFO] [EGL]: EGL version: 1.4
[INFO] [EGL]: Current context: 0x1.
[INFO] [GL]: Found GL context: "egl_videocore".
[INFO] [GL]: Detecting screen resolution: 640x480.
[INFO] [GL]: Vendor: Broadcom, Renderer: VideoCore IV HW.
[INFO] [GL]: Version: OpenGL ES 2.0.
[INFO] [GL]: Using resolution 640x480.
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 1 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Initializing HW render (1024x1024).
[INFO] [GL]: Max texture size: 2048 px, renderbuffer size: 2048 px.
[INFO] [GL]: Supports FBO (render-to-texture).
[INFO] [Video]: Graphics driver did not initialize an input driver. Attempting to pick a suitable driver.
[WARN] [udev]: Full-screen pointer won't be available.
[INFO] [udev]: Mouse/Touch #0: "Logitech Wireless Mouse" (REL) /dev/input/event0.
[INFO] [udev]: Pad #0 (/dev/input/event4) supports 0 force feedback effects.
[INFO] [Autoconf]: USB,2-axis 8-button gamepad   configured in port 1.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [Video]: Found display server: "null".
[libretro DEBUG] HW context reset
[INFO] [ALSA] Using ALSA version 1.1.8
[INFO] [ALSA]: Using FLOAT_LE sample format for PLAYBACK device "default"
[INFO] [ALSA]: Period: 4 periods per buffer (768 frames, 6144 bytes)
[INFO] [ALSA]: Buffer size: 3072 frames (24576 bytes)
[INFO] [ALSA]: Can pause: no.
[INFO] [ALSA]: Initialized PLAYBACK device "default"
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA] Using ALSA version 1.1.8
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "gl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/scummvm/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/scummvm/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/scummvm/content_video_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/scummvm/content_image_history.lpl".
[INFO] [Playlist]: Loading favourites file: "/opt/retropie/configs/scummvm/content_favorites.lpl".
[INFO] [Playlist]: Written to playlist file: "/opt/retropie/configs/scummvm/content_history.lpl".
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY.
[INFO] [Environ]: Setting audio latency to 160 ms.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [ALSA] Using ALSA version 1.1.8
[INFO] [ALSA]: Using FLOAT_LE sample format for PLAYBACK device "default"
[INFO] [ALSA]: Period: 4 periods per buffer (1920 frames, 15360 bytes)
[INFO] [ALSA]: Buffer size: 7680 frames (61440 bytes)
[INFO] [ALSA]: Can pause: no.
[INFO] [ALSA]: Initialized PLAYBACK device "default"
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA] Using ALSA version 1.1.8
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "gl".
[WARN] [udev]: Mouse grab/ungrab feature unavailable.
[INFO] [Input]: Game Focus => OFF
GameID                         Description                                                Full Path
------------------------------ ---------------------------------------------------------- ---------------------------------------------------------
sky:sky                        Beneath a Steel Sky (v0.0372 CD/DOS)                       /home/pi/roms/scummvm/bass
[libretro DEBUG] Default browser last path set to: /home/pi
[libretro DEBUG] Default save path set to: /home/pi/roms/scummvm/
[libretro DEBUG] Mixer set up at 48000Hz
[libretro ERROR] Couldn't initialize OpenGL!

Not sure about which OpenGL version is actually available or working on your platform, do you have any other core working with GLES2 on your system?

From the cores that use the HW acceleration, I thin ppsspp, vectrex and the old flycast cores used a HW GLES2 context. Straight up OpenGL (core, 2.x or 1.x) is not available on the platform - the old Raspberry Pi BRCM (now legacy) GLES drivers didn't implement OpenGL.

EDIT: for Flycast's GLES2 context support, the video_shared_context = true option was needed for RetroArch. I tried it with ScummVM, but it had no effect.

@cmitu
Copy link
Author

cmitu commented Sep 17, 2024

Build log, abbreviated - https://pastebin.com/nMu2iGiD. I had from the middle part of the build log since it exceeded the 0.5Mb allowed by pastebin.com. There are 2 make commands in the build log:

  • a make clean
  • a make USE_MT32EMU=1 FORCE_OPENGLES2=1

@spleen1981
Copy link
Collaborator

Can you build again with: make noengine DEBUG=1 USE_MT32EMU=1 FORCE_OPENGLES2=1 and provide the full retroarch.log?
The new noengine target will exclude all engines from build to make the process quick, and the DEBUG flag should provide more info in the log.

@cmitu
Copy link
Author

cmitu commented Sep 18, 2024

Using the make invokation requested above results in an error:

Platform is unix 32bit
Support for OpenGLES2 requested
Configuring dependencies...
Configuring submodules...
- Submodules configured
- Use system shared fluidsynth: no
- Use system shared FLAC: no
- Use system shared vorbis: no
- Use system shared z: no
- Use system shared mad: no
- Use system shared faad: no
- Use system shared png: no
- Use system shared jpeg: no
- Use system shared theora: no
- Use system shared freetype: no
- Use system shared fribidi: no
Compiling libretro-core.cpp...
Compiling libretro-fs.cpp...
Compiling libretro-fs-factory.cpp...
Compiling libretro-os-base.cpp...
Compiling libretro-os-events.cpp...
Compiling libretro-os-inputs.cpp...
Compiling libretro-os-utils.cpp...
Compiling libretro-threads.cpp...
Compiling libretro-timer.cpp...
Compiling libretro-mapper.cpp...
Compiling libretro-options-widget.cpp...
Compiling libretro-graphics.cpp...
/home/pi/RetroPie-Setup/tmp/build/lr-scummvm/backends/platform/libretro/src/libretro-graphics.cpp: In member function ‘virtual void LibretroOpenGLGraphics::setMouseCursor(const void*, uint, uint, int, int, uint32, bool, const Graphics::PixelFormat*, const byte*)’:
/home/pi/RetroPie-Setup/tmp/build/lr-scummvm/backends/platform/libretro/src/libretro-graphics.cpp:478:9: warning: possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
  delete _cursor;
         ^~~~~~~
/home/pi/RetroPie-Setup/tmp/build/lr-scummvm/backends/platform/libretro/src/libretro-graphics.cpp:478:9: warning: invalid use of incomplete type ‘class OpenGL::Surface’
In file included from /home/pi/RetroPie-Setup/tmp/build/lr-scummvm/backends/platform/libretro/../../../backends/platform/libretro/include/libretro-graphics.h:26,
                 from /home/pi/RetroPie-Setup/tmp/build/lr-scummvm/backends/platform/libretro/src/libretro-graphics.cpp:28:
/home/pi/RetroPie-Setup/tmp/build/lr-scummvm/backends/platform/libretro/../../../backends/graphics/opengl/opengl-graphics.h:47:7: note: forward declaration of ‘class OpenGL::Surface’
 class Surface;
       ^~~~~~~
/home/pi/RetroPie-Setup/tmp/build/lr-scummvm/backends/platform/libretro/src/libretro-graphics.cpp:478:9: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
  delete _cursor;
         ^~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-undefined-var-template’
Compiling test_new_standards.cpp...
Compiling main.cpp...
Compiling commandLine.cpp...
Compiling plugins.cpp...
/home/pi/RetroPie-Setup/tmp/build/lr-scummvm/backends/platform/libretro/../../../base/plugins.cpp:92:12: fatal error: engines/plugins_table.h: No such file or directory
   #include "engines/plugins_table.h"
            ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

@spleen1981
Copy link
Collaborator

Can't reproduce this build error, here it's working fine. Did you try to make clean first?
If it's not working you could go without the noengine, adding only the DEBUG=1 flag to the make command, i.e. make DEBUG=1 USE_MT32EMU=1 FORCE_OPENGLES2=1.

@cmitu
Copy link
Author

cmitu commented Sep 19, 2024

Ok, I've managed to compile without any engines included (not sure what the problem was on my first attempt). I get about the same log, is there extra configuration needed to get more info ? Here is the log

retroarch.log
/opt/retropie/emulators/retroarch/bin/retroarch -v --config /opt/retropie/configs/scummvm/retroarch.cfg -L /opt/retropie/libretrocores/lr-scummvm/scummvm_libretro.so ~/roms/scummvm/bass
[WARN] [GameMode]: GameMode cannot be enabled on this system ("dlopen failed - libgamemode.so: cannot open shared object file: No such file or directory.") https://github.com/FeralInteractive/gamemode needs to be installed.
[WARN] [Config]: GameMode unsupported - disabling..
[INFO] RetroArch 1.19.1 (Git e948222)
[INFO] === Build =======================================
[INFO] CPU Model Name: ARMv7 Processor rev 4 (v7l)

[INFO] Capabilities: NEON VFPV3 VFPV4
[INFO] Version: 1.19.1
[INFO] Git: e948222
[INFO] Built: Jun 13 2024
[INFO] =================================================
[INFO] [Input]: Found input driver: "udev".
[ERROR] Couldn't find any cloud sync driver named ""
[INFO] Available cloud sync drivers are:
[INFO]  webdav
[INFO]  null
[WARN] Going to default to first cloud sync driver...
[INFO] [Core]: Loading dynamic libretro core from: "/opt/retropie/libretrocores/lr-scummvm/scummvm_libretro.so"
[INFO] [Overrides]: Redirecting save file to "/home/pi/roms/scummvm/bass.srm".
[INFO] [Overrides]: Redirecting save state to "/home/pi/roms/scummvm/bass.state".
[INFO] [Environ]: SET_SUPPORT_NO_GAME: yes.
[INFO] [Environ]: GET_LANGUAGE: "30".
[INFO] [Environ]: GET_CORE_OPTIONS_VERSION.
[INFO] [Environ]: GET_LANGUAGE: "30".
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL.
[INFO] [Environ]: GET_LOG_INTERFACE.
[libretro DEBUG] ScummVM core version: 668e2b66-2.9.0git
[INFO] [Environ]: SET_AUDIO_BUFFER_STATUS_CALLBACK.
[INFO] [Environ]: SET_PIXEL_FORMAT: XRGB8888.
[INFO] [Environ]: SET_HW_RENDER, context type: gl.
[INFO] Requesting OpenGLES2 context.
[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[INFO] [Environ]: SET_CONTROLLER_INFO.
[INFO] [Environ]: SET_KEYBOARD_CALLBACK.
[INFO] [Environ]: SYSTEM_DIRECTORY: "/home/pi/RetroPie/BIOS".
[INFO] [Environ]: SAVE_DIRECTORY: "/home/pi/roms/scummvm/".
[INFO] [Environ]: PLAYLIST_DIRECTORY: "/home/pi/.config/retroarch/playlists".
[INFO] [Content]: Content loading skipped. Implementation will load it on its own.
[libretro WARN] [scummvm] Game not found. Check path and content of '/home/pi/roms/scummvm/bass'
[INFO] [SRAM]: Skipping SRAM load.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 640x480, Aspect: 1.333, FPS: 60.00, Sample rate: 48000.00 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: 1440x1080.
[INFO] [Video]: Using HW render, OpenGL driver forced.
[INFO] [Video]: Using configured "gl" driver for GL HW render.
[INFO] [EGL] Falling back to eglGetDisplay
[INFO] [EGL]: EGL version: 1.4
[INFO] [EGL]: Current context: 0x1.
[INFO] [GL]: Found GL context: "egl_videocore".
[INFO] [GL]: Detecting screen resolution: 640x480.
[INFO] [GL]: Vendor: Broadcom, Renderer: VideoCore IV HW.
[INFO] [GL]: Version: OpenGL ES 2.0.
[INFO] [GL]: Using resolution 640x480.
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: Compiled
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 1 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Initializing HW render (1024x1024).
[INFO] [GL]: Max texture size: 2048 px, renderbuffer size: 2048 px.
[INFO] [GL]: Supports FBO (render-to-texture).
[INFO] [Video]: Graphics driver did not initialize an input driver. Attempting to pick a suitable driver.
[WARN] [udev]: Full-screen pointer won't be available.
[INFO] [udev]: Mouse/Touch #0: "Logitech Wireless Mouse" (REL) /dev/input/event0.
[INFO] [udev]: Pad #0 (/dev/input/event4) supports 0 force feedback effects.
[INFO] [Autoconf]: USB,2-axis 8-button gamepad   configured in port 1.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [Video]: Found display server: "null".
[libretro DEBUG] HW context reset
[INFO] [ALSA] Using ALSA version 1.1.8
[INFO] [ALSA]: Using FLOAT_LE sample format for PLAYBACK device "default"
[INFO] [ALSA]: Period: 4 periods per buffer (768 frames, 6144 bytes)
[INFO] [ALSA]: Buffer size: 3072 frames (24576 bytes)
[INFO] [ALSA]: Can pause: no.
[INFO] [ALSA]: Initialized PLAYBACK device "default"
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA] Using ALSA version 1.1.8
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "gl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/scummvm/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/scummvm/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/scummvm/content_video_history.lpl".
[INFO] [Playlist]: Loading history file: "/opt/retropie/configs/scummvm/content_image_history.lpl".
[INFO] [Playlist]: Loading favourites file: "/opt/retropie/configs/scummvm/content_favorites.lpl".
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY.
[INFO] [Environ]: Setting audio latency to 160 ms.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [ALSA] Using ALSA version 1.1.8
[INFO] [ALSA]: Using FLOAT_LE sample format for PLAYBACK device "default"
[INFO] [ALSA]: Period: 4 periods per buffer (1920 frames, 15360 bytes)
[INFO] [ALSA]: Buffer size: 7680 frames (61440 bytes)
[INFO] [ALSA]: Can pause: no.
[INFO] [ALSA]: Initialized PLAYBACK device "default"
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA] Using ALSA version 1.1.8
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "gl".
[WARN] [udev]: Mouse grab/ungrab feature unavailable.
[INFO] [Input]: Game Focus => OFF
[libretro DEBUG] Default browser last path set to: /home/pi
[libretro DEBUG] Default save path set to: /home/pi/roms/scummvm/
[libretro DEBUG] Mixer set up at 48000Hz
[libretro ERROR] Couldn't initialize OpenGL!

I have added libretro_log_level=0 to the configuration, but I can't see anything different than the previous log.

@spleen1981
Copy link
Collaborator

That's the most detailed log you can get in this case, I think.
It looks like there is something going wrong with your platform/graphic driver and GLAD implementation.
You may try to compile this branch https://github.com/libretro/scummvm/tree/test_glad, which will show where it fails.
Also I would pass platform=armv7neon to make in your case.

@cmitu
Copy link
Author

cmitu commented Sep 20, 2024

OK, the log is pretty much similar, but the end says:

...
[WARN] [udev]: Mouse grab/ungrab feature unavailable.
[INFO] [Input]: Game Focus => OFF
Debuglevel (from command line): 11
[libretro DEBUG] Default browser last path set to: /home/pi
[libretro DEBUG] Default save path set to: /home/pi/roms/scummvm/
[libretro DEBUG] Mixer set up at 48000Hz
[libretro DEBUG] userptr not null
[libretro DEBUG] glad_glGetString null
[libretro ERROR] Couldn't initialize OpenGL!

Does glad searches for/needs a certain library (.so) in a certain path/folder to initialize the GL(ES) context ? On this system, the name and path may be different/non-standard, but the library should still be in the LD_LIBRARY_PATH and RetroArch can load it.

Related to the noengine target, I think the target is bugged and the error I received is correct (!). The engines/plugins_table.h file is generated as part of the Configuring ScummVM engines step, but I think this step is ommited for the noengine target (among other targets). If you do a clean checkout and run the make command, I think you'll receive the same error.
I had to run make without noengine for the file to be generated, interrupt the build then re-run make noengine ... again.

@spleen1981
Copy link
Collaborator

You are correct regarding the noengine target, now it should be fixed in the same test_glad branch.
The GLAD actually is just using a function provided by the libretro API (through hw_render.get_proc_address) to get the pointer to the needed GL function by its name (e.g. glGetString), as available in the system,
I've added a new log row to test if the pointer to hw_render.get_proc_address is null, in the same branch.

@cmitu
Copy link
Author

cmitu commented Sep 21, 2024

Thank you for the fix - noengine builds fine now. I've re-compiled with the latest changes from the test_glad branch, this is the output at the end of the log:

[WARN] [udev]: Mouse grab/ungrab feature unavailable.
[INFO] [Input]: Game Focus => OFF
Debuglevel (from command line): 11
[libretro DEBUG] Default browser last path set to: /home/pi
[libretro DEBUG] Default save path set to: /home/pi/roms/scummvm/
[libretro DEBUG] Mixer set up at 48000Hz
[libretro DEBUG] userptr not null
[libretro DEBUG] load function not null
[libretro DEBUG] glad_glGetString null
[libretro ERROR] Couldn't initialize OpenGL!

@spleen1981
Copy link
Collaborator

The problem may be with your egl_videocore driver. The log says EGL version: 1.4 and based on this info about eglGetProcAddress function (that is where hw_render.get_proc_address points in your case):

If the EGL version is not 1.5 or greater, only queries of EGL and client API extension functions will succeed.

which looks like the reason why GLAD fails to get e.g. glGetString and fails to initialize.
As OpenGL support for this core relies on GLAD only at this time, I guess you should investigate if any updated or alternative driver is available on your platform or disable hardware acceleration from the core options...

@cmitu
Copy link
Author

cmitu commented Sep 23, 2024

As OpenGL support for this core relies on GLAD only at this time, I guess you should investigate if any updated or alternative driver is available on your platform or disable hardware acceleration from the core options...

For this particular platform (Raspberry Pi, using the Videocore IV GPU) there is an updated driver - the open source one included in Mesa3D's vc4 driver. When using a newer system/distro version, this newer driver will be available and either GLES2 or OpenGL 2.1 should be available.

OK, so I guess for this old driver/platform, the 3D context creation should be disabled since it's not possible to acquire the GL context in the core. Thank you for the analysis and solution.

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

No branches or pull requests

3 participants