SDL2 with kms/drm driver on arm

Hello,
I use Yocto to build my system on stm32mp1, I don’t sure if SDL is rigth configureated so I donwload zip from web and try build.
I configure with kmsdrm ability:
./configure --enable-video-kmsdrm --disable-video-x11

I have kms/drm driver for sure but I don’t know why SDL2 didn’t see it:

checking for sndio audio support... no
checking samplerate.h usability... no
checking samplerate.h presence... no
checking for samplerate.h... no
checking for RPI... no
checking for Raspberry Pi... no
checking for LIBDRM... no  <-----------------------this one
checking for LIBGBM... yes
checking for OpenGL (GLX) support... no
checking for EGL support... no
checking for OpenGL ES v1 headers... no
checking for OpenGL ES v2 headers... yes
checking for Wayland support... no

root@stm32mp1-disco:~# ls /usr/lib/libdrm*
/usr/lib/libdrm.so.2	  /usr/lib/libdrm_etnaviv.so.1	    /usr/lib/libdrm_freedreno.so.1	
/usr/lib/libdrm_intel.so.1 /usr/lib/libdrm.so.2.4.0  /usr/lib/libdrm_etnaviv.so.1.0.0  
/usr/lib/libdrm_freedreno.so.1.0.0	/usr/lib/libdrm_intel.so.1.0.0

root@stm32mp1-disco:~# ls /dev/dri/
by-path  card0

Additionally I ran kmscube application that run opengl with kms and drm and it’s ok.

How can I check why SDL didn’t see kms/drm?

My code with SDL initialization:

SDL_Init(SDL_INIT_VIDEO);

window = SDL_CreateWindow("Hello World", SDL_WINDOWPOS_UNDEFINED,
        			SDL_WINDOWPOS_UNDEFINED, 1920, 1080,
        			SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL);

if (window == NULL) {
printf("sdl error %s", SDL_GetError());
}
windowsurface = SDL_GetWindowSurface(window);

Regards,
Adrian

I dont know anything about your platform, but to me it looks like you might be missing the development library for libdrm.

Often times there is two packages in your systems package manager. Here it would be something like libdrm that holds everything needed to run code, and libdrm-dev (or libdrm-devel or whatever its called on your system) that contains the stuff needed for software development.

On ubuntu you’d have to do something like sudo apt intstall libdrm-dev, or on void linux its sudo xbps-install libdrm-devel

Thanks for answer.

For now I try build it on ubuntu 16 amd ryzen 5.
I have libdrm-dev installed:
libdrm-dev is already the newest version (2.4.91-2~16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
After ./configure with --enable-video-kmsdrm option, In SDL_config.h I always have:

/* #undef SDL_VIDEO_DRIVER_KMSDRM */
/* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */
/* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM */

When I change X11 to enable or disable, it changes.

I found in config.log that I didn’t have libgbm, so now I have KMSDRM defined in SDL_config.h.

I will try add this configuration to yocto now and we will see.

@mkalte I finaly build SDL with kms/drm option added and SDL see it but I get information that driver is not avaiable, can you look at this ?

Testing video drivers...
x11 not available
wayland not available
KMSDRM not available

SDL_VIDEODRIVER available: 
0: x11
1: wayland
2: vivante
3: KMSDRM

SDL_VIDEODRIVER usable   : 
2: vivante 

[Apr 6 10:07] [drm:drm_stub_open] 
[  +0.000036] [drm:drm_open] pid = 2938, minor = 0
[  +0.000024] [drm:drm_open] 
[  +0.000866] [drm:drm_release] open_count = 1
[  +0.000021] [drm:drm_file_free.part.0] pid = 2938, device = 0xe200, open_count = 1
[  +0.000028] [drm:_drm_lease_revoke] revoke leases for 1563766f 0
[  +0.000014] [drm:drm_lease_destroy] drm_lease_destroy 0
[  +0.000010] [drm:drm_master_put] drm_lease_destroy done 0
[  +0.000014] [drm:drm_lastclose] 
[  +0.000010] [drm:drm_lastclose] driver lastclose completed
[  +0.000087] [drm:drm_stub_open] 
[  +0.000018] [drm:drm_open] pid = 2938, minor = 0
[  +0.000018] [drm:drm_open] 
[  +0.000686] [drm:drm_release] open_count = 1
[  +0.000018] [drm:drm_file_free.part.0] pid = 2938, device = 0xe200, open_count = 1
[  +0.000021] [drm:_drm_lease_revoke] revoke leases for 1563766f 0
[  +0.000012] [drm:drm_lease_destroy] drm_lease_destroy 0
[  +0.000010] [drm:drm_master_put] drm_lease_destroy done 0
[  +0.000013] [drm:drm_lastclose] 
[  +0.000010] [drm:drm_lastclose] driver lastclose completed

root@stm32mp1-disco:~# cat /sys/class/drm/card0-DSI-1/enabled 
enabled
root@stm32mp1-disco:~# cat /sys/class/drm/card0-DSI-1/status 
connected
root@stm32mp1-disco:~#