Allow easier use of mainline-based BSP on i.MX products
cover Allow easier use of mainline-based BSP on i.MX products
It has been always a pain to enable full mainline support for i.MX-based boards as the BSP layer had many specific overrides. We are now proposing a new machine override (use-mainline-bsp) to facilitate the process.
From now on, it is a matter of include:
MACHINEOVERRIDES .= ":use-mainline-bsp"
To the local.conf and everything (except virtual/kernel choice) is done automatically.
At O.S. Systems we were testing this using our Showcase demo with great success. There are still some corner cases to iron out but with this new implementation support all the testing and development will be easier from now on.
Otavio Salvador (5):
machine-overrides-extender.bbclass: Add filter out support imx-base.inc: Add 'use-mainline-bsp' override support
mesa: Enable Etnaviv support when using 'use-mainline-bsp' override
qtbase: Add 'use-mainline-bsp' support
linux-fslc: Bump recipe to 4a2e3a368083 revision
classes/machine-overrides-extender.bbclass | 29 ++++- conf/machine/include/imx-base.inc | 20 +++ ...-variable-enabling-the-workaround-FBO-rea.patch | 134 +++++++++++++++++++++ .../qt5-layer/recipes-qt/qt5/qtbase_%.bbappend | 7 +- recipes-graphics/mesa/mesa_%.bbappend | 4 + recipes-kernel/linux/linux-fslc_4.9.bb | 4 +- 6 files changed, 189 insertions(+), 9 deletions(-) create mode 100644 dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase/Environment-variable-enabling-the-workaround-FBO-rea.patch
Signature · 1 line
2.12.1
PATCH 2/5 imx-base.inc: Add 'use-mainline-bsp' override support
The 'use-mainline-bsp' makes use of MAACHINEOVERRIDES_EXTENDER_FILTER_OUT variable and currently filters out the i.MX 6 and i.MX 7 overrides, ensuring we use the pristine support for all metadata.
This commit does most changes related to initial mainline support for Etnaviv and Video4Linux VPU support using CODA.
---
conf/machine/include/imx-base.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
conf/machine/include/imx-base.inc +20 -0
@@ -60,6 +60,19 @@ MACHINEOVERRIDES_EXTENDER_mx6ul = "imxpxp" MACHINEOVERRIDES_EXTENDER_mx6ull = "imxpxp:imxepdc" MACHINEOVERRIDES_EXTENDER_mx7d = "imxpxp:imxepdc" +MACHINEOVERRIDES_EXTENDER_FILTER_OUT_use-mainline-bsp = " \ + mx6 \ + mx6q \ + mx6dl \ + mx6sx \ + mx6sl \ + mx6ul \ + mx6ull \ + \ + mx7 \ + mx7d \ +" + # Sub-architecture support MACHINE_SOCARCH_SUFFIX ?= "" MACHINE_SOCARCH_SUFFIX_mx6q = "-mx6qdl"
@@ -71,11 +84,16 @@ MACHINE_SOCARCH_SUFFIX_vf60 = "-vf60" MACHINE_SOCARCH_SUFFIX_vf50 = "-vf50" MACHINE_SOCARCH_SUFFIX_mx6ul = "-mx6ul" MACHINE_SOCARCH_SUFFIX_mx6ull = "-mx6ul" +MACHINE_SOCARCH_SUFFIX_use-mainline-bsp = "-imx" MACHINE_ARCH_FILTER = "virtual/kernel" MACHINE_SOCARCH_FILTER_append_imxvpu = " imx-vpu libimxvpuapi imx-codec imx-vpuwrap imx-parser" MACHINE_SOCARCH_FILTER_append_imxgpu2d = " virtual/libopenvg virtual/libgles1 virtual/libgles2 virtual/egl virtual/mesa virtual/libgl virtual/libg2d cairo pango" MACHINE_SOCARCH_FILTER_append_imxpxp = " imx-codec imx-parser" +MACHINE_SOCARCH_FILTER_append_use-mainline-bsp = " \ + qtbase \ + virtual/libopenvg virtual/libgles1 virtual/libgles2 virtual/egl virtual/mesa virtual/libgl virtual/libg2d cairo pango \ +" INHERIT += "fsl-dynamic-packagearch"
@@ -96,6 +114,7 @@ MACHINE_FIRMWARE_append_mx6sl = " firmware-imx-epdc" MACHINE_FIRMWARE_append_mx6ull = " firmware-imx-epdc" MACHINE_FIRMWARE_append_mx53 = " firmware-imx-vpu-imx53 firmware-imx-sdma-imx53" MACHINE_FIRMWARE_append_mx51 = " firmware-imx-vpu-imx51 firmware-imx-sdma-imx51" +MACHINE_FIRMWARE_append_use-mainline-bsp = " firmware-imx-vpu-imx6q firmware-imx-vpu-imx6d" # FIXME: Needs addition of firmware-imx of official BSPs #MACHINE_FIRMWARE_append_mx27 = " firmware-imx-vpu-imx27"
@@ -179,6 +198,7 @@ IMX_DEFAULT_KERNEL_mx6 = "linux-fslc-imx" IMX_DEFAULT_KERNEL_mx7 = "linux-fslc-imx" IMX_DEFAULT_KERNEL_mx6ul = "linux-fslc-imx" IMX_DEFAULT_KERNEL_mx6ull = "linux-fslc-imx" +IMX_DEFAULT_KERNEL_use-mainline-bsp = "linux-fslc" PREFERRED_PROVIDER_virtual/kernel ??= "${IMX_DEFAULT_KERNEL}"
Signature · 1 line
2.12.1
PATCH 3/5 mesa: Enable Etnaviv support when using 'use-mainline-bsp' override
In reply to Otavio SalvadorThis enables the Gallium backend and its Etnaviv driver.
---
recipes-graphics/mesa/mesa_%.bbappend | 4 ++++ 1 file changed, 4 insertions(+)
recipes-graphics/mesa/mesa_%.bbappend +4 -0
@@ -14,6 +14,10 @@ python () { d.setVar("EXTRA_OECONF", extra_oeconf) } +# Enable Etnaviv support +PACKAGECONFIG_append_use-mainline-bsp = " gallium" +GALLIUMDRIVERS_append_use-mainline-bsp = ",etnaviv,imx" + # FIXME: Dirty hack to allow use of Vivante GPU libGL binary do_install_append_imxgpu3d () { rm -f ${D}${libdir}/libGL.* \
Signature · 1 line
2.12.1
PATCH 4/5 qtbase: Add 'use-mainline-bsp' support
In reply to Otavio SalvadorThis configures the Qt to use the OpenGL ES2 and KMS backend for the 'use-mainline-bsp' case. It also includes a fix for the font rendering issue found when using Etnaviv which were used for Android-based platforms but now being enabled for all EGL based systems.
---
...-variable-enabling-the-workaround-FBO-rea.patch | 134 +++++++++++++++++++++ .../qt5-layer/recipes-qt/qt5/qtbase_%.bbappend | 7 +- 2 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase/Environment-variable-enabling-the-workaround-FBO-rea.patch
dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase/Environment-variable-enabling-the-workaround-FBO-rea.patch new file +134 -0
@@ -0,0 +1,134 @@ +From 068c13d7f561f3bd88facb14093cdc88fe1b50f2 Mon Sep 17 00:00:00 2001 +From: Marco Martin <[email protected]> +Date: Fri, 10 Feb 2017 15:00:23 +0100 +Subject: [PATCH] Environment variable enabling the workaround FBO readback bug +Organization: O.S. Systems Software LTDA. + +On some ARM devices the font glyph generation is broken +Add an environment variable to enable workaround_brokenFBOReadBack +in QOpenGLContext, to fix font rendering on such devices as +Mali and Adreno + +Change-Id: I9cc99ecb8b71a35bc369ec9dd11b877016b1179e +--- + src/gui/kernel/qopenglcontext.cpp | 34 ++++++++++++++++++++++ + .../android/qandroidplatformopenglcontext.cpp | 31 -------------------- + .../android/qandroidplatformopenglcontext.h | 1 - + 3 files changed, 34 insertions(+), 32 deletions(-) + +diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp +index 0f7bbfd2e1..2b0b1f7ff1 100644 +--- a/src/gui/kernel/qopenglcontext.cpp ++++ b/src/gui/kernel/qopenglcontext.cpp +@@ -951,6 +951,7 @@ GLuint QOpenGLContext::defaultFramebufferObject() const + bool QOpenGLContext::makeCurrent(QSurface *surface) + { + Q_D(QOpenGLContext); ++ + if (!isValid()) + return false; + +@@ -972,6 +973,39 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) + QOpenGLContext *previous = QOpenGLContextPrivate::setCurrentContext(this); + + if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) { ++ static bool needsWorkaroundSet = false; ++ static bool needsWorkaround = false; ++ ++ if (!needsWorkaroundSet) { ++#ifdef Q_OS_ANDROID ++ const QByteArray env = qgetenv("QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND"); ++ needsWorkaround = env.isEmpty() || env == "0" || env == "false"; ++#endif ++ QByteArray env = qgetenv("QT_ENABLE_GLYPH_CACHE_WORKAROUND"); ++ if (env == "1" || env == "true") ++ needsWorkaround = true; ++ ++ if (!needsWorkaround) { ++ const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); ++ if (rendererString) ++ needsWorkaround = ++ qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 ++ || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 ++ || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' ++ || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305 ++ || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)' ++ || qstrncmp(rendererString, "Adreno (TM) 4xx", 13) == 0 // Adreno 405, 418, 420, 430 ++ || qstrncmp(rendererString, "Adreno 4xx", 8) == 0 // Same as above but without the '(TM)' ++ || qstrcmp(rendererString, "GC800 core") == 0 ++ || qstrcmp(rendererString, "GC1000 core") == 0 ++ || qstrcmp(rendererString, "Immersion.16") == 0; ++ } ++ needsWorkaroundSet = true; ++ } ++ ++ if (needsWorkaround) ++ d->workaround_brokenFBOReadBack = true; ++ + d->surface = surface; + + d->shareGroup->d_func()->deletePendingResources(this); +diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +index 80693acf88..3edfd34f9a 100644 +--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp ++++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +@@ -64,34 +64,6 @@ void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface) + QEGLPlatformContext::swapBuffers(surface); + } + +-bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaround() +-{ +- static bool set = false; +- static bool needsWorkaround = false; +- +- if (!set) { +- QByteArray env = qgetenv("QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND"); +- needsWorkaround = env.isEmpty() || env == "0" || env == "false"; +- +- if (!needsWorkaround) { +- const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); +- needsWorkaround = +- qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 +- || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 +- || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' +- || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305 +- || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)' +- || qstrcmp(rendererString, "GC800 core") == 0 +- || qstrcmp(rendererString, "GC1000 core") == 0 +- || qstrcmp(rendererString, "Immersion.16") == 0; +- } +- +- set = true; +- } +- +- return needsWorkaround; +-} +- + bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface) + { + bool ret = QEGLPlatformContext::makeCurrent(surface); +@@ -101,9 +73,6 @@ bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface) + if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) + ctx_d->workaround_missingPrecisionQualifiers = true; + +- if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) +- ctx_d->workaround_brokenFBOReadBack = true; +- + return ret; + } + +diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.h b/src/plugins/platforms/android/qandroidplatformopenglcontext.h +index c88dbf327b..e0eaae6b16 100644 +--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.h ++++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.h +@@ -55,7 +55,6 @@ public: + private: + virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface); + +- static bool needsFBOReadBackWorkaround(); + }; + + QT_END_NAMESPACE +-- +2.12.0 +
dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend +5 -2
@@ -1,10 +1,11 @@ # Copyright (C) 2013 Eric Bénard - Eukréa Electromatique -# Copyright (C) 2016 O.S. Systems Software LTDA. # Copyright (C) 2016 Freescale Semiconductor -# Copyright 2017 NXP +# Copyright (C) 2016, 2017 O.S. Systems Software LTDA. +# Copyright (C) 2017 NXP FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI_append_use-mainline-bsp = " file://Environment-variable-enabling-the-workaround-FBO-rea.patch" SRC_URI_append_imxgpu2d = "file://0014-Add-IMX-GPU-support.patch" SRC_URI_append_imxgpu3d = " \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', \
@@ -15,9 +16,11 @@ SRC_URI_append_imxgpu3d = " \ PACKAGECONFIG_GL_imxpxp = "gles2" PACKAGECONFIG_GL_imxgpu2d = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', ' gl', '', d)}" PACKAGECONFIG_GL_imxgpu3d = "gles2" +PACKAGECONFIG_GL_use-mainline-bsp = "gles2 kms" QT_CONFIG_FLAGS_APPEND = "" QT_CONFIG_FLAGS_APPEND_imxpxp = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '-no-eglfs', '-eglfs', d)}" QT_CONFIG_FLAGS_APPEND_imxgpu2d = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '-no-eglfs', '-no-opengl -linuxfb -no-eglfs', d)}" QT_CONFIG_FLAGS_APPEND_imxgpu3d = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '-no-eglfs', '-eglfs', d)}" +QT_CONFIG_FLAGS_APPEND_use-mainline-bsp = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '-no-eglfs', '-eglfs', d)}" QT_CONFIG_FLAGS_append = " ${QT_CONFIG_FLAGS_APPEND}"
Signature · 1 line
2.12.1
PATCH 5/5 linux-fslc: Bump recipe to 4a2e3a368083 revision
In reply to Otavio SalvadorThis backports many changes, the included commits are:
4a2e3a368083 coda: enable with COMPILE_TESTe8dd8f5bb0d6 coda: restore original firmware locationsd17404963398 coda: disable reordering for baseline profile h.264 streams 0425550b2cc4 coda: pad first h.264 buffer to 512 bytes30a25c7a1c11 coda: keep queued buffers on a temporary list during start_streaming 6aedf08faa46 coda: Use && instead of & for non-bitfield conditions8c303b8eb07f coda: disable BWB for all codecs on CODA 9607c0c3cacae5a coda: implement encoder stop commandc2f021d1762f [media] coda/imx-vdoa: constify structs571d9a3398f4 [media] coda: add Freescale firmware compatibility location 2ab09ed38709 Revert "[media] coda/imx-vdoa: constify structs"f3f7ca7ea33e [media] coda: support YUYV output if VDOA is usedde26a60384a7 [media] coda: use VDOA for un-tiling custom macroblock format 9c020c7889cc [media] coda: fix frame index to returned error9b69cb0e9b5f [media] coda: add debug output about tilingc2943da78e15 [media] coda: correctly set capture compose rectanglefa1cbc7881eb [media] coda/imx-vdoa: constify structsfeb6ccfa4db7 [media] coda: add i.MX6 VDOA drivereae25c1e912a [media] coda: fix the error path in coda_probe()40e83b4ae508 [media] coda: add missing header dependencies62c95d073f57 ARM: dts: imx6qdl-nitrogen6x: add missing USB PHY reset control 719b9f294d76 ARM: dts: imx6qdl-sabrelite: add missing USB PHY reset control 4ffcf8c7c60c drm/panel: simple: Add support for Tianma TM070JDHG307790c716544c of: Add vendor prefix for Tianma Micro-electronics2c9fabdd9ba8 ARM: dts: imx6qdl-nitrogen6_som2: fix sgtl5000 pinctrl init 537158e11b5b ARM: dts: imx6qdl-nitrogen6x: remove duplicate iomux entry ca9533a30121 ARM: dts: boundary: remove hardcoded LVDS bus format6fa5cb82aa9e pinctrl: imx: use radix trees for groups and functions39c6395a5116 pinctrl: imx: remove const qualifier of imx_pinctrl_soc_info f0906c3e92ed ARM: dts: imx6qdl-nitrogen6_max: use hyphens for nodes name e88dc9d21208 ARM: dts: imx6qdl-nit6xlite: use hyphens for nodes name 0056c5e39d01 ARM: dts: imx6qdl-nitrogen6x: use hyphens for nodes name 470019dea0da ARM: dts: imx6qdl-sabrelite: use hyphens for nodes name 404a65b0f5ff ARM: dts: imx: add Boundary Devices Nitrogen6_SOM2 support 8ed001e651a4 drm/etnaviv: always flush MMU TLBs on map/unmapeda85482ab61 drm/etnaviv: constify etnaviv_iommu_ops structuresc4a322ce176e drm/etnaviv: set up initial PULSE_EATER registere7147fcbe4b0 drm/etnaviv: add new GC3000 sensitive states224462a9ba20 drm/etnaviv: Remove etnaviv_debugfs_cleanup()3b6d4ad2e259 drm/etnaviv: Use drm_dev_unref, not drm_put_devc095eb593edd drm/etnaviv: trick drm_mm into giving out a low IOVA7d872907c0f0 drm/etnaviv: move linear window on MC1.0 parts if necessary 619586d45f05 drm/etnaviv: don't invoke OOM killer from dump code201064234ea0 drm/etnaviv: fix gem_prime_get_sg_table to return new SG table 089369cb1167 drm/etnaviv: Allow DRAW_INSTANCED commandsdf310c458873 drm/etnaviv: implement dma-buf mmap11325b1e8736 drm/etnaviv: Remove manual call to reservation_object_test_signaled_rcu before wait
---
recipes-kernel/linux/linux-fslc_4.9.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
recipes-kernel/linux/linux-fslc_4.9.bb +2 -2
@@ -12,6 +12,6 @@ include linux-fslc.inc PV = "4.9+git${SRCPV}" SRCBRANCH = "4.9.x+fslc" -SRCREV = "c3825da143fc419e2639e602f62d793ed0de4657" +SRCREV = "4a2e3a3680836392ca9d2cbc550e097f206f35ce" -COMPATIBLE_MACHINE = "(mxs|mx5|mx6|vf)" +COMPATIBLE_MACHINE = "(mxs|mx5|mx6|vf|use-mainline-bsp)"
Signature · 1 line
2.12.1
PATCH 1/5 machine-overrides-extender.bbclass: Add filter out support
In reply to Otavio SalvadorThe allow easier enablement of mainline BSP support, we need to allow for specific overrides to be filtered out, before and during the extending process.
The new MACHINEOVERRIDES_EXTENDER_FILTER_OUT variable does exactly this and will be used in a subsequent commit to enable the 'use-mainline-bsp' override.
---
classes/machine-overrides-extender.bbclass | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
classes/machine-overrides-extender.bbclass +24 -5
@@ -3,21 +3,40 @@ # # This allow to grouping of different settings for similar platforms. # -# To use the class, specify, for example: +# To indicate that a SoC contains following set of overrides, you can use: # # MACHINEOVERRIDES_EXTENDER_soc = "group1:group2" # -# Copyright 2016 (C) O.S. Systems Software LTDA. +# However to indicate that an override replaces a set of other +# overrides, you can use: +# +# MACHINEOVERRIDES_EXTENDER_FILTER_OUT_override = "group1 group2" +# +# Copyright 2016-2017 (C) O.S. Systems Software LTDA. def machine_overrides_extender(d): machine_overrides = (d.getVar('MACHINEOVERRIDES', True) or '').split(':') - for o in machine_overrides: - extender = d.getVar('MACHINEOVERRIDES_EXTENDER_%s' % o, True) + + # Gather the list of overrides to filter out + machine_overrides_filter_out = [] + for override in machine_overrides: + machine_overrides_filter_out += (d.getVar('MACHINEOVERRIDES_EXTENDER_FILTER_OUT_%s' % override, True) or '').split() + + # Drop any overrides of filter_out prior extending + machine_overrides = [o for o in machine_overrides if o not in machine_overrides_filter_out] + + for override in machine_overrides: + extender = d.getVar('MACHINEOVERRIDES_EXTENDER_%s' % override, True) + if extender: extender = extender.split(':') + + # Drop any extension if in filter_out + extender = [e for e in extender if e not in machine_overrides_filter_out] + extender.reverse() if not set(extender).issubset(set(machine_overrides)): - index = machine_overrides.index(o) + index = machine_overrides.index(override) for e in extender: machine_overrides.insert(index, e) d.setVar('MACHINEOVERRIDES', ':'.join(machine_overrides))
Signature · 1 line
2.12.1