Use vivante GPU on IMX6 with 4.14 kernel

走远了吗. 提交于 2019-12-18 18:32:03

问题


I am working on IMX6QP with yocto rocko / Linux 4.14.24 and I am trying to use the GPU.

My yocto configuration file :

MACHINE ??= 'imx6qp-tx6-emmc'
DL_DIR ?= "${BSPDIR}/downloads"
SSTATE_DIR ?= "${BSPDIR}/sstate-cache"
DISTRO ?= 'karo-minimal'
PACKAGE_CLASSES ?= "package_deb"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
VIRTUAL-RUNTIME_init_manager = "sysvinit"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    ABORT,${TMPDIR},100M,1K \
    ABORT,${DL_DIR},100M,1K \
    ABORT,${SSTATE_DIR},100M,1K \
    ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
CONF_VERSION = "1"
# EXTRA_IMAGE_FEATURES += "read-only-rootfs"

CORE_IMAGE_EXTRA_INSTALL += "openssh \
                 openssh-sftp-server iproute2 dnsmasq iperf3 \
                 v4l-utils curl vim gnutls alsa-utils iw \
                 usbutils pciutils i2c-tools can-utils libsocketcan wpa-supplicant \
                 gstreamer1.0 gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base \
                 devmem2 iputils modutils-initscripts \
                 iptables iproute2-ss iproute2-tc bridge-utils hostapd \
                 ruby gdb \
                 qtbase-plugins \
                 qtbase-tools \
                 qtdeclarative \
                 qtdeclarative-tools \
                 qtdeclarative-qmlplugins \
                 qtmultimedia \
                 qtmultimedia-plugins \
                 qtmultimedia-qmlplugins \
                 qtsvg \
                 qtsvg-plugins \
                 qtsensors \
                 qtimageformats-plugins \
                 qtsystems \
                 qtsystems-tools \
                 qtsystems-qmlplugins \
                 qtscript \
                 qt3d \
                 qt3d-qmlplugins \
                 qt3d-tools \
                 qtgraphicaleffects-qmlplugins \
                 qtconnectivity-qmlplugins \
                 qtlocation-plugins \
                 qtlocation-qmlplugins \
                 cinematicexperience \
                     fb-test fbgrab fbida fbset-modes \
                 es2gears \
                 "

DISTRO_FEATURES_remove = " x11 wayland "
PACKAGECONFIG_append_pn-qtbase = " gles2 eglfs "
DISTRO_FEATURES_append = " opengles2 egl opengl gles gbm dri eglfs gles2 "

BB_NUMBER_THREADS = "1"
LICENSE_FLAGS_WHITELIST = "commercial"

When I run es2gears or Qt5_CinematicExperience yocto displays this :

gbm: failed to open any driver (search paths /usr/lib/dri)
gbm: Last dlopen error: /usr/lib/dri/etnaviv_dri.so: cannot open shared object file: No such file or directory
failed to load driver: etnaviv
gbm: failed to open any driver (search paths /usr/lib/dri)
gbm: Last dlopen error: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory
failed to load driver: kms_swrast
Unable to create EGL surface (eglError: 12299)

In the /usr/lib/dri folder there is only : swrast_dri.so

How can use the vivante GPU with this kernel? Is it possible? Where can I find the etnaviv driver without include meta-freescale layer?

The goal will be to run a Qt5 application that use eglfs.

In the file meta-karo/conf/machine/include/tx-base.inc :

PREFERRED_PROVIDER_virtual/egl ?= "mesa"
PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa"
PREFERRED_PROVIDER_virtual/libgles2 ?= "mesa"
PREFERRED_PROVIDER_virtual/libgl ?= "mesa"
PREFERRED_PROVIDER_virtual/libg2d_mx6 ?= "mesa"
PREFERRED_PROVIDER_virtual/libg2d_mx6ul ?= ""

I added : CORE_IMAGE_INSTALL += "imx-gpu-viv"

in local.conf and the console displays :

ERROR: Nothing RPROVIDES 'imx-gpu-viv' (but /media/user/tx6qp-qt5-4.14/build/sources/poky/meta/recipes-core/images/core-image-minimal.bb RDEPENDS on or otherwise requires it)
imx-gpu-viv was skipped: PREFERRED_PROVIDER_virtual/libgles2 set to mesa, not imx-gpu-viv
NOTE: Runtime target 'imx-gpu-viv' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['imx-gpu-viv']
NOTE: Target 'core-image-minimal' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['core-image-minimal', 'imx-gpu-viv']
ERROR: Required build target 'core-image-minimal' has no buildable providers.
Missing or unbuildable dependency chain was: ['core-image-minimal', 'imx-gpu-viv']

And my kernel supports CONFIG_DRM_ETNAVIV

My board is a Karo board bought on this page.

Thanks in advance, rBeal


回答1:


I see you are using the KaRo TX6QP, too. I've managed to get eglfs with QT5 running on TX6DL/TX6S/TX6QP.

