Page 1 of 1

raspistill on RPI4 - failed to add service

Posted: Thu Apr 16, 2020 9:19 am
by lagurus
Hi all,
when is started following:

Code: Select all

raspistill --gl --glscene sobel
it return only

Code: Select all

* failed to add service - already in use?
Configuration: RPI 4 4GB running Raspbian Buster.

For older model (PI,PI2B,PI3B) it works.

Any chance to get it work again?
Thanks.

Re: raspistill on RPI4 - failed to add service

Posted: Thu Apr 16, 2020 2:56 pm
by 6by9
lagurus wrote:
Thu Apr 16, 2020 9:19 am
Any chance to get it work again?
Not without significant reworking.
The Pi4 has the next generation of the 3D core, and the firmware doesn't know how to drive it. You need to use the desktop Mesa GL stack instead of the firmware GLES driver.

Re: raspistill on RPI4 - failed to add service

Posted: Fri Apr 17, 2020 4:47 pm
by lagurus
Not without significant reworking.
The Pi4 has the next generation of the 3D core, and the firmware doesn't know how to drive it. You need to use the desktop Mesa GL stack instead of the firmware GLES driver.
Any chance to make it oneself?
Is enough to modify raspicam tree - e.g. files like RapiTex.c and RaspiTexUtil.h?
Or is needed to change also something deeper - e.g. in firmware?

Re: raspistill on RPI4 - failed to add service

Posted: Fri Apr 17, 2020 4:52 pm
by jamesh
lagurus wrote:
Fri Apr 17, 2020 4:47 pm
Not without significant reworking.
The Pi4 has the next generation of the 3D core, and the firmware doesn't know how to drive it. You need to use the desktop Mesa GL stack instead of the firmware GLES driver.
Any chance to make it oneself?
Is enough to modify raspicam tree - e.g. files like RapiTex.c and RaspiTexUtil.h?
Or is needed to change also something deeper - e.g. in firmware?
You would need to rework the raspicam code to use the Mesa GL stack instead of the current mechanism which uses the firmware 3D. I am no expert on this, I suspect it's feasible, but I have no idea how to do it. Probably not a huge amount of work for someone who is familiar with the Mesa, but not trivial.

Re: raspistill on RPI4 - failed to add service

Posted: Fri Jul 17, 2020 10:03 am
by lagurus
Resurrecting old post.

Finally I had time and tried to modify my code.
It seems that error message:

Code: Select all

* failed to add service - already in use?
is gone.

I am using Mesa GL. For creation is used DRM/GBM stuff (beacuse I am headless).
Also was needed to link program with GLESv2,EGL instead of brcmGLESv2,brcmEGL

Some functions are not defined in MESA EGL and need to be added dynamically using eglGetProcAddress e.g.:

eglCreateImageKHR
eglDestroyImageKHR
glEGLImageTargetTexture2DOES


But now receive EGL error 0x300c in function raspitexutil_do_update_texture during calling of
eglCreateImageKHR
. Error 0x300c = EGL_BAD_PARAMETER.

I have noticed that function eglCreateImageKHR was originally defined in egl_khr_image_client.c which I think is used when
is program linked against brcmEGL. But MESA EGL hasn't it defined it in such way and don't know anything about:

EGL_IMAGE_BRCM_MULTIMEDIA,EGL_IMAGE_BRCM_MULTIMEDIA_Y,EGL_IMAGE_BRCM_MULTIMEDIA_U,EGL_IMAGE_BRCM_MULTIMEDIA_V

Some tips how to solve this issue?
How to add support to PI4? I have used it on PI1/2/3 for fast image processing using shaders.

Thank you.

Re: raspistill on RPI4 - failed to add service

Posted: Wed Sep 09, 2020 9:02 pm
by bhjel
Same issue - I have swapped out dispmanX with X11 for the userland demos and I am linking the latest MESA openglES 3.1. Not sure how to address the following methods just yet:
eglCreateImageKHR
eglDestroyImageKHR
glEGLImageTargetTexture2DOES

There is progress with eglGetProcAddress(), but I'm not sure how to handle this EGL_IMAGE_BRCM_MULTIMEDIA dependency.

Re: raspistill on RPI4 - failed to add service

Posted: Thu Sep 10, 2020 8:04 am
by therealdavidp
I think I had something similar. I got round it by downloading, building and installing this: https://github.com/anholt/libepoxy

Disclaimer: I know nothing whatsoever about GL, EGL, OpenGL, OpenGLES, MESA.

Re: raspistill on RPI4 - failed to add service

Posted: Fri Sep 11, 2020 12:14 pm
by bhjel
Thank you - that gave me some clues.
I'm very close now - through the mmal api I am getting proper RGBA frames (judging by the contents of the buffer). glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES,...) continues to return error 1282, and I have a feeling that I am missing some context on what exactly isn't allowed with V3D / VC6. Which targets should I be using for createImageKHR, glEGLImageTargetTexture2DOES, etc? What preview port encoding should be used for this no-copy use-case?

Re: raspistill on RPI4 - failed to add service

Posted: Wed Sep 23, 2020 10:30 am
by charliebravo
Hello!

I found this thread after running into a dreaded "* failed to add service" message. It seems to me that no matter what I do (and I tried setting up brcmEGL with drm/gbm and separately with dispmanx), current version of brcmEGL fails on RPi 4.

I tried hard to make mesa EGL/GL work with MMAL buffers, but no dice. My impression is that eglCreateImageKHR in MESA libs simply doesn't "know" EGL_IMAGE_BRCM_MULTIMEDIA, for I am also getting 0x500c (or EGL_BAD_PARAMETER).

@bhjel - what you wrote suggests that you were able to get past eglCreateImageKHR error. How you did that? In my code I am basically following what raspistill does, and I keep getting 0x500c on eglCreateImageKHR.

Anybody knows how it is supposed to be solved? Is it possible for Broadcom features to be added to Mesa or do we have to wait for brcmEGL/GL supporting Pi4?