Use vivante GPU on IMX6 with 4.14 kernel

社会主义新天地 提交于 2019-12-03 21:25:00

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

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

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