[SDL] Failed to open vchiq device on RPi

Eric Wing ewmailing at gmail.com
Sun Sep 11 15:46:18 PDT 2016

On 9/11/16, Andreas Falkenhahn <andreas at falkenhahn.com> wrote:
> I've looked into this now and the problem is that this call in SDL_egl.c
> returns NULL:
>     _this->egl_data->egl_display =
> _this->egl_data->eglGetDisplay(native_display);
> I've then examined further and found out that SDL2 was actually using the
> X11 video driver. I'd have expected it to use the RPI driver instead. So
> I did the following:
>     SDL_VideoInit("RPI");
> Now it finally worked - well, sort of. There are still some issues:
> 1) The mouse cursor freezes and I can't move it. Also, keyboard doesn't
> seem to work. According to the docs, this should solve it:
>    sudo usermod -aG input pi
> But it didn't. Input doesn't seem to work at all and the mouse cursor is
> locked in the top left corner of the screen. Does anybody have an idea why
> this happens?

I mentioned during the SDL 2.0.4 release cycle I was seeing an
SDL_assert being thrown in the mouse system sometimes. In further
testing, it seems to happen to me when the system is loaded down and
cannot complete the event loop in a reasonable amount of time. If you
kill your process (i.e. remote login), maybe you'll see that this is
the same assertion being thrown prompting you to abort/ignore.

Unfortunately, as you've seen, SDL's Pi implementation goes directly
to the framebuffer and bypasses everything else. The keyboard input is
also affected by this which is why you can't send a response to the
SDL_assert. (The easiest workaround is to disable SDL_assert when
compiling it.)

> 2) What about the X11 driver? Is it supposed to work on the Pi or do
> I have to use the RPI driver on the Pi? As I said, using the X11 driver
> results in a "Failed to open vchiq device" error message.

When the SDL implementation was written, Pi only had a GLES driver and
the Pi could not support rendering through X11. (Apparently there is
some scary hack that Minecraft figured out which makes it kind of
work, but still is pretty wonky.)

> 3) I've noticed that the RPI driver always opens in full screen mode. Is
> it also possible to make this open in window mode?

Pi released a "beta" of a full blown OpenGL driver earlier this year.
It is still experimental. I have not tried it. One of its goals was to
allow applications run through the window server. Another of its goals
was to allow the vast amount of desktop OpenGL Linux software to run
on Pi without change.

If you install and enable this driver, and configure SDL
appropriately, maybe you can get this to work. I don't know what's
actually involved to make this work. I would like to hear your results
and the procedure for making this work.

One thing to keep in mind is it sounds like the OpenGL driver is much
more heavy weight than the ES driver. I've heard this number but not
verified: expect to consume 300MB of RAM which is a sizable chunk of
the 1GB you have.


More information about the SDL mailing list