Skip to contentSkip to conversation

meta-ti-bsp: Graphics recipe overhaul

PATCH In review Randolph Sapp 2 participants 5 messages Dec 15, 2022 – Dec 27, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 meta-ti-bsp: Graphics recipe overhaul

Individually package rogue graphics components to prevent conflicts with other recipes.

The package ti-img-rogue-umlibs will now distribute the window system agnostic components of the DDK. This being the IMG's implementations of OpenGLES, OpenCL, and Vulkan in binary format and the device firmware. These are the only components that cannot be open source currently.

The mesa component is currently piggybacking off the default mesa package. It's not elegant, but it reflects the implementation well and allows users to config mesa as needed.

This all hinges off of the new rogue-gpu machine feature.

---
 meta-ti-bsp/conf/machine/include/am62xx.inc   |   8 +-
 meta-ti-bsp/conf/machine/include/j721e.inc    |   8 +-
 meta-ti-bsp/conf/machine/include/j721s2.inc   |   8 +-
 ...-OpenEmbedded-nodistro-internal-aarc.patch |  29 --
 ...bb => ti-img-rogue-driver_1.18.6276027.bb} |  12 +-
 .../ti-img-rogue-umlibs_1.15.6133109.bb       |  71 ----
 .../ti-img-rogue-umlibs_1.18.6276027.bb       |  38 +++
 ...nd-deprecate-drm_handle_format-and-d.patch | 158 +++++++++
 ...fine-__NR_futex-if-it-does-not-exist.patch |  34 ++
 ...sdetects-64bit-atomics-on-mips-clang.patch |  25 ++
 ...k-for-all-linux-host_os-combinations.patch |  43 +++
 ...ormat-Check-for-NEON-before-using-it.patch |  47 +++
 ...02-meson.build-make-TLS-ELF-optional.patch |  61 ++++
 .../recipes-graphics/mesa/mesa-gl_22.0.3.bb   |  13 +
 meta-ti-bsp/recipes-graphics/mesa/mesa.inc    | 323 ++++++++++++++++++
 .../recipes-graphics/mesa/mesa_22.0.3.bb      |   2 +
 .../recipes-graphics/mesa/rogue-mesa.inc      |  29 ++
 17 files changed, 781 insertions(+), 128 deletions(-)
 delete mode 100644 meta-ti-bsp/recipes-bsp/powervr-drivers/ti-img-rogue-driver/0001-compiler-support-OpenEmbedded-nodistro-internal-aarc.patch
 rename meta-ti-bsp/recipes-bsp/powervr-drivers/{ti-img-rogue-driver_1.15.6133109.bb => ti-img-rogue-driver_1.18.6276027.bb} (77%)
 delete mode 100644 meta-ti-bsp/recipes-graphics/libgles/ti-img-rogue-umlibs_1.15.6133109.bb
 create mode 100644 meta-ti-bsp/recipes-graphics/libgles/ti-img-rogue-umlibs_1.18.6276027.bb
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/files/0001-Revert-egl-wayland-deprecate-drm_handle_format-and-d.patch
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/files/0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/files/0001-meson-misdetects-64bit-atomics-on-mips-clang.patch
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/files/0001-meson.build-check-for-all-linux-host_os-combinations.patch
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/files/0001-util-format-Check-for-NEON-before-using-it.patch
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/files/0002-meson.build-make-TLS-ELF-optional.patch
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/mesa-gl_22.0.3.bb
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/mesa.inc
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/mesa_22.0.3.bb
 create mode 100644 meta-ti-bsp/recipes-graphics/mesa/rogue-mesa.inc
meta-ti-bsp/conf/machine/include/am62xx.inc +1 -7
index a5aad994..3b568e55 100644
@@ -1,17 +1,11 @@
 require conf/machine/include/k3.inc
 SOC_FAMILY:append = ":am62xx"
 
-MACHINE_FEATURES += "screen touchscreen gpu"
+MACHINE_FEATURES += "screen touchscreen gpu rogue-gpu"
 
 SERIAL_CONSOLES = "115200;ttyS2"
 SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"
 
-PREFERRED_PROVIDER_virtual/egl ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgles1 ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgles2 ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgbm ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/gpudriver ?= "ti-img-rogue-driver"
-
 do_image_wic[mcdepends] = "mc::k3r5:ti-sci-fw:do_deploy"
 do_image_tar[mcdepends] = "mc::k3r5:ti-sci-fw:do_deploy"
 
