diff mbox series

[v8,1/1] package/igt-gpu-tools: new package

Message ID 20240321230738.2919656-1-bernd@kuhls.net
State Accepted
Headers show
Series [v8,1/1] package/igt-gpu-tools: new package | expand

Commit Message

Bernd Kuhls March 21, 2024, 11:07 p.m. UTC
From: Gaël PORTAY <gael.portay@rtone.fr>

IGT GPU Tools is a collection of tools for development and testing of
the DRM drivers

Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr>
Signed-off-by: Andy Yan <andyshrk@163.com>
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[Bernd: v4
 - add myself to DEVELOPERS
 - add dependencies to locales, mmu, wchar and headers >= 4.11
 - rework libunwind dependency
 - remove duplicate libglib2 dependency
 v5
 - added optional dependency to json_c
 - remove broken igt_stats binary
 v6
 - updated patch series after upstream review
 v8
 - bumped to current git HEAD to fix musl build errors
 - removed all patches which are included in upstream repo
 - added fix for segfaults with hardened toolchains on x86/x86_64]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
[Francois: v7
 - depend on !BR2_RELRO_FULL
 - remove specific workaround for igt_stats binary]

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Run-time tested on a x86_64 system built with BR2_RELRO_FULL=y

    intel-gpu-top: Intel Rocketlake (Gen12) @ /dev/dri/card0

Build-tested using this defconfig

BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_PACKAGE_IGT_GPU_TOOLS=y

                             arm-aarch64 [ 1/42]: OK
                   bootlin-aarch64-glibc [ 2/42]: OK
               bootlin-arcle-hs38-uclibc [ 3/42]: OK
                    bootlin-armv5-uclibc [ 4/42]: OK
                     bootlin-armv7-glibc [ 5/42]: OK
                   bootlin-armv7m-uclibc [ 6/42]: SKIPPED
                      bootlin-armv7-musl [ 7/42]: OK
                bootlin-m68k-5208-uclibc [ 8/42]: SKIPPED
               bootlin-m68k-68040-uclibc [ 9/42]: OK
             bootlin-microblazeel-uclibc [10/42]: OK
                bootlin-mipsel32r6-glibc [11/42]: OK
                   bootlin-mipsel-uclibc [12/42]: OK
                     bootlin-nios2-glibc [13/42]: OK
                 bootlin-openrisc-uclibc [14/42]: OK
        bootlin-powerpc64le-power8-glibc [15/42]: OK
           bootlin-powerpc-e500mc-uclibc [16/42]: OK
                   bootlin-riscv32-glibc [17/42]: OK
                   bootlin-riscv64-glibc [18/42]: OK
                    bootlin-riscv64-musl [19/42]: OK
                 bootlin-s390x-z13-glibc [20/42]: OK
                      bootlin-sh4-uclibc [21/42]: OK
                   bootlin-sparc64-glibc [22/42]: OK
                    bootlin-sparc-uclibc [23/42]: SKIPPED
                    bootlin-x86-64-glibc [24/42]: OK
                     bootlin-x86-64-musl [25/42]: OK
                   bootlin-x86-64-uclibc [26/42]: OK
                   bootlin-xtensa-uclibc [27/42]: OK
                            br-arm-basic [28/42]: SKIPPED
                    br-arm-full-nothread [29/42]: SKIPPED
                      br-arm-full-static [30/42]: SKIPPED
                   br-i386-pentium4-full [31/42]: SKIPPED
                br-i386-pentium-mmx-musl [32/42]: SKIPPED
                      br-mips64-n64-full [33/42]: FAILED
                 br-mips64r6-el-hf-glibc [34/42]: OK
               br-powerpc-603e-basic-cpp [35/42]: SKIPPED
               br-powerpc64-power7-glibc [36/42]: OK
                       linaro-aarch64-be [37/42]: SKIPPED
                          linaro-aarch64 [38/42]: SKIPPED
                              linaro-arm [39/42]: SKIPPED
                         sourcery-mips64 [40/42]: SKIPPED
                           sourcery-mips [41/42]: SKIPPED
                          sourcery-nios2 [42/42]: OK
42 builds, 14 skipped, 1 build failed, 0 legal-info failed, 0 show-info failed

The build error with br-mips64-n64-full is caused by this commit
missing in the uclibc headers of the 2020 toolchain:
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/include/assert.h?id=03fbd941e943976bb92cb392882c2ff7ec218704

 DEVELOPERS                               |  1 +
 package/Config.in                        |  1 +
 package/igt-gpu-tools/Config.in          | 32 +++++++++++++++
 package/igt-gpu-tools/igt-gpu-tools.hash |  5 +++
 package/igt-gpu-tools/igt-gpu-tools.mk   | 52 ++++++++++++++++++++++++
 5 files changed, 91 insertions(+)
 create mode 100644 package/igt-gpu-tools/Config.in
 create mode 100644 package/igt-gpu-tools/igt-gpu-tools.hash
 create mode 100644 package/igt-gpu-tools/igt-gpu-tools.mk
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 0f28151785..31ceeee450 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -372,6 +372,7 @@  F:	package/gpsd/
 F:	package/gptfdisk/
 F:	package/hddtemp/
 F:	package/hdparm/
+F:	package/igt-gpu-tools/
 F:	package/intel-gmmlib/
 F:	package/intel-mediadriver/
 F:	package/intel-mediasdk/
