Sdl2 not working without x11 mode in odroid


#1

Even though the chunk of code compiles & runs perfectly in my ubuntu 18.04v GUI mode in odroid XU4 but when I try to run the same code in TERMINAL mode( alt + ctrl + F2) it is showing this

XDG_RUNTIME_DIR NOT SET IN THE ENVIRONMENT

“Failed to initialize SDLSDL: No available video device”

Any Help??


#2

You’re trying to initialize the video portion of SDL where there is no video capabilities. You can either remove SDL_INIT_VIDEO, or you’ll need to change SDL_INIT_EVERYTHING to the initialization flags but without SDL_INIT_VIDEO.


#3

well there is , SDL is working fine in the GUI mode , but as soon as I run the code in terminal mode , it gives error. If my system didn’t had the video displaying capabilities , why it would have run perfectly in the first scenario itself ??

why would i do that, I am using SDL for that specific purpose only, to render onto the screen.


#4

Terminal mode does not have a GUI at all. When you’re using a desktop manager, (Cinnamon, MATE, KDE, GNOME, Unity, etc.), either X11, mir, or wayland is running in the background allowing graphics to be used. When you switch to the terminal, you’re leaving the graphics portion completely. You’re basically saying, “Why can’t I watch a video on my book?” Since you’re only using SDL for video, you don’t need it then; and can ignore the error, but you won’t be able to use any SDL calls to any of the video routines either.


#5

so you are implying through terminal mode by anyhow i wont be able to make calls to sdl_init_video


#6

Some programs can still use the frame buffer in the terminal, without any X or Wayland.


#7

Indeed there is, did not know that. I thought the framebuffer was just another renderer like wayland or mir. A bit of work to get it on the screen though: How can I customize a full-screen console background (TTY)?

Definitely beyond me for now. Good luck though.


#8

From looking at this thread, it seems that only SDL 1.2 supports that: https://forums.libsdl.org/viewtopic.php?t=9661


#9

Found what I was looking for: Is anyone using DirectFB?
It’ll probably work the same as any normal program, but will work in the terminal. You’ll need to reconfigure your cmake to enable the framebuffer option, VIDEO_DIRECTFB, then recompile your SDL2 library.


#10

do i need to install DIRECTFB , before enabling the the option??


#11


after using directfb its the new error !!


#12

yup , now it works by compiling SDL2 with KMSDRM support !!!