meta-ti-bsp/conf/machine/include/j721e.inc +1 -7
index fe260178..277fad6a 100644
@@ -1,10 +1,4 @@
 require conf/machine/include/j7.inc
 SOC_FAMILY:append = ":j721e"
 
-MACHINE_FEATURES += "gpu"
-
-PREFERRED_PROVIDER_virtual/egl ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgles1 ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgles2 ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgbm ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/gpudriver ?= "ti-img-rogue-driver"
+MACHINE_FEATURES += "gpu rogue-gpu"
meta-ti-bsp/conf/machine/include/j721s2.inc +1 -7
index 5cd74683..6fe44c20 100644
@@ -1,10 +1,4 @@
 require conf/machine/include/j7.inc
 SOC_FAMILY:append = ":j721s2"
 
-MACHINE_FEATURES += "gpu"
-
-PREFERRED_PROVIDER_virtual/egl ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgles1 ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgles2 ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/libgbm ?= "ti-img-rogue-umlibs"
-PREFERRED_PROVIDER_virtual/gpudriver ?= "ti-img-rogue-driver"
+MACHINE_FEATURES += "gpu rogue-gpu"
meta-ti-bsp/recipes-bsp/powervr-drivers/ti-img-rogue-driver/0001-compiler-support-OpenEmbedded-nodistro-internal-aarc.patch deleted +0 -29
deleted file mode 100644
index f021cc39..00000000
@@ -1,29 +0,0 @@
-From 80d32fee3d768abbd77cce77ea9a7574651460a9 Mon Sep 17 00:00:00 2001
-From: Denys Dmytriyenko <[email protected]>
-Date: Wed, 7 Jul 2021 13:11:56 -0400
-Subject: [PATCH] compiler: support OpenEmbedded "nodistro" internal aarch64
- toolchain
-
-Upstream-Status: Pending
-
-Signed-off-by: Denys Dmytriyenko <[email protected]>
----
- build/linux/config/compiler.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/build/linux/config/compiler.mk b/build/linux/config/compiler.mk
-index 53a0bef..d788579 100644
---- a/build/linux/config/compiler.mk
-+++ b/build/linux/config/compiler.mk
-@@ -65,7 +65,7 @@ define calculate-compiler-preferred-target
-    ifneq ($$(filter i386-% i486-% i586-% i686-%,$$($(1)_compiler_preferred_target)),)
-     $(1)_compiler_preferred_target := i386-linux-gnu
-    endif
--   ifneq ($$(filter aarch64-poky-linux,$$($(1)_compiler_preferred_target)),)
-+   ifneq ($$(filter aarch64-oe-linux aarch64-poky-linux,$$($(1)_compiler_preferred_target)),)
-     $(1)_compiler_preferred_target := aarch64-linux-gnu
-    endif
-    ifneq ($$(filter armv7a-cros-linux-gnueabi armv7l-tizen-linux-gnueabi,$$($(1)_compiler_preferred_target)),)
--- 
-2.7.4
-
meta-ti-bsp/recipes-bsp/powervr-drivers/ti-img-rogue-driver_1.18.6276027.bb renamed from meta-ti-bsp/recipes-bsp/powervr-drivers/ti-img-rogue-driver_1.15.6133109.bb +5 -7
similarity index 77%
rename from meta-ti-bsp/recipes-bsp/powervr-drivers/ti-img-rogue-driver_1.15.6133109.bb
rename to meta-ti-bsp/recipes-bsp/powervr-drivers/ti-img-rogue-driver_1.18.6276027.bb
index b4d19195..45df7c4b 100644
@@ -11,29 +11,27 @@ MACHINE_KERNEL_PR:append = "b"
 PR = "${MACHINE_KERNEL_PR}"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
+
 COMPATIBLE_MACHINE = "j721e|j721s2|j784s4|am62xx"
 
 DEPENDS = "virtual/kernel"
 
 PROVIDES = "virtual/gpudriver"
 
-BRANCH = "linuxws/dunfell/k5.10/${PV}_unified_fw_pagesize"
+BRANCH = "linuxws/kirkstone/k5.10/${PV}"
 
