Can we now use SDL2 without X11?

Hello,

I’ve read this post but I heard talking that SDL2 could work without X11 started from 2.0.6. Is it right?

Can we now start a SDL2 application without X11 but with the same very good prformances as X11 using full KMS driver?

If yes, how to do that?

alain.

Yes. SDL 2.0.6 has an experimental KMSDRM video driver which directly gets a surface from the KMS driver. It will work without X11.

I’m assuming you are targeting the Raspberry Pi.

It’s not enabled by default (depending on the build system used) so you may have to build SDL yourself to get it. Consider disabling the SDL RPI video driver if you’re sure that it’s not going to be used. The KMSDRM and RPI drivers bite each other a bit, but this has been improved a little in a recent commit (after 2.0.7, I think).

Remember to install libgbm and its development packages as it is a dependency of the SDL KMSDRM video driver.

The option for configure is --enable-video-kmsdrm.

The CMake option is called VIDEO_KMSDRM. Interestingly, it’s enabled by default here.

Now that you have a SDL with the KMSDRM driver, check if you have vc4 enabled. The /dev/dri directory and /dev/dri/card0 file should exist and the vc4 kernel module should be loaded.

When an application loads your SDL library and initializes the video driver, it should automatically try the KMSDRM driver. You can specifically ask for it if you set the SDL_VIDEODRIVER environment variable to kmsdrm.

Ok good, many thanks

Alain

hello ChliHug,
I’m trying to have SDL2 without X11 in raspbian stretch latest on pi3.
Have done a try with RPI driver, and with the new you suggested KMSDRIVER, without success, I get error on INITVIDEO.
Perhaps can you help me to obtain a correct working kmsdriver on latest pi3?
thanks
plz catch me rdp@dellapasqua.com if you prefer

Any news on the subject? Did you manage to run SDL2 without X11 on RPi3?

recently I did managed to run SDL2 without x11 support but I tested it on odroid xu4.
here is the link->https://forum.odroid.com/viewtopic.php?f=95&t=31431