agherzan / meta-raspberrypi

Yocto/OE BSP layer for the Raspberry Pi boards
https://www.yoctoproject.org/
MIT License
505 stars 396 forks source link

GPU hardware acceleration on Rpi 4 with EGLFS #1281

Open kluszon opened 4 months ago

kluszon commented 4 months ago

Description

I build a 64-bit system based on "Kirksone" branch and I meet a problem with the GPU hardware acceleration on Raspberry 4/CM4. The problem occurs when playing video directly from GStreamer and QML using QMultimedia and also rendering Qt application GUI in QML (Configuration attached below). I tried also to build an image without Qt and based on a poky distro with GStreamer and core-image-base, but with a similar result.

Steps to reproduce the issue:

  1. Clone all sources listed in bblayers.conf up to date with "Kirksone" branch.
  2. Add gstreamer and ffmpeg to image config.
  3. Build image.
  4. Flash image to Rasberry.
  5. Try play video via gstreamer or from using Qt application and see high CPU usage.

Describe the results you received:

The high use of CPU during play video. Small number of frames.

Describe the results you expected:

HW acceleration during play Video and render application GUI. FFmpeg doesn't list and hw accelerator.

Additional details (revisions used, host distro, etc.):

Maybe I missed something or I doing something wrong. Any way I will be grateful for advice. Below attached bitbake configuratinos.

local.conf

MACHINE ??= "raspberrypi4-64"
DISTRO ?= "fsl-framebuffer"
DL_DIR ?= "${BSPDIR}/downloads"
SSTATE_DIR ?= "${TOPDIR}/../sstate-cache"
PACKAGE_CLASSES ?= "package_rpm"
SDKMACHINE = "x86_64"
EXTRA_IMAGE_FEATURES ?= " \
                        debug-tweaks \
                        tools-debug \
                        ssh-server-openssh \
                        "

USER_CLASSES ?= "buildstats"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    HALT,${TMPDIR},100M,1K \
    HALT,${DL_DIR},100M,1K \
    HALT,${SSTATE_DIR},100M,1K \
    HALT,/tmp,10M,1K"

DISTRO_FEATURES:remove = " x11 wayland vulkan directfb"
DISTRO_FEATURES:append = " alsa opengl"

PACKAGECONFIG:append:pn-qemu-system-native = " sdl"
CONF_VERSION = "2"

DISTRO_FEATURES:append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = ""

LICENSE_FLAGS_ACCEPTED = "commercial"

IMAGE_INSTALL:append = " \
                        tcf-agent \
                        openssh-sftp-server \
                        ldd \
                        boost \
                        cmake \
                        update-rc.d \
                        initscripts \
                        pigz \
                        pv \
                        hdparm \
                        tzdata \
                        tcpdump \
                        util-linux \
                        libb64 \
                        qtbase \
                        qtdeclarative \
                        qtquickcontrols \
                        qtquickcontrols2 \
                        qtgraphicaleffects \
                        qtmultimedia \
                        qtmultimedia-plugins \
                        qtmultimedia-qmlplugins \
                        v4l-utils \
                        userland \
                        ffmpeg"

PACKAGECONFIG:append:qtbase = " \
                        accessibility \
                        glib \
                        freetype \
                        fontconfig \
                        libs \
                        release \
                        gles2 \
                        eglfs \
                        openssl \
                        "

bblayers.conf

POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"
BBFILES ?= ""

BBLAYERS ?= " \
  /yocto_source/px749_kirkstone/sources/poky/meta \
  /yocto_source/px749_kirkstone/sources/poky/meta-poky \
  /yocto_source/px749_kirkstone/sources/poky/meta-yocto-bsp \
  /yocto_source/px749_kirkstone/sources/meta-openembedded/meta-oe \
  /yocto_source/px749_kirkstone/sources/meta-openembedded/meta-python \
  /yocto_source/px749_kirkstone/sources/meta-openembedded/meta-networking \
  /yocto_source/px749_kirkstone/sources/meta-openembedded/meta-multimedia \
  /yocto_source/px749_kirkstone/sources/meta-openembedded/meta-filesystems \
  /yocto_source/px749_kirkstone/sources/meta-openembedded/meta-gnome \
  /yocto_source/px749_kirkstone/sources/meta-freescale \
  /yocto_source/px749_kirkstone/sources/meta-freescale-distro \
  /yocto_source/px749_kirkstone/sources/meta-qt5 \
  /yocto_source/px749_kirkstone/sources/meta-raspberrypi \
  /yocto_source/px749_kirkstone/sources/meta-swupdate \
  "

fsl-image-rpi-qt5.bb

# Pulled from a mix of different images:

inherit core-image features_check populate_sdk_qt5
SUMMARY = "The minimal image that can run Qt5 applications"

LICENSE = "MIT"

CONFLICT_DISTRO_FEATURES = "directfb"

### I PART: GUI 

IMAGE_FEATURES += " \
    splash \
    package-management \
    ssh-server-dropbear \
    hwcodecs \
    debug-tweaks \
    nfs-server \
    tools-debug \
    eclipse-debug \
    tools-testapps \
"

CORE_IMAGE_EXTRA_INSTALL += " \
        packagegroup-core-full-cmdline \
        packagegroup-imx-tools-audio \
        packagegroup-fsl-tools-gpu-external \
        packagegroup-fsl-tools-testapps \
        packagegroup-fsl-tools-benchmark \
        packagegroup-fsl-gstreamer1.0 \
        packagegroup-fsl-gstreamer1.0-full \
        screen \
        tcf-agent \
        openssh-sftp-server \
"

### II PART: QT5

# Install fonts
QT5_FONTS = " \
    ttf-dejavu-mathtexgyre \
    ttf-dejavu-sans \
    ttf-dejavu-sans-condensed \
    ttf-dejavu-sans-mono \
    ttf-dejavu-serif \
    ttf-dejavu-serif-condensed \
"

# Install QT5 demo applications
QT5_IMAGE_INSTALL = " \
    ${QT5_FONTS} \
"

# uncomment the following line to add webengine support
# but remind to add also meta-python2 to the bblayere
#QT5_IMAGE_INSTALL_append = " packagegroup-qt5-webengine"

# uncomment the following line to add webkit support
# but remind that is considered obsolete since Qt 5.7
# QT5_IMAGE_INSTALL_append = " packagegroup-qt5-webkit"

IMAGE_INSTALL += " \
        ${QT5_IMAGE_INSTALL} \
        qtserialbus \
        qtquickcontrols-qmldesigner \
        qtquickcontrols-qmlplugins \
        qtquickcontrols2-qmldesigner \
        qtquickcontrols2-qmlplugins \
        qtdeclarative-tools \
"

IMAGE_FSTYPES:remove = "multiubi"
farias-automac commented 3 weeks ago

same here