-SRC_URI = " \
-    git://git.ti.com/git/graphics/ti-img-rogue-driver.git;protocol=https;branch=${BRANCH} \
-    file://0001-compiler-support-OpenEmbedded-nodistro-internal-aarc.patch \
-"
+SRC_URI = "git://git.ti.com/git/graphics/ti-img-rogue-driver.git;protocol=https;branch=${BRANCH}"
 
 S = "${WORKDIR}/git"
 
-SRCREV = "c901804e8221d477983a6f7224a9cdc6e832f050"
+SRCREV = "d575e4f64c95a3534e10e85da15bd303febf133f"
 
 TARGET_PRODUCT:j721e = "j721e_linux"
 TARGET_PRODUCT:j721s2 = "j721s2_linux"
 TARGET_PRODUCT:j784s4 = "j784s4_linux"
 TARGET_PRODUCT:am62xx = "am62_linux"
 PVR_BUILD = "release"
-PVR_WS = "wayland"
+PVR_WS = "lws-generic"
 
 EXTRA_OEMAKE += 'KERNELDIR="${STAGING_KERNEL_DIR}" BUILD=${PVR_BUILD} PVR_BUILD_DIR=${TARGET_PRODUCT} WINDOW_SYSTEM=${PVR_WS}'
 
meta-ti-bsp/recipes-graphics/libgles/ti-img-rogue-umlibs_1.15.6133109.bb deleted +0 -71

71 lines not on this page · raw message

meta-ti-bsp/recipes-graphics/libgles/ti-img-rogue-umlibs_1.18.6276027.bb new file +38 -0
new file mode 100644
index 00000000..0375b442
@@ -0,0 +1,38 @@
+DESCRIPTION = "Userspace libraries for PowerVR Rogue GPU on TI SoCs"
+HOMEPAGE = "http://git.ti.com/graphics/ti-img-rogue-umlibs"
+LICENSE = "TI-TFL"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=7232b98c1c58f99e3baa03de5207e76f"
+
+inherit features_check bin_package
+
+REQUIRED_MACHINE_FEATURES = "gpu"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+COMPATIBLE_MACHINE = "j721e|j721s2|j784s4|am62xx"
+
+PR = "r2"
+
+BRANCH = "linuxws/kirkstone/k5.10/${PV}"
+SRC_URI = "git://git.ti.com/git/graphics/ti-img-rogue-umlibs.git;protocol=https;branch=${BRANCH}"
+SRCREV = "51e598919641d51156a631efa5447124a3c0f543"
+S = "${WORKDIR}/git/targetfs/${TARGET_PRODUCT}/${PVR_WS}/${PVR_BUILD}"
+
+TARGET_PRODUCT:j721e = "j721e_linux"
+TARGET_PRODUCT:j721s2 = "j721s2_linux"
+TARGET_PRODUCT:j784s4 = "j784s4_linux"
+TARGET_PRODUCT:am62xx = "am62_linux"
+PVR_BUILD = "release"
+PVR_WS = "lws-generic"
+
+RDEPENDS:${PN} += "mesa-megadriver libdrm ti-img-rogue-driver"
+
+do_install:append() {
+    rm -rf "${D}/etc/init.d"
+}
+
+PACKAGES = "${PN}-tools ${PN}"
+FILES:${PN}-tools = "${bindir}/"
+RDEPENDS:${PN}-tools = "python3-core"
+RRECOMMENDS:${PN} += "${PN}-tools"
+
+INSANE_SKIP:${PN} += "ldflags arch already-stripped dev-so"
meta-ti-bsp/recipes-graphics/mesa/files/0001-Revert-egl-wayland-deprecate-drm_handle_format-and-d.patch new file +158 -0

158 lines not on this page · raw message

