Skip to contentSkip to conversation

mesa-pvr: add dynamic-layer append for llvmpipe

PATCH In review [email protected] 2 participants 2 messages Aug 22, 2023 – Aug 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mesa-pvr: add dynamic-layer append for llvmpipe

From: Randolph Sapp <[email protected]>

Meta-clang provides a bbappend for mesa to use clang to accelerate it's rasterization with runtime code generation through the use of llvmpipe. With the addition of mesa-pvr we no longer get this for free with the blanket mesa bbappend on the devices that explicitly request mesa-pvr so lets add a dynamic layer to append the same args meta-clang does.

Though the number of devices that would select pvr-mesa and still want to use software rendering is small, it's not zero due to debug and testing purposes.

---

Please let me know if I'm overlooking some specification like some reason bsp layers shouldn't have dynamic-layers or something like that. The yocto-check-layer didn't seem to care.

 meta-ti-bsp/conf/layer.conf                        |  4 ++++
 .../recipes-graphics/mesa/mesa-pvr_%.bbappend      | 14 ++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 meta-ti-bsp/dynamic-layers/clang-layer/recipes-graphics/mesa/mesa-pvr_%.bbappend
meta-ti-bsp/conf/layer.conf +4 -0
index 26cbb4b5..56ca392b 100644
@@ -18,6 +18,10 @@ LAYERDEPENDS_meta-ti-bsp = " \
     meta-arm \
 "
 
+BBFILES_DYNAMIC += " \
+    clang-layer:${LAYERDIR}/dynamic-layers/clang-layer/recipes*/*/*.bbappend \
+"
+
 SIGGEN_EXCLUDERECIPES_ABISAFE += " \
     mesa-pvr \
 "
meta-ti-bsp/dynamic-layers/clang-layer/recipes-graphics/mesa/mesa-pvr_%.bbappend new file +14 -0
new file mode 100644
index 00000000..7e5c36fd
@@ -0,0 +1,14 @@
+# This is a copy of meta-clang/recipes-graphics/mesa/mesa_%.bbappend required
+# for llvmpipe when using pvr-mesa since we aren't caught by that glob.
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+LDFLAGS:append:toolchain-clang = " -latomic -lm"
+DEPENDS:append:toolchain-clang = " libatomic-ops"
+
+EXTRA_OEMASON:append:toolchain-clang:x86 = " -Dasm=false"
+EXTRA_OEMASON:append:toolchain-clang:x86-64 = " -Dasm=false"
+
+export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-config"
+
+PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true -Ddraw-use-llvm=true,-Dllvm=false,clang clang-native elfutils"
Signature · 1 line
2.41.0
#1 lore raw
Quoted 12 lines · On Mon, Aug 21, 2023 at 08:11:38PM -0500, [email protected] wrote:

From: Randolph Sapp <[email protected]>

Meta-clang provides a bbappend for mesa to use clang to accelerate it's rasterization with runtime code generation through the use of llvmpipe. With the addition of mesa-pvr we no longer get this for free with the blanket mesa bbappend on the devices that explicitly request mesa-pvr so lets add a dynamic layer to append the same args meta-clang does.

Though the number of devices that would select pvr-mesa and still want to use software rendering is small, it's not zero due to debug and testing purposes.

Quoted 6 lines

---

Please let me know if I'm overlooking some specification like some reason bsp layers shouldn't have dynamic-layers or something like that. The yocto-check-layer didn't seem to care.

Well, normally you wouldn't want a pure BSP layer to depend on anything extra besides OE-Core. But compiler and toolchain dependencies are rather special and there were and still are such cases. Plus bigger plan for clang is to get into OE-Core eventually, similar to how Rust has been handled. So, a dynamic dependency for meta-clang is probably fine for now, just need to make sure it works both ways and gets validated with and w/o such dependency...

Quoted 43 lines
 meta-ti-bsp/conf/layer.conf                        |  4 ++++
 .../recipes-graphics/mesa/mesa-pvr_%.bbappend      | 14 ++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 meta-ti-bsp/dynamic-layers/clang-layer/recipes-graphics/mesa/mesa-pvr_%.bbappend
meta-ti-bsp/conf/layer.conf +4 -0
index 26cbb4b5..56ca392b 100644
@@ -18,6 +18,10 @@ LAYERDEPENDS_meta-ti-bsp = " \
     meta-arm \
 "
 
+BBFILES_DYNAMIC += " \
+    clang-layer:${LAYERDIR}/dynamic-layers/clang-layer/recipes*/*/*.bbappend \
+"
+
 SIGGEN_EXCLUDERECIPES_ABISAFE += " \
     mesa-pvr \
 "
meta-ti-bsp/dynamic-layers/clang-layer/recipes-graphics/mesa/mesa-pvr_%.bbappend new file +14 -0
new file mode 100644
index 00000000..7e5c36fd
@@ -0,0 +1,14 @@
+# This is a copy of meta-clang/recipes-graphics/mesa/mesa_%.bbappend required
+# for llvmpipe when using pvr-mesa since we aren't caught by that glob.
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+LDFLAGS:append:toolchain-clang = " -latomic -lm"
+DEPENDS:append:toolchain-clang = " libatomic-ops"
+
+EXTRA_OEMASON:append:toolchain-clang:x86 = " -Dasm=false"
+EXTRA_OEMASON:append:toolchain-clang:x86-64 = " -Dasm=false"
+
+export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-config"
+
+PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true -Ddraw-use-llvm=true,-Dllvm=false,clang clang-native elfutils"
Signature · 1 line
2.41.0