From 94635de40288b1ba132d873839704dd43ae96d56 Mon Sep 17 00:00:00 2001 From: Denys Dmytriyenko Date: Thu, 11 May 2023 18:40:49 +0000 Subject: mesa-pvr: convert bbappend into standalone alternative provider There are some unobvious issues with adding PVR support to Mesa via a bbappend: 1. We need to mark mesa package as machine-specific, due to differences in builds between SGX, Rogue and software-rendering 2. We also need to then mark mesa package as providing safe ABIs (EGL/GLES/GBM) in order for all generic dependent packages to not be treated as machine-specific, allowing their re-use across different machines of the same architecture But doing the above alters the upstream mesa package and changes its signatures even when not building for TI platforms, which is a Yocto Project compliance violation. In order to resolve this issue, convert Mesa bbappend, that adds PVR support, into its own standalone alternative provider, called mesa-pvr and allow selecting it with PREFERRED_PROVIDER settings. Signed-off-by: Denys Dmytriyenko Signed-off-by: Ryan Eatmon --- meta-ti-bsp/conf/layer.conf | 2 +- meta-ti-bsp/conf/machine/beagleplay.conf | 1 + meta-ti-bsp/conf/machine/include/am62xx.inc | 1 + meta-ti-bsp/conf/machine/include/am65xx.inc | 1 + meta-ti-bsp/conf/machine/include/j721e.inc | 1 + meta-ti-bsp/conf/machine/include/j721s2.inc | 1 + meta-ti-bsp/conf/machine/include/j784s4.inc | 1 + meta-ti-bsp/conf/machine/include/mesa-pvr.inc | 8 +++ meta-ti-bsp/conf/machine/include/omap-a15.inc | 1 + meta-ti-bsp/conf/machine/include/ti33x.inc | 1 + meta-ti-bsp/conf/machine/include/ti43x.inc | 1 + .../recipes-graphics/mesa/mesa-gl_22.%.bbappend | 1 - .../recipes-graphics/mesa/mesa-pvr_22.3.5.bb | 57 ++++++++++++++++++++++ .../recipes-graphics/mesa/mesa_22.%.bbappend | 1 - meta-ti-bsp/recipes-graphics/mesa/pvr-mesa.inc | 55 --------------------- 15 files changed, 75 insertions(+), 58 deletions(-) create mode 100644 meta-ti-bsp/conf/machine/include/mesa-pvr.inc delete mode 100644 meta-ti-bsp/recipes-graphics/mesa/mesa-gl_22.%.bbappend create mode 100644 meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb delete mode 100644 meta-ti-bsp/recipes-graphics/mesa/mesa_22.%.bbappend delete mode 100644 meta-ti-bsp/recipes-graphics/mesa/pvr-mesa.inc diff --git a/meta-ti-bsp/conf/layer.conf b/meta-ti-bsp/conf/layer.conf index e9b7f92c..26cbb4b5 100644 --- a/meta-ti-bsp/conf/layer.conf +++ b/meta-ti-bsp/conf/layer.conf @@ -19,7 +19,7 @@ LAYERDEPENDS_meta-ti-bsp = " \ " SIGGEN_EXCLUDERECIPES_ABISAFE += " \ - mesa \ + mesa-pvr \ " HOSTTOOLS_NONFATAL += "truncate xxd comm" diff --git a/meta-ti-bsp/conf/machine/beagleplay.conf b/meta-ti-bsp/conf/machine/beagleplay.conf index e8d25cd9..c7b1414a 100644 --- a/meta-ti-bsp/conf/machine/beagleplay.conf +++ b/meta-ti-bsp/conf/machine/beagleplay.conf @@ -10,6 +10,7 @@ MACHINE_FEATURES += "screen gpu" SERIAL_CONSOLES = "115200;ttyS2" SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}" +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "ti-img-rogue-driver" TFA_BOARD = "lite" diff --git a/meta-ti-bsp/conf/machine/include/am62xx.inc b/meta-ti-bsp/conf/machine/include/am62xx.inc index a205a18c..c1e0ed0c 100644 --- a/meta-ti-bsp/conf/machine/include/am62xx.inc +++ b/meta-ti-bsp/conf/machine/include/am62xx.inc @@ -3,6 +3,7 @@ SOC_FAMILY:append = ":am62xx" MACHINE_FEATURES += "screen gpu" +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "ti-img-rogue-driver" # Default tiboot3.bin on AM62x is for HS-FS diff --git a/meta-ti-bsp/conf/machine/include/am65xx.inc b/meta-ti-bsp/conf/machine/include/am65xx.inc index 9fe851f4..9cbce243 100644 --- a/meta-ti-bsp/conf/machine/include/am65xx.inc +++ b/meta-ti-bsp/conf/machine/include/am65xx.inc @@ -3,6 +3,7 @@ SOC_FAMILY:append = ":am65xx" MACHINE_FEATURES += "screen touchscreen gpu" +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "" KERNEL_DEVICETREE_PREFIX = "ti/k3-am654" diff --git a/meta-ti-bsp/conf/machine/include/j721e.inc b/meta-ti-bsp/conf/machine/include/j721e.inc index 5e325ffe..f707cf26 100644 --- a/meta-ti-bsp/conf/machine/include/j721e.inc +++ b/meta-ti-bsp/conf/machine/include/j721e.inc @@ -3,6 +3,7 @@ SOC_FAMILY:append = ":j721e" MACHINE_FEATURES += "screen gpu" +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "ti-img-rogue-driver" # On J721e the file tiboot3.bin comes from the bootloader not ti-sci-fw diff --git a/meta-ti-bsp/conf/machine/include/j721s2.inc b/meta-ti-bsp/conf/machine/include/j721s2.inc index 70569a16..98cc611f 100644 --- a/meta-ti-bsp/conf/machine/include/j721s2.inc +++ b/meta-ti-bsp/conf/machine/include/j721s2.inc @@ -3,6 +3,7 @@ SOC_FAMILY:append = ":j721s2" MACHINE_FEATURES += "screen gpu" +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "ti-img-rogue-driver" TFA_BOARD = "generic" diff --git a/meta-ti-bsp/conf/machine/include/j784s4.inc b/meta-ti-bsp/conf/machine/include/j784s4.inc index d03ee4a4..de207687 100644 --- a/meta-ti-bsp/conf/machine/include/j784s4.inc +++ b/meta-ti-bsp/conf/machine/include/j784s4.inc @@ -3,6 +3,7 @@ SOC_FAMILY:append = ":j784s4" MACHINE_FEATURES += "screen gpu" +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "ti-img-rogue-driver" TFA_BOARD = "j784s4" diff --git a/meta-ti-bsp/conf/machine/include/mesa-pvr.inc b/meta-ti-bsp/conf/machine/include/mesa-pvr.inc new file mode 100644 index 00000000..d5581315 --- /dev/null +++ b/meta-ti-bsp/conf/machine/include/mesa-pvr.inc @@ -0,0 +1,8 @@ +PREFERRED_PROVIDER_virtual/mesa ?= "mesa-pvr" +PREFERRED_PROVIDER_virtual/egl ?= "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgles2 ?= "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgles3 ?= "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgbm ?= "mesa-pvr" +PREFERRED_PROVIDER_virtual/libglx ?= "mesa-pvr" +PREFERRED_PROVIDER_virtual/libgl ?= "mesa-pvr" diff --git a/meta-ti-bsp/conf/machine/include/omap-a15.inc b/meta-ti-bsp/conf/machine/include/omap-a15.inc index 49db1cb6..700b1a11 100644 --- a/meta-ti-bsp/conf/machine/include/omap-a15.inc +++ b/meta-ti-bsp/conf/machine/include/omap-a15.inc @@ -12,6 +12,7 @@ PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-ti-staging" PREFERRED_PROVIDER_u-boot ?= "u-boot-ti-staging" # Graphics providers and variables +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "" PVR_DISPLAY_CONTROLLER_ALIAS ?= "omapdrm" diff --git a/meta-ti-bsp/conf/machine/include/ti33x.inc b/meta-ti-bsp/conf/machine/include/ti33x.inc index 4f6d90bf..bce88309 100644 --- a/meta-ti-bsp/conf/machine/include/ti33x.inc +++ b/meta-ti-bsp/conf/machine/include/ti33x.inc @@ -13,6 +13,7 @@ PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-ti-staging" PREFERRED_PROVIDER_u-boot ?= "u-boot-ti-staging" # Graphics providers and variables +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "" PVR_DISPLAY_CONTROLLER_ALIAS ?= "tilcdc" diff --git a/meta-ti-bsp/conf/machine/include/ti43x.inc b/meta-ti-bsp/conf/machine/include/ti43x.inc index 5b40925e..c1009dc6 100644 --- a/meta-ti-bsp/conf/machine/include/ti43x.inc +++ b/meta-ti-bsp/conf/machine/include/ti43x.inc @@ -13,6 +13,7 @@ PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-ti-staging" PREFERRED_PROVIDER_u-boot ?= "u-boot-ti-staging" # Graphics providers and variables +require conf/machine/include/mesa-pvr.inc PREFERRED_PROVIDER_virtual/gpudriver ?= "" PVR_DISPLAY_CONTROLLER_ALIAS ?= "omapdrm" diff --git a/meta-ti-bsp/recipes-graphics/mesa/mesa-gl_22.%.bbappend b/meta-ti-bsp/recipes-graphics/mesa/mesa-gl_22.%.bbappend deleted file mode 100644 index 912e9e9d..00000000 --- a/meta-ti-bsp/recipes-graphics/mesa/mesa-gl_22.%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains_any('PREFERRED_PROVIDER_virtual/gpudriver', 'ti-img-rogue-driver ti-sgx-ddk-km', 'pvr-mesa.inc', '', d)} diff --git a/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb new file mode 100644 index 00000000..0de3cb94 --- /dev/null +++ b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb @@ -0,0 +1,57 @@ +# PowerVR Graphics require several patches that have not made their way +# upstream yet. This allows us to build the shims we need without completely +# clobbering mesa. + +require recipes-graphics/mesa/mesa.inc + +SUMMARY += " (with PowerVR support for TI platforms)" + +LIC_FILES_CHKSUM = "file://docs/license.rst;md5=63779ec98d78d823a9dc533a0735ef10" + +BRANCH = "powervr/kirkstone/${PV}" + +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://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ + file://0001-util-format-Check-for-NEON-before-using-it.patch \ + file://0001-gbm-backend-fix-gbm-compile-without-dri.patch \ + file://0001-freedreno-pm4-Use-unsigned-instead-of-uint-to-fix-mu.patch \ +" + +S = "${WORKDIR}/git" + +SRCREV = "54fd9d7dea098b6f11c2a244b0c6763dc8c5690c" + +PACKAGECONFIG:append = " \ + ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/gpudriver', 'ti-img-rogue-driver', 'pvr', '', d)} \ + ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/gpudriver', 'ti-sgx-ddk-km', 'sgx', '', d)} \ +" + +PVR_DISPLAY_CONTROLLER_ALIAS ??= "tidss" +PACKAGECONFIG[pvr] = "-Dgallium-pvr-alias=${PVR_DISPLAY_CONTROLLER_ALIAS}," +PACKAGECONFIG[sgx] = "-Dgallium-sgx-alias=${PVR_DISPLAY_CONTROLLER_ALIAS}," + +PACKAGECONFIG:remove = "video-codecs" +PACKAGECONFIG[video-codecs] = "" +PACKAGECONFIG:remove = "elf-tls" +PACKAGECONFIG[elf-tls] = "" +PACKAGECONFIG:remove = "xvmc" +PACKAGECONFIG[xvmc] = "" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'pvr', ',pvr', '', d)}" +GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'sgx', ',sgx', '', d)}" + +VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'pvr', ',pvr', '', d)}" + +do_install:append () { + # remove pvr custom pkgconfig + rm -rf ${D}${datadir}/pkgconfig +} + +FILES:${PN}-dev += "${datadir}/mesa/wayland-drm.xml" +FILES:mesa-vulkan-drivers += "${libdir}/libpvr_mesa_wsi.so" + +RRECOMMENDS:mesa-megadriver:append:class-target = " ${@d.getVar('PREFERRED_PROVIDER_virtual/gpudriver')}" diff --git a/meta-ti-bsp/recipes-graphics/mesa/mesa_22.%.bbappend b/meta-ti-bsp/recipes-graphics/mesa/mesa_22.%.bbappend deleted file mode 100644 index 912e9e9d..00000000 --- a/meta-ti-bsp/recipes-graphics/mesa/mesa_22.%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains_any('PREFERRED_PROVIDER_virtual/gpudriver', 'ti-img-rogue-driver ti-sgx-ddk-km', 'pvr-mesa.inc', '', d)} diff --git a/meta-ti-bsp/recipes-graphics/mesa/pvr-mesa.inc b/meta-ti-bsp/recipes-graphics/mesa/pvr-mesa.inc deleted file mode 100644 index caf94156..00000000 --- a/meta-ti-bsp/recipes-graphics/mesa/pvr-mesa.inc +++ /dev/null @@ -1,55 +0,0 @@ -# PowerVR Graphics require several patches that have not made their way -# upstream yet. This allows us to build the shims we need without completely -# clobbering mesa. - -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -LIC_FILES_CHKSUM = "file://docs/license.rst;md5=63779ec98d78d823a9dc533a0735ef10" - -BRANCH = "powervr/kirkstone/22.3.5" - -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://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ - file://0001-util-format-Check-for-NEON-before-using-it.patch \ - file://0001-gbm-backend-fix-gbm-compile-without-dri.patch \ - file://0001-freedreno-pm4-Use-unsigned-instead-of-uint-to-fix-mu.patch \ -" - -S = "${WORKDIR}/git" - -SRCREV = "54fd9d7dea098b6f11c2a244b0c6763dc8c5690c" - -PACKAGECONFIG:append = " \ - ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/gpudriver', 'ti-img-rogue-driver', 'pvr', '', d)} \ - ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/gpudriver', 'ti-sgx-ddk-km', 'sgx', '', d)} \ -" - -PVR_DISPLAY_CONTROLLER_ALIAS ??= "tidss" -PACKAGECONFIG[pvr] = "-Dgallium-pvr-alias=${PVR_DISPLAY_CONTROLLER_ALIAS}," -PACKAGECONFIG[sgx] = "-Dgallium-sgx-alias=${PVR_DISPLAY_CONTROLLER_ALIAS}," - -PACKAGECONFIG:remove = "video-codecs" -PACKAGECONFIG[video-codecs] = "" -PACKAGECONFIG:remove = "elf-tls" -PACKAGECONFIG[elf-tls] = "" -PACKAGECONFIG:remove = "xvmc" -PACKAGECONFIG[xvmc] = "" - -PACKAGE_ARCH = "${MACHINE_ARCH}" -PV = "22.3.5+pvr" - -GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'pvr', ',pvr', '', d)}" -GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'sgx', ',sgx', '', d)}" - -VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'pvr', ',pvr', '', d)}" - -do_install:append () { - # remove pvr custom pkgconfig - rm -rf ${D}${datadir}/pkgconfig -} - -FILES:mesa-vulkan-drivers += " ${libdir}/libpvr_mesa_wsi.so" - -RRECOMMENDS:mesa-megadriver:append:class-target = " ${@d.getVar('PREFERRED_PROVIDER_virtual/gpudriver')}" -- cgit v1.2.3-54-g00ecf