meta-ti-bsp/recipes-graphics/mesa/files/0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch new file +34 -0
new file mode 100644
index 00000000..3b0bfa32
@@ -0,0 +1,34 @@
+From 253b042d2bf10e9abfa9cc508e0782aefd834145 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 16 Oct 2020 11:03:47 -0700
+Subject: [PATCH] futex.h: Define __NR_futex if it does not exist
+
+__NR_futex is not defines by newer architectures e.g. arc, riscv32 as
+they only have 64bit variant of time_t. Glibc defines SYS_futex interface based on
+__NR_futex, since this is used in applications, such applications start
+to fail to build for these newer architectures. This patch defines a
+fallback to alias __NR_futex to __NR_futex_tim64 so SYS_futex keeps
+working
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+
+---
+ src/util/futex.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/util/futex.h b/src/util/futex.h
+index 43097f4..941b0ec 100644
+--- a/src/util/futex.h
++++ b/src/util/futex.h
+@@ -34,6 +34,10 @@
+ #include <sys/syscall.h>
+ #include <sys/time.h>
+ 
++#if !defined(SYS_futex) && defined(SYS_futex_time64)
++# define SYS_futex SYS_futex_time64
++#endif
++
+ static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
+ {
+    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
meta-ti-bsp/recipes-graphics/mesa/files/0001-meson-misdetects-64bit-atomics-on-mips-clang.patch new file +25 -0
new file mode 100644
index 00000000..b08e4d86
@@ -0,0 +1,25 @@
+From d34bdbd80e5a1f309d2ba280cdc66ff0ee0e5c43 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 13 Jan 2020 15:23:47 -0800
+Subject: [PATCH] meson misdetects 64bit atomics on mips/clang
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+
+---
+ src/util/u_atomic.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/util/u_atomic.c b/src/util/u_atomic.c
+index 5a5eab4..e499516 100644
+--- a/src/util/u_atomic.c
++++ b/src/util/u_atomic.c
+@@ -21,7 +21,7 @@
+  * IN THE SOFTWARE.
+  */
+ 
+-#if defined(MISSING_64BIT_ATOMICS) && defined(HAVE_PTHREAD)
++#if !defined(__clang__) && defined(MISSING_64BIT_ATOMICS) && defined(HAVE_PTHREAD)
+ 
+ #include <stdint.h>
+ #include <pthread.h>
meta-ti-bsp/recipes-graphics/mesa/files/0001-meson.build-check-for-all-linux-host_os-combinations.patch new file +43 -0

43 lines not on this page · raw message

meta-ti-bsp/recipes-graphics/mesa/files/0001-util-format-Check-for-NEON-before-using-it.patch new file +47 -0

47 lines not on this page · raw message

meta-ti-bsp/recipes-graphics/mesa/files/0002-meson.build-make-TLS-ELF-optional.patch new file +61 -0

61 lines not on this page · raw message

meta-ti-bsp/recipes-graphics/mesa/mesa-gl_22.0.3.bb new file +13 -0
new file mode 100644
index 00000000..f2bc8f6b
@@ -0,0 +1,13 @@
+require mesa.inc
+
+SUMMARY += " (OpenGL only, no EGL/GLES)"
+
+PROVIDES = "virtual/libgl virtual/mesa"
+
+S = "${WORKDIR}/mesa-${PV}"
+
+# At least one DRI rendering engine is required to build mesa.
+# When no X11 is available, use osmesa for the rendering engine.
+PACKAGECONFIG ??= "opengl ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa gallium', d)}"
+PACKAGECONFIG:class-target = "opengl ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa gallium', d)}"
+
meta-ti-bsp/recipes-graphics/mesa/mesa.inc new file +323 -0

323 lines not on this page · raw message

meta-ti-bsp/recipes-graphics/mesa/mesa_22.0.3.bb new file +2 -0
new file mode 100644
index 00000000..96e8aa38
@@ -0,0 +1,2 @@
+require ${BPN}.inc
+
meta-ti-bsp/recipes-graphics/mesa/rogue-mesa.inc new file +29 -0
new file mode 100644
index 00000000..c5002fa7
@@ -0,0 +1,29 @@
+# Rogue graphics related mesa overrides
+
+BRANCH = "rogue/kirkstone/pvr-1.18/22.0"
+
+SRC_URI = "git://gitlab.freedesktop.org/StaticRocket/mesa.git;protocol=https;branch=${BRANCH} \
+           file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \
+           file://0002-meson.build-make-TLS-ELF-optional.patch \
+           file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
+           file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \
+           file://0001-util-format-Check-for-NEON-before-using-it.patch \
+           file://0001-Revert-egl-wayland-deprecate-drm_handle_format-and-d.patch \
+           "
+
+S = "${WORKDIR}/git"
+
+SRCREV = "fddf5106f04de2bd35892d30e5574c0b2881edd9"
+
+PV:append = "+rogue"
+
+GALLIUMDRIVERS:append = ",pvr"
+
+EXTRA_OEMESON:append = " -Dgallium-pvr-alias=tidss"
+
+do_install:append () {
+    # remove pvr custom pkgconfig
+    rm -rf ${D}${datadir}/pkgconfig
+}
+
+RRECOMMENDS:mesa-megadriver:class-target += "ti-img-rogue-driver ti-img-rogue-umlibs"
Signature · 1 line
2.34.1
#1 lore raw
Quoted 12 lines · Randolph Sapp

Individually package rogue graphics components to prevent conflicts with other recipes.

The package ti-img-rogue-umlibs will now distribute the window system agnostic components of the DDK. This being the IMG's implementations of OpenGLES, OpenCL, and Vulkan in binary format and the device firmware. These are the only components that cannot be open source currently.

The mesa component is currently piggybacking off the default mesa package. It's not elegant, but it reflects the implementation well and allows users to config mesa as needed.

Quoted 7 lines

This all hinges off of the new rogue-gpu machine feature.

---
 meta-ti-bsp/conf/machine/include/am62xx.inc   |   8 +-
 meta-ti-bsp/conf/machine/include/j721e.inc    |   8 +-
 meta-ti-bsp/conf/machine/include/j721s2.inc   |   8 +-

I've applied this patch locally and tried to build for the SanCloud BBE (with am335x SoC) so I can test things out.

The layer tags/commits and configs I used are as follows:

    poky:               yocto-4.0.5
    meta-openembedded:  50d4a8d2a983a68383ef1ffec2c8e21adf0c1a79
    meta-ti:            2a5a0339d5bd28d6f6aedaf02a6aaa9b73a248e4 + this patch
    meta-arm:           904f8e82c2772986fad500af4f72f5211a7ff831
    meta-rtlwifi:       032a394e7569d1254cd17a0358475b986e64a5a4
    meta-sancloud:      d1a93ed2205eea11e7cdffbc70578f07d5a609e4

DISTRO = poky
MACHINE = bbe

Both core-image-x11 and core-image-weston fail to build as no suitable provider of virtual/libgl can be found (as seen previously [1]).

Looking at the patch, I see the new rogue-gpu machine feature has only been added for the am62xx, j721e & j721s2 families. Are further fixes required for the am335x or am65xx families? I'm happy to test any further patches targetting these SoC families.

[1]: https://lore.kernel.org/yocto-meta-ti/[email protected]/

Thanks,

Signature · 6 lines
Paul Barker
Principal Software Engineer
SanCloud Ltd

e: [email protected]
w: https://sancloud.com/
#2 lore raw
Quoted 3 lines · Paul Barker

Are further
fixes required for the am335x or am65xx families? I'm happy to test any further patches targetting these SoC families.

Yes, futher fixes are required for SGX devices. I'm not sure when to expect those patches at the moment, but I'll keep you posted.

#3 lore raw
Quoted 4 lines · Randolph
Quoted 1 line · Paul Barker

Are further fixes required for the am335x or am65xx families? I'm happy to test any further patches targetting these SoC families.

Yes, futher fixes are required for SGX devices. I'm not sure when to expect those patches at the moment, but I'll keep you posted.

Understood. In the next version of this patch, please include the list of MACHINEs or SoC families which are addressed by these changes. I'd also recommend splitting this up into multiple commits if possible so it's easier for external subscribers to this list to understand the changes.

I'm happy to review & test graphics fixes for am335x/am65xx/am62xx when they arrive as we're using those SoCs. Please feel free to Cc me on those patches once they're ready.

Thanks,

Signature · 6 lines
Paul Barker
Principal Software Engineer
SanCloud Ltd

e: [email protected]
w: https://sancloud.com/
#4 lore raw
Quoted 5 lines · Paul Barker

Understood. In the next version of this patch, please include the list of MACHINEs or SoC families which are addressed by these changes. I'd also recommend splitting this up into multiple commits if possible so it's easier for external subscribers to this list to understand the changes.

Roger. My only concern for that is making sure these patches are bisectable, and this is a sweeping change that can't really be split up into multiple compilable patches. Recipies being updated that rely on other repipies and machine feature unfortunatly means this is all or nothing.

Quoted 2 lines · Paul Barker

I'm happy to review & test graphics fixes for am335x/am65xx/am62xx when they arrive as we're using those SoCs.

This patch currently applies to am62xx, j721s2, j721e.