SDL2 GUI app on debian minimal without OS window manager(no X)?

I have a small python3 and PySDL2 application that needs to run on a GUI-less debian linux. This is an embedded project running on a Libre Computer Board AML-S905X-CC. I have a monitor connected to the HDMI output of the Libre computer and I can see the console so the video driver works. Albeit I have no idea which video driver it is. I want to run my SDL app in full screen in this GUI-less OS. The desktop environment costs too much performance and is entirely unnecessary for my use case.

I have found someone else who has been able to achieve this a while back and the process seems familiar albeit when I try to run my app, all I see are the print results: Possible to run SDL2 headless?

The code is pretty simple:

import sys
import os
import sdl2.ext

os.putenv("SDL_VIDEODRIVER","dummy")
RESOURCES = sdl2.ext.Resources(__file__, "resources")

print("start")

sdl2.ext.init()

window = sdl2.ext.Window("Hello World!",size=(720,480), flags=sdl2.SDL_WINDOW_HIDDEN)
window.show()

while True:
     continue

The application does run, however it just stays on the console screen.

As far as I know if there is no driver, linux just writes to the framebuffer directly. So if I can set up PySDL2 to do that, and show the application in full screen, that’s all I am looking for.

Last note is that I know this is definetely possible because this is something I managed to achieve once before, about a year ago. However, due to a drive crash, that example has been lost.

The "dummy" driver is dummy - it doesn’t render anything it’s acts as no-op.
You can write to framebuffer with "directfb", or use KMS with "kmsdrm".

Aah ok that makes sense. dummy is to spoof SDL to not complain about not having a video driver. I suppose this would be useful for headless applications with no monitor.

So in that case this leads me down the rabbit hole I recall struggling with last time but this time I’d like to figure it out please. I’d appreciate your help.

  1. How do I check if directfb or kmsdrm are already installed on the system?

Since you have mentioned framefb and kmsdrm, I would ideally like to learn how to set up using either of these. I’m also hoping to document this process once I figure it out.

  1. How do I install direcfb and set it to be used by the system so LibSDL can recognize it?

I’m looking at the git page for directfb: GitHub - deniskropp/DirectFB: Official DirectFB GitHub Repository
It seems there are some implicit abbreviations in the installation process, so I think the user is expected to know how to make/build and configure the directFB. Would you be able to help with a more thorough step by step instruction on how to build this, please?

I have seen a number of posts where folks have asked about this but it either never led to anything or they figured it out without documenting the resolution. I’m hoping we could figure it out and this post would serve as a public record for an entry level devs on how to do it.

Appreciate the help.

Here’s my attempt to figure it out myself, based on very vague recollection of how to build something over year ago:

I clone the repo
git clone https://github.com/deniskropp/DirectFB.git

I then navigate into the folder of he repo:
cd DirectFB

then the instruction says to do

./configure <options>
make
make install (as superuser)

well when I run the first line, it’s meant to be provided with some parameters, and there’s a handy command to get the list of all parameters ./configure --help

but when I run it, I get:

-bash: ./configure: No such file or directory

EDIT 1:

Ok I found a post that outlined the lack of installation instructions and showed what needs to be done: confusing install procedure · Issue #5 · deniskropp/DirectFB · GitHub
It says I need to run the ./autogen.sh file that would supposedly do everything to set up but then I encounter en error:

 *** DirectFB compilation requires fluxcomp ***

Unless you are compiling from a distributed tarball you need fluxcomp
available from git://git.directfb.org/git/directfb/core/flux installed
in your PATH.

Ok, fair enough so I need this supplementary library then. Only I had to download it from:

because the original link is no longer valid.

I clone the repo, enter the folder, run ./autogen.sh and I’m met with:

root@debian-12-aml-s905x-cc:~# cd flux
root@debian-12-aml-s905x-cc:~/flux# ./autogen.sh
WARNING: You have called autogen.sh, use autoreconf -fi instead, I will do it for you this time :)
autoreconf: warning: autoconf input should be named 'configure.ac', not 'configure.in'
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.in,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:41: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.
./lib/autoconf/general.m4:2434: AC_DIAGNOSE is expanded from...
aclocal.m4:9517: AM_INIT_AUTOMAKE is expanded from...
configure.in:41: the top level
configure.in:42: warning: 'AM_CONFIG_HEADER': this macro is obsolete.
configure.in:42: You should use the 'AC_CONFIG_HEADERS' macro instead.
./lib/autoconf/general.m4:2434: AC_DIAGNOSE is expanded from...
aclocal.m4:9869: AM_CONFIG_HEADER is expanded from...
configure.in:42: the top level
configure.in:45: warning: The macro `AM_PROG_LIBTOOL' is obsolete.
configure.in:45: You should run autoupdate.
aclocal.m4:123: AM_PROG_LIBTOOL is expanded from...
configure.in:45: the top level
configure.in:47: warning: The macro `AC_ISC_POSIX' is obsolete.
configure.in:47: You should run autoupdate.
./lib/autoconf/specific.m4:550: AC_ISC_POSIX is expanded from...
configure.in:47: the top level
configure.in:48: warning: 'AM_PROG_CC_STDC': this macro is obsolete.
configure.in:48: You should simply use the 'AC_PROG_CC' macro instead.
configure.in:48: Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
configure.in:48: but upon 'ac_cv_prog_cc_stdc'.
./lib/autoconf/general.m4:2434: AC_DIAGNOSE is expanded from...
aclocal.m4:9875: AM_PROG_CC_STDC is expanded from...
configure.in:48: the top level
configure.in:51: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.in:51: You should run autoupdate.
./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
configure.in:51: the top level
configure.in:64: warning: AC_OUTPUT should be used without arguments.
configure.in:64: You should run autoupdate.
autoheader: warning: autoconf input should be named 'configure.ac', not 'configure.in'
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:41: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.in:41: https://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.in:45: installing './compile'
configure.in:41: installing './missing'
src/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/Makefile.am: installing './depcomp'
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
root@debian-12-aml-s905x-cc:~/flux#

I even added flux folder to the PATHS via
export PATH=“/flux:$PATH”

and going back to directfb, I still get the same warning that flux is not installed

Basically every Linux machine has framebuffer if it wasn’t disabled explicitly, same for KMS/DRM.

The framebuffer is Linux kernel feature, no further configuration required.

That’s just a some library for framebuffer operations. You don’t need it for SDL rendering.

You should set SDL_VIDEODRIVER environment variable to specify a desired driver. For framebuffer the vaule is directfb. Note that framebuffer access requires some privileges which are typically managed by udev… Or you can run the program as root (but I don’t recommend to).