Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport scarthgap] Add GPU support for i.MX95 #1999

Merged
merged 6 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions conf/machine/imx95-19x19-verdin.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#@TYPE: Machine
#@NAME: Toradex i.MX 95 19x19 Verdin board
#@NAME: Toradex i.MX 95 19x19 Verdin Evaluation Kit
#@SOC: i.MX95
#@DESCRIPTION: Machine configuration for Toradex i.MX 95 19x19 Verdin board
#@DESCRIPTION: Machine configuration for Toradex i.MX 95 19x19 Verdin Evaluation Ki
#@MAINTAINER: Flora Hu <[email protected]>

MACHINEOVERRIDES =. "mx95:"
Expand Down
10 changes: 10 additions & 0 deletions conf/machine/include/imx-base.inc
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,16 @@ PREFERRED_PROVIDER_opencl-headers:imxgpu ?= "imx-gpu-viv"
PREFERRED_PROVIDER_opencl-icd-loader:imxgpu ?= "imx-gpu-viv"
PREFERRED_PROVIDER_virtual/opencl-icd:imxgpu ?= "imx-gpu-viv"

PREFERRED_PROVIDER_virtual/egl:mx95-nxp-bsp ?= "mali-imx"
PREFERRED_PROVIDER_virtual/libgles1:mx95-nxp-bsp ?= "mali-imx"
PREFERRED_PROVIDER_virtual/libgles2:mx95-nxp-bsp ?= "mali-imx"
PREFERRED_PROVIDER_virtual/libgles3:mx95-nxp-bsp ?= "mali-imx"
PREFERRED_PROVIDER_opencl-clhpp:mx95-nxp-bsp ?= "opencl-clhpp"
PREFERRED_PROVIDER_opencl-headers:mx95-nxp-bsp ?= "opencl-headers"
# install libmali-opencl-icd package as the loaders backend
PREFERRED_PROVIDER_opencl-icd-loader:mx95-nxp-bsp ?= "opencl-icd-loader"
PREFERRED_PROVIDER_virtual/opencl-icd:mx95-nxp-bsp ?= "opencl-icd-loader"

PREFERRED_VERSION_weston:imx-nxp-bsp ??= "12.0.4.imx"
# i.MX 6 & 7 stay on weston 10.0 for fbdev
PREFERRED_VERSION_weston:mx6-nxp-bsp ??= "10.0.5.imx"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Only _mx8 machine do provide virtual/libgbm required for any drm* flavour
DRM-REMOVE:imxgpu = "drm-gl drm-gles2"
DRM-REMOVE:imxgpu:mx8-nxp-bsp = ""
DRM-REMOVE:imxgpu:mx95-nxp-bsp = ""
PACKAGECONFIG:remove = "${DRM-REMOVE}"
2 changes: 2 additions & 0 deletions dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ SRC_URI:append:imxgpu = " \

PACKAGECONFIG_GL_IMX_GPU = ""
PACKAGECONFIG_GL_IMX_GPU:mx8-nxp-bsp = "gbm kms"
PACKAGECONFIG_GL_IMX_GPU:mx95-nxp-bsp = "gbm kms"

PACKAGECONFIG_GL:imxpxp = "gles2"
PACKAGECONFIG_GL:imxgpu2d = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', ' gl', '', d)} \
Expand All @@ -31,6 +32,7 @@ PACKAGECONFIG += "${PACKAGECONFIG_PLATFORM}"

PACKAGECONFIG_VULKAN_IMX_GPU = ""
PACKAGECONFIG_VULKAN_IMX_GPU:mx8-nxp-bsp = "vulkan"
PACKAGECONFIG_VULKAN_IMX_GPU:mx9-nxp-bsp = "vulkan"
PACKAGECONFIG_VULKAN_IMX_GPU:mx8mm-nxp-bsp = ""
PACKAGECONFIG_VULKAN = ""
PACKAGECONFIG_VULKAN:imxgpu = "${PACKAGECONFIG_VULKAN_IMX_GPU}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ PACKAGECONFIG:remove:mx7-nxp-bsp = "xcomposite-egl xcomposite-glx"

