cancel
Showing results for 
Search instead for 
Did you mean: 

KMSDRM with SDL2 kernel 6.6 scarthgap

Khaled-ELGHA
Associate III

Hello,

I was able to make the SDL2 library works with KMSDRM with kernel 5.15 Kirkston but with kernel 6.6 Scarthgap it doesn't work. I also configured the kmsdrm to work in the .bbappend file since I am using Yocto. I can see from the log.configure that the kmsdrm is on but the application which was working with 5.15 is still not able to run with 6.6. However, KMSCube is working means KMSDRM is working from the kernel point of view. The messages that I got when debug are below:

INFO: video driver in use is: (null)
INFO: video driver 0: wayland
INFO: video driver 1: KMSDRM
INFO: video driver 2: (null)
INFO: video driver 3: (null)
INFO: Failed to initialize SDL: No available video device

 

Even if I specify the driver to be kmdrm I see the following

INFO: video driver in use is: (null)
INFO: video driver 0: wayland
INFO: video driver 1: KMSDRM
INFO: video driver 2: (null)
INFO: video driver 3: (null)
INFO: Failed to initialize SDL: kmsdrm not available

 

I don't know why it is still unavailable?

from the "log.do_configure" of Yocto I can see this:

-- SDL_KMSDRM (Wanted: ON): ON
-- SDL_KMSDRM_SHARED (Wanted: ON): ON

in the build folder of "libsdl2" I can see also this in the "CMakeCache.txt" file:

//Use KMS DRM video driver
SDL_KMSDRM:BOOL=ON

//Dynamically load KMS DRM support
SDL_KMSDRM_SHARED:BOOL=ON

 

I edited the bbappend by adding those two lines to switch the offscreen off and to make sure that the KMSDRM is working

EXTRA_OECMAKE += " \
-DSDL_VIVANTE=OFF \
-DSDL_OPENGL=OFF \
-DSDL_KMSDRM=ON \
-DSDL_OFFSCREEN=OFF \
"

What else can I do? any suggestions?
Thanks in advance

11 REPLIES 11

Hello @RMO ,
This is a pure Yocto question, but please let's find below an example.
I made a recipe called lvgl-demo.bb. As I want it installed by my st-image-core compilation, I add it into the IMAGE_INSTALL list of my st-image-core via a bbappend on it.

Then the recipe looks like (you will find the command you search here):

SUMMARY = "LVGL-demo"
DESCRIPTION = "LVGL basic demo"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f"

# Remote project as source
SRC_URI = "gitsm://github.com/lvgl/lv_port_pc_eclipse.git;protocol=https;branch=master \
    file://0001-Update-lv_conf-to-use-SDL_DRAW.patch \
    file://lvgl_init \
"

SRCREV = "ba45efb68b125aa93237e7c75c51d4cd65fc10cf"

S = "${WORKDIR}/git"

DEPENDS += " cmake libsdl2 kmscube libsdl2-image "

inherit pkgconfig cmake

EXTRA_OECMAKE = "-DLV_USE_DRAW_SDL=ON \
"

# Install rule to get everything needed for the application
do_install(){
    # install the main application in /home/root folder
    install -d          ${D}/home/root
    install -m 0777     ${S}/bin/main                           ${D}/home/root

    # create missing symbolic link to GPU libraries
    install -d          ${D}/usr/lib
    ln -s -r            ${D}/vendor/lib/libgbm.so.1.0.0         ${D}/usr/lib/libgbm.so.1.0.0   
    ln -s -r            ${D}/vendor/lib/libGAL.so               ${D}/usr/lib/libGAL.so

    # install starting script in Startup level (sysvinit rcS), at a strategic place
    install -d 644      ${D}${sysconfdir}/init.d
    install -d 644      ${D}${sysconfdir}/rcS.d
    install -m 0777     ${WORKDIR}/lvgl_init                     ${D}${sysconfdir}/init.d/lvgl_init
    ln -s -r            ${D}${sysconfdir}/init.d/lvgl_init      ${D}${sysconfdir}/rcS.d/S03lvgl_init

}

FILES:${PN} += "\
    /home/root \
    ${sysconfdir}/init.d \
    /usr/lib \
"

RDEPENDS:${PN} += " libsdl2 kmscube libsdl2-image "

I hope it will help you,
Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @RMO 

Note: this is for scarthgap image kernel 6.6 latest by stm32 yocto layers

in your custom layer create this file "libsdl2_%.bbappend" in this directory:
projects-scarthgap/layers/meta-st/your_custom_layer/recipes-graphics/libsdl2

 

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

PACKAGECONFIG_GL = ""

PACKAGECONFIG ??= " \
    ${PACKAGECONFIG_GL} \
    ${@bb.utils.filter('DISTRO_FEATURES', 'alsa pipewire pulseaudio vulkan', d)} \
    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland gles2', '', d)} \
    ${@bb.utils.contains("TUNE_FEATURES", "neon","arm-neon","",d)} \
    kmsdrm \
    gles2 \
"
EXTRA_OECMAKE += " \
        -DSDL_VIVANTE=OFF \
        -DSDL_OPENGL=OFF \
        -DSDL_KMSDRM=ON \
        -DSDL_OFFSCREEN=OFF \
        -DSDL_OPENGLES=ON \
"

do_install:append() {
    ln -s -r ${D}/vendor/lib/libgbm.so.1.0.0 ${D}/usr/lib/libgbm.so.1.0.0
}

# Make sure that libgbm is built before applying this install 
do_install[depends] += "virtual/libgl:do_populate_sysroot"

 

If you don't have a custom layer, you can find the file "libsdl2_2.30.1.bbappend" in the following directory:
layers/meta-st/meta-st-openstlinux/recipes-graphics/libsdl2

make a backup copy of that file and move it out of the layer and and continue editing on the original copy and add the missing parts in the right places as provided in the previous file

Hope it will work for you!

 

Kind regards,

Khaled