diff --git a/package/Config.in b/package/Config.in
index e03e1d93aa..09006744af 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -323,6 +323,7 @@  comment "Graphic applications"
 	source "package/glmark2/Config.in"
 	source "package/glslsandbox-player/Config.in"
 	source "package/gnuplot/Config.in"
+	source "package/igt-gpu-tools/Config.in"
 	source "package/ivi-homescreen/Config.in"
 	source "package/jhead/Config.in"
 	source "package/kmscube/Config.in"
diff --git a/package/igt-gpu-tools/Config.in b/package/igt-gpu-tools/Config.in
new file mode 100644
index 0000000000..809c8e28ac
--- /dev/null
+++ b/package/igt-gpu-tools/Config.in
@@ -0,0 +1,32 @@ 
+config BR2_PACKAGE_IGT_GPU_TOOLS
+	bool "igt-gpu-tools"
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_ENABLE_LOCALE
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_PACKAGE_HAS_UDEV
+	depends on BR2_USE_WCHAR # elfutils
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_11 # linux/dma-buf.h
+	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # procps-ng
+	select BR2_PACKAGE_CAIRO
+	select BR2_PACKAGE_CAIRO_PNG
+	select BR2_PACKAGE_ELFUTILS
+	select BR2_PACKAGE_KMOD
+	select BR2_PACKAGE_LIBDRM
+	select BR2_PACKAGE_LIBGLIB2
+	select BR2_PACKAGE_LIBPCIACCESS
+	select BR2_PACKAGE_PIXMAN
+	select BR2_PACKAGE_PROCPS_NG
+	select BR2_PACKAGE_ZLIB
+	help
+	  IGT GPU Tools is a collection of tools for development and
+	  testing of the DRM drivers.
+
+	  https://gitlab.freedesktop.org/drm/igt-gpu-tools
+
+comment "igt-gpu-tools needs udev /dev management and toolchain w/ threads, wchar, dynamic library, locale, headers >= 4.11"
+	depends on BR2_USE_MMU
+	depends on !BR2_PACKAGE_HAS_UDEV || BR2_STATIC_LIBS || \
+		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR || \
+		!BR2_ENABLE_LOCALE || \
+		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_11
diff --git a/package/igt-gpu-tools/igt-gpu-tools.hash b/package/igt-gpu-tools/igt-gpu-tools.hash
new file mode 100644
index 0000000000..bf760b91d7
--- /dev/null
+++ b/package/igt-gpu-tools/igt-gpu-tools.hash
@@ -0,0 +1,5 @@ 
+# Locally calculated from download
+sha256  de6e9443d569e76333ec6c8ffc53937b6831224161fe69bf2f07efad3bd0e04a  igt-gpu-tools-0ee4074685c1e184f2d3612ea6eb4d126f9a2e23.tar.bz2
+
+# Hash for license file:
+sha256  1b7e266857b05808660f42369a4a797459d7b7bec7245e378aa28a8db2f213da  COPYING
diff --git a/package/igt-gpu-tools/igt-gpu-tools.mk b/package/igt-gpu-tools/igt-gpu-tools.mk
new file mode 100644
index 0000000000..927a1225a5
--- /dev/null
+++ b/package/igt-gpu-tools/igt-gpu-tools.mk
@@ -0,0 +1,52 @@ 
+################################################################################
+#
+# igt-gpu-tools
+#
+################################################################################
+
+IGT_GPU_TOOLS_VERSION = 0ee4074685c1e184f2d3612ea6eb4d126f9a2e23
+IGT_GPU_TOOLS_SOURCE = igt-gpu-tools-$(IGT_GPU_TOOLS_VERSION).tar.bz2
+IGT_GPU_TOOLS_SITE = https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/archive/$(IGT_GPU_TOOLS_VERSION)
+IGT_GPU_TOOLS_LICENSE = MIT
+IGT_GPU_TOOLS_LICENSE_FILES = COPYING
+IGT_GPU_TOOLS_INSTALL_STAGING = YES
+IGT_GPU_TOOLS_DEPENDENCIES = \
+	host-pkgconf \
+	cairo \
+	elfutils \
+	kmod \
+	libdrm \
+	libglib2 \
+	libpciaccess \
+	pixman \
+	procps-ng \
+	udev \
+	zlib
+
+# On x86 systems, libigt resolves igt_half_to_float and igt_float_to_half as
+# indirect functions at runtime by checking CPU features with igt_x86_features.
+# The igt_x86_features function is implemented is a different object and the
+# call uses the PLT itself. If lazy binding is disabled, this causes a segfault
+# while resolving the symbols for libigt on x64 systems. Disable BINDNOW on X86
+# systems to prevent the segfaults.
+# https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/102
+# https://bugs.gentoo.org/788625#c13
+ifeq ($(BR2_i386)$(BR2_x86_64)x$(BR2_RELRO_NONE),yx)
+IGT_GPU_TOOLS_LDFLAGS = $(TARGET_LDFLAGS) -Wl,-z,lazy
+endif
+
+ifeq ($(BR2_PACKAGE_JSON_C),y)
+IGT_GPU_TOOLS_CONF_OPTS += -Drunner=enabled
+IGT_GPU_TOOLS_DEPENDENCIES += json-c
+else
+IGT_GPU_TOOLS_CONF_OPTS += -Drunner=disabled
+endif
+
+ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
+IGT_GPU_TOOLS_CONF_OPTS += -Dlibunwind=enabled
+IGT_GPU_TOOLS_DEPENDENCIES += libunwind
+else
+IGT_GPU_TOOLS_CONF_OPTS += -Dlibunwind=disabled
+endif
+
+$(eval $(meson-package))