For the newer Kernels (e.g. mainline) you don't want the deprecated vivante-gpu-driver. Toss that out of your local.conf! You want (or need) the community-developed mesa-etnaviv driver for your Kernel and QP-Board.

Only three Steps are needed, since meta-karo already enabled mesa for all boards like you pasted from the meta-karo/conf/machine/include/tx-base.inc

1. Enable QT5-Mesa-Support

In your own meta-layer create the file recipes-qt5/qt5/qtbase_%.bbappend with the following content:

# mx6q = TX6Q/TX6QP, this is the important part!
PACKAGECONFIG_GL_mx6q = "gbm gles2 kms"  
# mx6dl = TX6DL/TX6S
PACKAGECONFIG_GL_mx6dl = "gbm gles2 kms"
PACKAGECONFIG_GL_mx6sx = "gles2"
PACKAGECONFIG_GL_mx6sl = "${@base_contains('DISTRO_FEATURES', 'x11', ' gl', ' ', d)}"
PACKAGECONFIG_GL_mx6ul = "${@base_contains('DISTRO_FEATURES', 'x11', ' gl', ' ', d)}"
PACKAGECONFIG_GL_mx7 = "gles2"
QT_CONFIG_FLAGS_append_mx6q = "${@base_contains('DISTRO_FEATURES', 'x11', ' -no-eglfs', ' -eglfs', d)}"
QT_CONFIG_FLAGS_append_mx6dl = "${@base_contains('DISTRO_FEATURES', 'x11', ' -no-eglfs', ' -eglfs', d)}"
QT_CONFIG_FLAGS_append_mx6sx = "${@base_contains('DISTRO_FEATURES', 'x11', ' -no-eglfs', ' -eglfs', d)}"
QT_CONFIG_FLAGS_append_mx6sl = "${@base_contains('DISTRO_FEATURES', 'x11', ' -no-eglfs',  ' -no-opengl -linuxfb -no-eglfs -opengl es2 -no-xcb', d)}"
QT_CONFIG_FLAGS_append_mx6ul = "${@base_contains('DISTRO_FEATURES', 'x11', ' -no-eglfs',  ' -no-opengl -no-eglfs -linuxfb', d)}"
QT_CONFIG_FLAGS_append_mx7 = "${@base_contains('DISTRO_FEATURES', 'x11', ' -no-eglfs', ' -no-eglfs -linuxfb', d)}"

This .bbappend enables the neccessary QT5-Options for the TX6{Q,QP,DL,S,UL,ULL}. Now QT5 builds its eglfs-platform with the gdm module which is needed for the mesa-etnaviv .

2. Enable gallium and etnaviv in mesa

Again, in your own layer, create the file recipes-graphics/mesa/mesa_17.1.7.bbappend. But check if 17.1.7 is your version of mesa, too! To check your mesa-version search for the mesa-recipe in poky/meta/recipes-graphics/mesa/mesa_[...].bb!

In your .bbappend, paste the following:

# FIXME: mesa should support 'x11-no-tls' option
python () {
    overrides = d.getVar("OVERRIDES", True).split(":")
    if "imxgpu2d" not in overrides:
        return

    x11flag = d.getVarFlag("PACKAGECONFIG", "x11", False)
    d.setVarFlag("PACKAGECONFIG", "x11", x11flag.replace("--enable-glx-tls", "--enable-glx"))
}

# Enable Etnaviv support
PACKAGECONFIG_append = " gallium"
GALLIUMDRIVERS_append = ",etnaviv,imx"

The last two lines are the most important: Enabling gallium and its imx-etnaviv module.

Now you are ready to go and bake your own image with QT5-Etnaviv-Support!

3. Start your application right!

Both .bbappends don't patch the qt5-qmake to enable the right platform out of the box.

./yourapplication -platform eglfs

Now your application should do the trick and happily run with egl. However, it could happen, that your QT5 wants to use a different eglfs-deviceintegration. You can check that by running

export QT_LOGGING_RULES="qt.qpa.*=true"
./yourapplication -platform eglfs

When QT complains that it doesn't support emulated egl or complaints that it fails to load eglfs_viv or eglfs_emu or eglfs_* try to force it to the right deviceintegration (gbm) with

export QT_QPA_EGLFS_INTEGRATION=eglfs_gbm
./yourapplication -platform eglfs



回答2:


That depend on your yocto bsp provider, please check preferred_provider_virtual/libgl/egl ="mesa/imx-gpu-viv".
I think at present only some yocto bsps are provuiding etna viv dri. like phytec yocto BSP etc, if you want to add etnaviv_dri.so
1. First check your your yocto bsp is providig mesa(etnaviv) drm and imx-drm 2. Is your kernel support etna viv driver(drivers/gpu/etna/*) .

mention your board to know more



来源:https://stackoverflow.com/questions/53041843/use-vivante-gpu-on-imx6-with-4-14-kernel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!