在具有4.14内核的IMX6上使用vivante GPU

时间:2018-10-29 08:55:01

标签: kernel gpu imx6

我正在使用yocto rocko / Linux 4.14.24开发IMX6QP,并且正在尝试使用GPU。

我的yocto配置文件:

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"

当我运行es2gears或Qt5_CinematicExperience时,yocto会显示以下内容:

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)

在/ usr / lib / dri文件夹中只有:swrast_dri.so

如何在该内核上使用vivante GPU?可能吗? 在哪里可以找到不包含meta-freescale层的etnaviv驱动程序?

目标是运行使用eglfs的Qt5应用程序。

在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 ?= ""

我添加了:     CORE_IMAGE_INSTALL + =“ imx-gpu-viv”

在local.conf中,控制台显示:

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']

我的内核支持CONFIG_DRM_ETNAVIV

我的板子是在this page上购买的Karo板子。

预先感谢, rBeal

2 个答案:

答案 0 :(得分:3)

我看到您也在使用KaRo TX6QP。我设法在运行QT5的情况下获得了eglfs TX6DL / TX6S / TX6QP。

对于较新的内核(例如主线),您不希望使用不推荐使用的vivante-gpu驱动程序。从您的local.conf中丢掉它!您需要(或需要)用于内核和QP板的社区开发的mesa-etnaviv驱动程序。

仅需三个步骤,因为meta-karo已经为mesa上粘贴的所有板子启用了meta-karo/conf/machine/include/tx-base.inc

1。启用QT5-Mesa支持

在您自己的元层中,创建具有以下内容的文件recipes-qt5/qt5/qtbase_%.bbappend

# 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)}"

此.bbappend启用TX6 {Q,QP,DL,S,UL,ULL}的必要QT5-Options。 现在,QT5使用gdm所需的mesa-etnaviv模块构建其eglfs平台。

2。在台面中启用镓和etnaviv

同样,在您自己的层中创建文件recipes-graphics/mesa/mesa_17.1.7.bbappend但是还要检查17.1.7是否也是您的mesa版本!要检查您的mesa版本,请在poky/meta/recipes-graphics/mesa/mesa_[...].bb中搜索mesa食谱!

在.bbappend中,粘贴以下内容:

# 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"

最后两行是最重要的:启用gallium及其imx-etnaviv模块。

现在您可以使用QT5-Etnaviv-Support来烘烤自己的图像了!

3。立即启动您的应用程序!

两个.bbappends都不会修补qt5-qmake来启用正确的平台。

./yourapplication -platform eglfs

现在,您的应用程序应该可以解决问题并愉快地与egl一起运行。但是,您的QT5可能希望使用不同的eglfs-deviceintegration。您可以通过运行

进行检查
export QT_LOGGING_RULES="qt.qpa.*=true"
./yourapplication -platform eglfs

当QT抱怨它不支持仿真的egl或抱怨它无法加载eglfs_viv或eglfs_emu或eglfs_ *时,请尝试通过以下方式将其强制为正确的设备集成(gbm)

export QT_QPA_EGLFS_INTEGRATION=eglfs_gbm
./yourapplication -platform eglfs

答案 1 :(得分:0)

这取决于您的yocto bsp提供程序,请检查preferred_provider_virtual/libgl/egl ="mesa/imx-gpu-viv"
我认为目前只有yocto bsps提供了etna viv dri。如phytec yocto BSP等,如果要添加etnaviv_dri.so
1.首先检查您的yocto bsp是否为providig mesa(etnaviv)drm和imx-drm 2.您的内核是否支持etna viv驱动程序(drivers/gpu/etna/*)

提及您的董事会以了解更多信息