Hi I run a headless Slackware 14.2 box and I wanted to develop a program in C using SDL 1.2. I don’t want to use X11. So I took a look at the available modules for video and ended up using svgalib. Now I understand that I need to be using one of the console ttys(tty1-6) to be able to see graphics instead of being logged in via ssh on a ptty. In any case I compiled sdl 1.2 with svga support. I also set the env var SDL_VIDEODRIVER to svgalib.
I’m just learning SDL and have some questions.
- Do any video modules in SDL 2 work in console or does it require X11?
- I created a basic program that called SDL_GetVideoInfo() and SDL_VideoDriverName() but both return NULL. I don’t get an error upon SDL_Init(). Feels like SDL isn’t able to initialize video yet I don’t get any errors. Perhaps svgalib module isn’t compatible with my OS, however it is listed in the output of lsmod.
So I see now that the issue is “No available video device” after running SDL_Init(SDL_INIT_VIDEO). I have svgalib module loaded and env var SDL_VIDEODRIVER=svgalib and I still get this error. I did make sure that svgalib support was enabled in the ./configure line for SDL 1.2.
Perhaps you have a better suggestion? I am interested in writing a program in C that interacts with postfix and dovecot but with cool graphics to make it fun.
What I would love is to utilize SDL preferably SDL 2 outside of X server in Linux. Either using svgalib, directfb, framebuffer, or whatever will work. On Slackware 14.2 I didn’t see a directfb linux module but I can install the software if that’s the preferred route.
I understand that in order for SDL to output graphics onto the screen I need to be using a console terminal(tty1 - tty6). If this isn’t a strict requirement then I would rather ssh from another computer and use a ptty since I currently have this box configured for a headless setup.
- Does SDL 2 have proper support for graphics outside of X?
- Which kernel video module is preferred in terms of having the best support and is actively maintained?
- Do I have to be within a console tty to have SDL output graphics onto the screen or can I be logged in via ssh and use a ptty?
Ok so based on what I’ve read kmsdrm is the way to go. I installed libgbm and libdrm. I then compiled SDL2 with video_kmsdrm enabled. So here is where I’m stuck. Which video driver do I use? Where do I go from here? I’ve read that SDL2 has a kmsdrm video driver but where can I download the src to compile a module?
As far as hardware I just have onboard graphics with the i915 chipset.
Ok I got it working. I just needed to set SDL_VIDEODRIVER=kmsdrm.
I also see now that you do need to be on a console tty instead of a ptty or psuedo terminal. If I login via ssh and run the program the graphics actually output to the console tty instead of the ptty. That’s a shame cause it defeats the whole purpose of a headless box but I suppose it does make sense. Can’t have accelerated graphics go over a ssh connection. Although it would be cool to develop something to make that work using compression.
But I’m excited I got it working and with SDL2 at that. Time to start learning.