# Can we now use SDL2 without X11?

**URL:** <https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421>\
**Category:** SDL Development\
**Created:** [November 17, 2017, 3:12pm UTC](https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421 "2017-11-17T15:12:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlBo](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@AlBo](https://discourse.libsdl.org/u/AlBo)\
**Post date:** [November 17, 2017, 3:12pm UTC](https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421/1 "2017-11-17T15:12:30Z")

</div>

Hello,

I’ve read [this post](https://discourse.libsdl.org/t/problems-using-sdl2-on-raspberry-pi-without-x11-running/22621/29) 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.

---

<div class="post-metadata">

**Author:** ![ChliHug](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/chlihug/32/2863_2.png) [@ChliHug](https://discourse.libsdl.org/u/ChliHug)\
**Post date:** [November 18, 2017, 1:41pm UTC](https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421/2 "2017-11-18T13:41:11Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![AlBo](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@AlBo](https://discourse.libsdl.org/u/AlBo)\
**Post date:** [November 22, 2017, 7:47am UTC](https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421/3 "2017-11-22T07:47:30Z")

</div>

Ok good, many thanks

Alain

---

<div class="post-metadata">

**Author:** ![rdp1974](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/rdp1974/32/3130_2.png) [@rdp1974](https://discourse.libsdl.org/u/rdp1974)\
**Post date:** [November 25, 2017, 1:11pm UTC](https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421/4 "2017-11-25T13:11:24Z")

</div>

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](mailto:rdp@dellapasqua.com) if you prefer

---

<div class="post-metadata">

**Author:** ![it-elektronika](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/i/f04885/32.png) [@it-elektronika](https://discourse.libsdl.org/u/it-elektronika)\
**Post date:** [July 18, 2018, 9:26am UTC](https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421/5 "2018-07-18T09:26:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![indro](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/i/4da419/32.png) [@indro](https://discourse.libsdl.org/u/indro)\
**Post date:** [July 21, 2018, 7:19am UTC](https://discourse.libsdl.org/t/can-we-now-use-sdl2-without-x11/23421/6 "2018-07-21T07:19:36Z")

</div>

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](https://forum.odroid.com/viewtopic.php?f=95&t=31431)
