diff options
Diffstat (limited to 'meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles')
7 files changed, 120 insertions, 63 deletions
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/egl.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/egl.pc index f9935f258..65c4c1f3a 100644 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/egl.pc +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/egl.pc @@ -6,7 +6,7 @@ includedir=/usr/include Name: egl Description: MALI EGL library Requires.private: -Version: r8p0 +Version: 17.3 Libs: -L${libdir} -lEGL Libs.private: -lm -lpthread -ldl Cflags: -I${includedir} diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/gbm.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/gbm.pc index 02ea94e6f..c40b5f4fd 100644 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/gbm.pc +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/gbm.pc @@ -6,7 +6,7 @@ includedir=/usr/include Name: gbm Description: MALI gbm library Requires.private: -Version: r8p0 +Version: 17.3 Libs: -L${libdir} -lgbm Libs.private: -lm -lpthread -ldl Cflags: -I${includedir} diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1.pc index 489540079..39467f332 100644 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1.pc +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1.pc @@ -6,7 +6,7 @@ includedir=/usr/include Name: glesv1 Description: MALI OpenGL ES 1.1 library Requires.private: -Version: r8p0 +Version: 17.3 Libs: -L${libdir} -lGLESv1_CM Libs.private: -lm -lpthread -ldl Cflags: -I${includedir} diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1_cm.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1_cm.pc index 888af87ef..1547b4c82 100644 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1_cm.pc +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv1_cm.pc @@ -6,7 +6,7 @@ includedir=/usr/include Name: gles_cm Description: Mali OpenGL ES 1.1 CM library Requires.private: -Version: r8p0 +Version: 17.3 Libs: -L${libdir} -lGLESv1_CM Libs.private: -lm -lpthread -ldl Cflags: -I${includedir} diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv2.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv2.pc index 5047c3948..a0a84f233 100644 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv2.pc +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/glesv2.pc @@ -6,7 +6,7 @@ includedir=/usr/include Name: glesv2 Description: MALI OpenGL ES 2.0 library Requires.private: -Version: r8p0 +Version: 17.3 Libs: -L${libdir} -lGLESv2 Libs.private: -lm -lpthread -ldl Cflags: -I${includedir} diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/wayland-egl.pc b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/wayland-egl.pc deleted file mode 100644 index 719fb3e43..000000000 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/files/wayland-egl.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=/usr/lib -includedir=/usr/include - -Name: wayland-egl -Description: MALI wayland-egl library -Requires.private: -Version: r8p0 -Libs: -L${libdir} -lwayland-egl -Libs.private: -lm -lpthread -ldl -Cflags: -I${includedir} diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/libmali-xlnx.bb b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/libmali-xlnx.bb index 113710e33..8a1451e58 100644 --- a/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/libmali-xlnx.bb +++ b/meta-xilinx/meta-xilinx-bsp/recipes-graphics/libgles/libmali-xlnx.bb @@ -1,68 +1,65 @@ DESCRIPTION = "libGLES for ZynqMP with Mali 400" LICENSE = "Proprietary" -LICENSE_FLAGS = "xilinx" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Proprietary;md5=0557f9d92cf58f2ccdd50f62f8ac0b28" +LIC_FILES_CHKSUM = "file://EULA;md5=82e466d0ed92c5a15f568dbe6b31089c" -inherit distro_features_check -inherit xilinx-fetch-restricted +inherit features_check update-alternatives -ANY_OF_DISTRO_FEATURES = "fbdev x11" +ANY_OF_DISTRO_FEATURES = "x11 fbdev wayland" PROVIDES += "virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm" -FILESEXTRAPATHS_append := " \ - ${THISDIR}/files: \ - ${THISDIR}/r8p0-00rel0: " +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +REPO ?= "git://github.com/Xilinx/mali-userspace-binaries.git;protocol=https" +BRANCH ?= "rel-v2020.1" +SRCREV ?= "da73805e3e011382c4d014ac10037cd193aaa9a0" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" -# Fetch the MALI 400 binaries from here -# https://www.xilinx.com/member/forms/download/mali-driver-license.html?filename=mali-400-userspace.tar - -PV = "r8p0-01rel0" +PV = "r9p0-01rel0" SRC_URI = " \ - https://www.xilinx.com/member/forms/download/mali-driver-license.html?filename=mali-400-userspace.tar;downloadfilename=mali-400-userspace.tar \ + ${REPO};${BRANCHARG} \ file://egl.pc \ file://glesv1_cm.pc \ file://glesv1.pc \ file://glesv2.pc \ - file://wayland-egl.pc \ file://gbm.pc \ " -SRC_URI[md5sum] = "4fd3456564ef8c818e21432221c9e1b7" -SRC_URI[sha256sum] = "26d473ae77c36104a215710beca55a22a712850dc26547dde950c7398210602c" - COMPATIBLE_MACHINE = "^$" COMPATIBLE_MACHINE_zynqmpeg = "zynqmpeg" COMPATIBLE_MACHINE_zynqmpev = "zynqmpev" -PACKAGE_ARCH = "${SOC_FAMILY}" +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" -S = "${WORKDIR}/mali-400" +S = "${WORKDIR}/git" +# If were switching at runtime, we would need all RDEPENDS needed for all backends available X11RDEPENDS = "libxdamage libxext libx11 libdrm libxfixes" X11DEPENDS = "libxdamage libxext virtual/libx11 libdrm libxfixes" +# Don't install runtime dependencies for other backends unless the DISTRO supports it RDEPENDS_${PN} = " \ - kernel-module-mali \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11RDEPENDS}', '', d)} \ - " + kernel-module-mali \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11RDEPENDS}', '', d)} \ +" +# We dont build anything but we want to avoid QA warning build-deps DEPENDS = "\ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland libdrm', '', d)} \ - " + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland libdrm', '', d)} \ +" + + +# x11 is default, set to "fbdev" , "wayland", or "headless" if required +MALI_BACKEND_DEFAULT ?= "x11" USE_X11 = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "yes", "no", d)}" USE_FB = "${@bb.utils.contains("DISTRO_FEATURES", "fbdev", "yes", "no", d)}" USE_WL = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "yes", "no", d)}" -do_compile() { - # Extract the MALI binaries into workdir - tar -xf ${WORKDIR}/mali/rel-v2018.3/r8p0-01rel0.tar -C ${S} -} +MONOLITHIC_LIBMALI = "libMali.so.9.0" do_install() { #Identify the ARCH type @@ -94,26 +91,84 @@ do_install() { cp -a --no-preserve=ownership ${S}/${PV}/${ARCH_PLATFORM_DIR}/common/*.so* ${D}${libdir} - if [ "${USE_WL}" = "yes" ]; then - install -m 0644 ${S}/${PV}/glesHeaders/GBM/gbm.h ${D}${includedir}/ - install -m 0644 ${WORKDIR}/gbm.pc ${D}${libdir}/pkgconfig/gbm.pc - install -m 0644 ${WORKDIR}/wayland-egl.pc ${D}${libdir}/pkgconfig/wayland-egl.pc - install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/wayland/libMali.so.8.0 ${D}${libdir}/wayland/libMali.so.8.0 - ln -snf wayland/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0 - elif [ "${USE_X11}" = "yes" ]; then - install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/x11/libMali.so.8.0 ${D}${libdir}/x11/libMali.so.8.0 - ln -snf x11/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0 - elif [ "${USE_FB}" = "yes" ]; then - install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/fbdev/libMali.so.8.0 ${D}${libdir}/fbdev/libMali.so.8.0 - ln -snf fbdev/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0 - else - install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/headless/libMali.so.8.0 ${D}${libdir}/headless/libMali.so.8.0 - ln -snf headless/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0 - fi + install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/headless/${MONOLITHIC_LIBMALI} ${D}${libdir}/headless/${MONOLITHIC_LIBMALI} + ln -snf headless/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} - if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then + if [ "${USE_FB}" = "yes" ]; then + install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/fbdev/${MONOLITHIC_LIBMALI} ${D}${libdir}/fbdev/${MONOLITHIC_LIBMALI} + if [ "${MALI_BACKEND_DEFAULT}" = "fbdev" ]; then + ln -snf fbdev/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} + fi + fi + if [ "${USE_X11}" = "yes" ]; then + install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/x11/${MONOLITHIC_LIBMALI} ${D}${libdir}/x11/${MONOLITHIC_LIBMALI} + if [ "${MALI_BACKEND_DEFAULT}" = "x11" ]; then + ln -snf x11/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} + fi + else + # We cant rely on the fact that all apps will use pkgconfig correctly sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if (1)/' ${D}${includedir}/EGL/eglplatform.h fi + if [ "${USE_WL}" = "yes" ]; then + install -m 0644 ${S}/${PV}/glesHeaders/GBM/gbm.h ${D}${includedir}/ + install -m 0644 ${WORKDIR}/gbm.pc ${D}${libdir}/pkgconfig/gbm.pc + install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/wayland/${MONOLITHIC_LIBMALI} ${D}${libdir}/wayland/${MONOLITHIC_LIBMALI} + if [ "${MALI_BACKEND_DEFAULT}" = "wayland" ]; then + ln -snf wayland/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} + fi + fi +} + + +# We need separate packages to provide multiple alternatives, at this point we install +# everything on the default one but that can be split if necessary +PACKAGES += "${PN}-x11 ${PN}-fbdev ${PN}-wayland ${PN}-headless" + +# This is default/common for all alternatives +ALTERNATIVE_LINK_NAME[libmali-xlnx] = "${libdir}/${MONOLITHIC_LIBMALI}" + + +# Declare alternatives and corresponding library location +ALTERNATIVE_${PN}-x11 = "libmali-xlnx" +ALTERNATIVE_TARGET_libmali-xlnx-x11[libmali-xlnx] = "${libdir}/x11/${MONOLITHIC_LIBMALI}" + +ALTERNATIVE_${PN}-fbdev = "libmali-xlnx" +ALTERNATIVE_TARGET_libmali-xlnx-fbdev[libmali-xlnx] = "${libdir}/fbdev/${MONOLITHIC_LIBMALI}" + +ALTERNATIVE_${PN}-wayland = "libmali-xlnx" +ALTERNATIVE_TARGET_libmali-xlnx-wayland[libmali-xlnx] = "${libdir}/wayland/${MONOLITHIC_LIBMALI}" + +ALTERNATIVE_${PN}-headless = "libmali-xlnx" +ALTERNATIVE_TARGET_libmali-xlnx-headless[libmali-xlnx] = "${libdir}/headless/${MONOLITHIC_LIBMALI}" + +# Set priorities according to what we prveiously defined +ALTERNATIVE_PRIORITY_libmali-xlnx-x11[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "x11", "20", "10", d)}" +ALTERNATIVE_PRIORITY_libmali-xlnx-fbdev[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "fbdev", "20", "10", d)}" +ALTERNATIVE_PRIORITY_libmali-xlnx-wayland[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "wayland", "20", "10", d)}" + +# If misconfigured, fallback to headless +ALTERNATIVE_PRIORITY_libmali-xlnx-headless[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "headless", "20", "15", d)}" + + +# Package gets renamed on the debian class, but we want to keep -xlnx +DEBIAN_NOAUTONAME_libmali-xlnx = "1" + +# Update alternatives will actually have separate postinst scripts (one for each package) +# This wont work for us, so we create a common postinst script and we pass that as the general +# libmali-xlnx postinst script, but we defer execution to run on first boot (pkg_postinst_ontarget). +# This will avoid ldconfig removing the symbolic links when creating the root filesystem. +python populate_packages_updatealternatives_append () { + # We need to remove the 'fake' libmali-xlnx before creating any links + libdir = d.getVar('libdir') + common_postinst = "#!/bin/sh\nrm " + libdir + "/${MONOLITHIC_LIBMALI}\n" + for pkg in (d.getVar('PACKAGES') or "").split(): + # Not all packages provide an alternative (e.g. ${PN}-lic) + postinst = d.getVar('pkg_postinst_%s' % pkg) + if postinst: + old_postinst = postinst + new_postinst = postinst.replace('#!/bin/sh','') + common_postinst += new_postinst + d.setVar('pkg_postinst_ontarget_%s' % 'libmali-xlnx', common_postinst) } @@ -130,3 +185,17 @@ RCONFLICTS_${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2 libgbm" # explicitly depends upon them. EXCLUDE_FROM_WORLD = "1" FILES_${PN} += "${libdir}/*" + +do_package_append() { + + shlibswork_dir = d.getVar('SHLIBSWORKDIR') + pkg_filename = d.getVar('PN') + ".list" + shlibs_file = os.path.join(shlibswork_dir, pkg_filename) + lines = "" + with open(shlibs_file, "r") as f: + lines = f.readlines() + with open(shlibs_file, "w") as f: + for line in lines: + if d.getVar('MALI_BACKEND_DEFAULT') in line.strip("\n"): + f.write(line) +} |