# i.MX8 does never provide native x11, so required dependencies are not met
PACKAGECONFIG:remove:mx8-nxp-bsp = "xcomposite-egl xcomposite-glx"
PACKAGECONFIG:remove:mx95-nxp-bsp = "xcomposite-egl xcomposite-glx"
3 changes: 3 additions & 0 deletions dynamic-layers/qt6-layer/recipes-qt/qt6/qtbase_%.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ PACKAGECONFIG_GRAPHICS:imxgpu3d = " \
PACKAGECONFIG_GRAPHICS_IMX_GPU = ""
PACKAGECONFIG_GRAPHICS_IMX_GPU:mx8-nxp-bsp = " \
gbm kms"
PACKAGECONFIG_GRAPHICS_IMX_GPU:mx95-nxp-bsp = " \
gbm kms"

PACKAGECONFIG_GRAPHICS:use-mainline-bsp ?= " \
gles2 gbm kms"
Expand Down Expand Up @@ -51,4 +53,5 @@ PACKAGECONFIG_VULKAN:imxgpu = " \
${PACKAGECONFIG_VULKAN_IMX_GPU}"
PACKAGECONFIG_VULKAN_IMX_GPU = ""
PACKAGECONFIG_VULKAN_IMX_GPU:mx8-nxp-bsp = "vulkan"
PACKAGECONFIG_VULKAN_IMX_GPU:mx95-nxp-bsp = "vulkan"
PACKAGECONFIG_VULKAN_IMX_GPU:mx8mm-nxp-bsp = ""
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ PACKAGECONFIG:remove:use-mainline-bsp = "xcomposite-glx"
PACKAGECONFIG:remove:mx6-nxp-bsp = "xcomposite-egl xcomposite-glx"
PACKAGECONFIG:remove:mx7-nxp-bsp = "xcomposite-egl xcomposite-glx"
PACKAGECONFIG:remove:mx8-nxp-bsp = "xcomposite-egl xcomposite-glx"
PACKAGECONFIG:remove:mx95-nxp-bsp = "xcomposite-egl xcomposite-glx"
107 changes: 107 additions & 0 deletions recipes-graphics/mali/mali-imx.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
SUMMARY = "Graphics libraries and driver for i.MX Mali GPU"
SECTION = "libs"
DEPENDS = " \
libdrm \
vulkan-loader \
wayland \
wayland-protocols"
PROVIDES = " \
virtual/egl \
virtual/libgbm \
virtual/libgles1 \
virtual/libgles2 \
virtual/libgles3"

# The packaged binaries have been stripped of debug info, so disable
# operations accordingly.
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"

PACKAGES =+ " \
${PN}-libegl ${PN}-libegl-dev \
${PN}-libgbm ${PN}-libgbm-dev \
${PN}-libgles1 ${PN}-libgles1-dev \
${PN}-libgles2 ${PN}-libgles2-dev \
${PN}-libgles3 ${PN}-libgles3-dev \
${PN}-libvulkan \
${PN}-opencl-icd ${PN}-opencl-icd-dev"

# Since libmali.so is loaded by dlopen, include it in the main package
FILES:${PN} += " \
${libdir}/libmali.so \
${nonarch_base_libdir}/firmware"
FILES_SOLIBSDEV = ""
INSANE_SKIP:${PN} = "dev-so"
FILES:${PN}-libegl = " \
${libdir}/libEGL${SOLIBS}"
FILES:${PN}-libgbm = " \
${libdir}/libgbm${SOLIBS}"
FILES:${PN}-libgles1 = " \
${libdir}/libGLESv1_CM${SOLIBS}"
FILES:${PN}-libgles2 = " \
${libdir}/libGLESv2${SOLIBS}"
FILES:${PN}-opencl-icd = " \
${sysconfdir}/OpenCL"
FILES:${PN}-libvulkan = " \
${sysconfdir}/vulkan"

