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

EGL_NOT_INITIALIZED (EGLError) on RaspberryPi #52

Open
jose1711 opened this issue Oct 29, 2020 · 17 comments
Open

EGL_NOT_INITIALIZED (EGLError) on RaspberryPi #52

jose1711 opened this issue Oct 29, 2020 · 17 comments

Comments

@jose1711
Copy link
Contributor

Following instructions in blitzberry.md I am stuck with the following error:

$ blitzloop --mpv-ao=alsa --no-audioengine
Loading song DB...
Done.
Display mode: 1920x1080
Traceback (most recent call last):
  File "/usr/bin/blitzloop", line 33, in <module>
    sys.exit(load_entry_point('blitzloop==0.1', 'console_scripts', 'blitzloop')())
  File "/usr/lib/python3.8/site-packages/blitzloop/main.py", line 59, in entry
    display = graphics.Display(opts.width, opts.height, opts.fullscreen)
  File "/usr/lib/python3.8/site-packages/blitzloop/graphics.py", line 33, in Display
    _display = rpi.Display(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/blitzloop/backend/rpi.py", line 102, in __init__
    egl.eglInitialize(self.disp, None, None)
  File "/usr/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 415, in __call__
    return self( *args, **named )
  File "/usr/lib/python3.8/site-packages/OpenGL/error.py", line 230, in glCheckError
    raise self._errorClass(
OpenGL.raw.EGL._errors.EGLError: EGLError(
	err = EGL_NOT_INITIALIZED,
	baseOperation = eglInitialize,
	cArguments = (
		<OpenGL._opaque.EGLDisplay_pointer object at 0x6b922148>,
		None,
		None,
	),
	result = 0
)

and have no idea how to proceed. Raspberry is a 3B+ model.

@marcan
Copy link
Owner

marcan commented Oct 30, 2020

This is without X, running on the text terminal?

Can you check your libEGL.so.* in the library path, and that /opt/vc/lib/libEGL.so exists? Maybe add a print(name) at the top of find_library. I get the feeling that the wrong EGL library is being loaded.

Can you use mpv --vo=rpi to play back videos with mpv normally?

@jose1711
Copy link
Contributor Author

Running from text terminal. libEGL exists:

[alarm@alarmpi blitzloop]$ ls -l /opt/vc/lib/libEGL.so 
-rw-r--r-- 1 root root 202072 Oct 16 18:14 /opt/vc/lib/libEGL.so
[alarm@alarmpi blitzloop]$ md5sum /opt/vc/lib/libEGL.so 
31494c335a11c07beceb259b48efe3e6  /opt/vc/lib/libEGL.so

Setting LD_LIBRARY_PATH to /opt/vc/lib prior to running blitzloop yields the same error.

Looks like find_library(name) is not being called at all (as print was not invoked and intentional typo I made did not raise exception either).

rpi output is not recognized by mpv:

[alarm@alarmpi ~]$ mpv --vo=rpi video.mp4
 (+) Video --vid=1 (*) (h264 1280x720 25.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
[vo] Video output rpi not found!
Error opening/initializing the selected video_out (--vo) device.
Video: no video


Exiting... (Errors when loading file)

[alarm@alarmpi ~]$ pacman -Q mpv
mpv 1:0.32.0-4

[alarm@alarmpi ~]$ mpv -vo help
The legacy option syntax ('-vo value') is deprecated and dangerous.
Please use '--vo=value'.
Available video outputs:
  libmpv           render API for libmpv
  gpu              Shader-based GPU Renderer
  vdpau            VDPAU with X11
  wlshm            Wayland SHM video output
  xv               X11/Xv
  vaapi            VA API with X11
  x11              X11 (slow, old crap)
  null             Null video output
  image            Write video frames to image files
  tct              true-color terminals
  caca             libcaca
  drm              Direct Rendering Manager

@jose1711
Copy link
Contributor Author

Shortly after sending this I realized I did not have mpv-rpi installed (only mpv which conflicts with it). Sadly the compilation of its dependency - ffmpeg-mmal is keeping me from building it :-(

@marcan
Copy link
Owner

marcan commented Oct 30, 2020

Yeah, ffmpeg-mmal is a pain in the ass to build.

The thing is, as far as I know you need that to get the video decode acceleration... So it's pretty much a requirement. BlitzLoop on the Rpi3 is already barely holding on on that CPU, without video decode accel it'll be a mess.

It's possible that installing those pulls in some dependency that fixes BlitzLoop too...

@marcan
Copy link
Owner

marcan commented Oct 30, 2020

I believe it might be possible to use BlitzLoop with the drm (fkms) codepath on rPi, and iff you can get video decode accel that would be fine probably, but I'm not holding my breath...

@jose1711
Copy link
Contributor Author

Ok, I managed to build both ffmpeg-mmal and mpv-rpi after all. Now I am getting different error:

[alarm@alarmpi ~]$ mpv --vo=rpi video.mp4 
 (+) Video --vid=1 (*) (h264 1280x720 25.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
[vo/rpi] Could not get DISPMANX objects.
Error opening/initializing the selected video_out (--vo) device.
Video: no video


Exiting... (Errors when loading file)

@marcan
Copy link
Owner

marcan commented Oct 30, 2020

At least it's clearly not a BlitzLoop problem... I wonder if something changed in Arch Linux ARM somewhere along the way, or something else is different about your setup...

@jose1711
Copy link
Contributor Author

After reading mpv-player/mpv#7314 I decided to try compile an older version of mpv (0.29.1) and it finally worked:

[alarm@alarmpi ~]$ mpv -fs --vo=rpi video.mp4 
Playing: video.mp4
 (+) Video --vid=1 (*) (h264 1280x720 25.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
Using hardware decoding (mmal).
AO: [alsa] 48000Hz stereo 2ch float
VO: [rpi] 1280x720 mmal

Video plays smoothly. Sadly the error reported by blitzloop did not go away.

@marcan
Copy link
Owner

marcan commented Oct 30, 2020

Interesting. I'll take a look, but I'm quite busy right now and might not get to doing a full repro on a rPi in quite a while...

@jose1711
Copy link
Contributor Author

If you want: to speed things up I can make an image of the SD card (contains nothing but a fresh Arch Linux + blitzloop) and publish it somewhere.

@marcan
Copy link
Owner

marcan commented Oct 30, 2020

That might help, but I still probably won't get to it for a few weeks... I'm catching up on quick GitHub things but I'm a bit too swamped for a proper hardware device debugging session right now :(

@jose1711
Copy link
Contributor Author

Ok, putting my RPi on a shelf then. Feel free to ping me once you have some free cycles and I'll send it to you.

@cyph84
Copy link

cyph84 commented Oct 10, 2021

@jose1711 can you try building mpv-0.33.1 with this PR I sent to mpv? mpv-player/mpv#9097

@jose1711
Copy link
Contributor Author

jose1711 commented Nov 1, 2021

@cyph84 Please allow the following questions:

  • do I still need to build ffmpeg-mmal prior to recompilation instead of using regular ffmpeg and have mpv detect it during configuration?
  • is mpv supposed to recognize --vo=rpi?

@jose1711
Copy link
Contributor Author

jose1711 commented Nov 1, 2021

Following https://forums.raspberrypi.com/viewtopic.php?t=270226#p1692111 I was able to make it work finally. Extra steps taken in addition to what's mentioned in https://github.com/marcan/blitzloop/blob/master/docs/blitzberry.md:

  • Install ffmpeg-mmal from AUR
  • Download PKGBUILD of mpv-git from AUR and make the following modifications:
source=('git+https://github.com/cyph84/mpv#branch=fix-rpi-library-order'
..
        --enable-libmpv-shared --enable-rpi \
  • Build and install mpv-git. As a result mpv -vo help should list rpi - Raspberry Pi (MMAL) among supported outputs.
  • Create symbolic links in /opt/vc/lib:
cd /opt/vc/lib
sudo ln -s libbrcmEGL.so libEGL.so.1
sudo ln -s libbrcmGLESv2.so libGLESv2.so.2
  • Populate /boot/config.txt:
dtparam=audio=on
gpu_mem=384
initramfs initramfs-linux.img followkernel
  • Edit /home/alarm/startblitz.sh:
#!/bin/sh
export LD_LIBRARY_PATH=/opt/vc/lib
cd "$(dirname "$0")"
amixer cset numid=3 2
python -u /usr/bin/blitzloop --port=80 --no-audioengine --mpv-ao=alsa

This makes blitzloop work on an updated Arch Linux. What I left untested is microphone and jackd config.

@cyph84
Copy link

cyph84 commented Nov 2, 2021

@cyph84 Please allow the following questions:

* do I still need to build `ffmpeg-mmal` prior to recompilation instead of using regular `ffmpeg` and have `mpv` detect it during configuration?

You can build against regular ffmpeg, but you need ffmpeg-mmal installed to use --hwdec=mmal

* is `mpv` supposed to recognize `--vo=rpi`?

I think its best you explicitly specify the vo

@jose1711
Copy link
Contributor Author

jose1711 commented Nov 7, 2021

Btw compiling latest mpv-git still results in [vo/rpi] Could not get DISPMANX objects. so mpv-player/mpv#9097 is indeed required.

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