FILES:${PN}-dev = " \
${bindir}/malisc"
FILES:${PN}-libegl-dev = " \
${includedir}/EGL \
${includedir}/KHR \
${libdir}/libEGL${SOLIBSDEV} \
${libdir}/pkgconfig/egl.pc"
FILES:${PN}-libgbm-dev = " \
${includedir}/gbm.h \
${libdir}/libgbm${SOLIBSDEV} \
${libdir}/pkgconfig/gbm.pc"

# Consolidate GLES dev packages
PACKAGES =+ "${PN}-libgles-dev"
FILES:${PN}-libgles-dev = " \
${includedir}/GLES* \
${libdir}/libGLES*${SOLIBSDEV} \
${libdir}/pkgconfig/gles*.pc"
DEBIAN_NOAUTONAME:${PN}-libgles-dev = "1"
RREPLACES:${PN}-libgles-dev = "libgles-dev"
RPROVIDES:${PN}-libgles-dev = "libgles-dev"
RCONFLICTS:${PN}-libgles-dev = "libgles-dev"
ALLOW_EMPTY:${PN}-libgles1-dev = "1"
ALLOW_EMPTY:${PN}-libgles2-dev = "1"
ALLOW_EMPTY:${PN}-libgles3-dev = "1"
RDEPENDS:${PN}-libgles1-dev = "${PN}-libgles-dev"
RDEPENDS:${PN}-libgles2-dev = "${PN}-libgles-dev"
RDEPENDS:${PN}-libgles3-dev = "${PN}-libgles-dev"

FILES:${PN}-opencl-icd-dev = " \
${bindir}/mali_clcc"

python __anonymous() {

# Avoid Debian-renaming
for p in (("libegl", "libegl1" ),
("libgbm", "libgbm1" ),
("libgles1", "libglesv1-cm1"),
("libgles2", "libglesv2-2" ),
("libgles3", )):
fullp = "${PN}-" + p[0]
pkgs = "".join(' %s' % i for i in p)
d.setVar("DEBIAN_NOAUTONAME:" + fullp, "1")
d.appendVar("RREPLACES:" + fullp, pkgs)
d.appendVar("RPROVIDES:" + fullp, pkgs)
d.appendVar("RCONFLICTS:" + fullp, pkgs)
# libmali.so is loaded with dlopen, so an explicit runtime dependency is necessary
d.appendVar("RDEPENDS:" + fullp, "${PN}")

# For -dev, the first element is both the Debian and original name
fullp += "-dev"
pkgs = p[0] + "-dev"
d.setVar("DEBIAN_NOAUTONAME:" + fullp, "1")
d.appendVar("RREPLACES:" + fullp, pkgs)
d.appendVar("RPROVIDES:" + fullp, pkgs)
d.appendVar("RCONFLICTS:" + fullp, pkgs)
}

COMPATIBLE_MACHINE = "(mx95-nxp-bsp)"
25 changes: 25 additions & 0 deletions recipes-graphics/mali/mali-imx_r50.0.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require mali-imx.inc

LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://COPYING;md5=ca53281cc0caa7e320d4945a896fb837"

SRC_URI = "${FSL_MIRROR}/${BPN}-${PV}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true"
SRC_URI[sha256sum] = "a787a3285c3e288eedacf1a746de2bc9f5fdc15f35cf8b6147deb436183baf6f"
IMX_SRCREV_ABBREV = "39604c3"

S = "${WORKDIR}/${BPN}-${PV}-${IMX_SRCREV_ABBREV}"

inherit fsl-eula-unpack

do_install () {
install -d ${D}
cp -r ${S}/etc ${S}/usr ${D}

# Move firmware to nonarch_base_libdir
if [ "${base_libdir}" != "${nonarch_base_libdir}" ]; then
install -d ${D}${nonarch_base_libdir}
mv ${D}${base_libdir}/firmware ${D}${nonarch_base_libdir}
fi
}

PACKAGE_ARCH = "${MACHINE_SOCARCH}"
Loading