[Buildroot] [PATCH v5 1/1] package/igt-gpu-tools: new package

Bernd Kuhls bernd at kuhls.net
Tue Oct 24 18:14:12 UTC 2023


From: Gaël PORTAY <gael.portay at 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 at rtone.fr>
Signed-off-by: Andy Yan <andyshrk at 163.com>
Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
[Bernd: v4
 - add myself to DEVELOPERS
 - add patches to fix build with musl & uClibc
 - 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]
---
A v6 version is pending due to reviews for the musl patch series.

 DEVELOPERS                                    |   1 +
 package/Config.in                             |   1 +
 ...d-check-that-outb-is-present-in-io.h.patch |  34 +++
 ...limits.h-to-fix-build-with-musl-libc.patch | 215 ++++++++++++++++++
 .../0003-lib-igt_aux.h-Fix-musl-build.patch   |  46 ++++
 ...-lib-igt_x86.c-Fix-musl-uclibc-build.patch |  42 ++++
 ...gt_halffloat.c-Fix-musl-uclibc-build.patch |  45 ++++
 ...rks-gem_exec_tracer.c-Fix-musl-build.patch |  45 ++++
 ...arks-gem_syslatency.c-Fix-musl-build.patch |  42 ++++
 package/igt-gpu-tools/Config.in               |  32 +++
 package/igt-gpu-tools/igt-gpu-tools.hash      |   5 +
 package/igt-gpu-tools/igt-gpu-tools.mk        |  38 ++++
 12 files changed, 546 insertions(+)
 create mode 100644 package/igt-gpu-tools/0001-build-check-that-outb-is-present-in-io.h.patch
 create mode 100644 package/igt-gpu-tools/0002-Include-limits.h-to-fix-build-with-musl-libc.patch
 create mode 100644 package/igt-gpu-tools/0003-lib-igt_aux.h-Fix-musl-build.patch
 create mode 100644 package/igt-gpu-tools/0004-lib-igt_x86.c-Fix-musl-uclibc-build.patch
 create mode 100644 package/igt-gpu-tools/0005-lib-igt_halffloat.c-Fix-musl-uclibc-build.patch
 create mode 100644 package/igt-gpu-tools/0006-benchmarks-gem_exec_tracer.c-Fix-musl-build.patch
 create mode 100644 package/igt-gpu-tools/0007-benchmarks-gem_syslatency.c-Fix-musl-build.patch
 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 --git a/DEVELOPERS b/DEVELOPERS
index 56449b0d5f..a621fd762e 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -366,6 +366,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 ecd8668ee7..97ec46730e 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -318,6 +318,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/jhead/Config.in"
 	source "package/kmscube/Config.in"
 	source "package/libva-utils/Config.in"
diff --git a/package/igt-gpu-tools/0001-build-check-that-outb-is-present-in-io.h.patch b/package/igt-gpu-tools/0001-build-check-that-outb-is-present-in-io.h.patch
new file mode 100644
index 0000000000..ab5dddaa10
--- /dev/null
+++ b/package/igt-gpu-tools/0001-build-check-that-outb-is-present-in-io.h.patch
@@ -0,0 +1,34 @@
+From 9a433c2602b15ba329b9276121a6b0c1aca51077 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd at kuhls.net>
+Date: Sat, 21 Oct 2023 16:47:07 +0200
+Subject: [PATCH] build: check that outb is present in io.h
+
+With glibc if io.h exists, inb/outb are always defined.
+However on musl, io.h always exists but it may not define inb/outb.
+
+Thus, igt-gpu-tools builds with musl on non-x86 platforms will fail to
+link. Fix this by checking for both io.h and that outb() is defined.
+
+Upstream: https://patchwork.freedesktop.org/series/125427/
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index b35a00faa..cee8a7446 100644
+--- a/meson.build
++++ b/meson.build
+@@ -220,7 +220,7 @@ endif
+ if cc.has_header('libgen.h')
+ 	config.set('HAVE_LIBGEN_H', 1)
+ endif
+-if cc.has_header('sys/io.h')
++if cc.has_header('sys/io.h') and cc.has_function('outb', prefix: '#include <sys/io.h>')
+ 	config.set('HAVE_SYS_IO_H', 1)
+ endif
+ if cc.links('''
+-- 
+2.39.2
+
diff --git a/package/igt-gpu-tools/0002-Include-limits.h-to-fix-build-with-musl-libc.patch b/package/igt-gpu-tools/0002-Include-limits.h-to-fix-build-with-musl-libc.patch
new file mode 100644
index 0000000000..04564bfea2
--- /dev/null
+++ b/package/igt-gpu-tools/0002-Include-limits.h-to-fix-build-with-musl-libc.patch
@@ -0,0 +1,215 @@
+From 46cac4c5d108bfe6ee22ea4efb6dbb48e2b7e43f Mon Sep 17 00:00:00 2001
+From: Stefano Ragni <st3r4g at protonmail.com>
+Date: Sun, 22 Oct 2023 11:47:39 +0200
+Subject: [PATCH] Include limits.h to fix build with musl libc
+
+Original patch was added to void-linux:
+https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7
+
+Bug report with request to split the original patch into some
+functional changes:
+https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
+
+Upstream: https://patchwork.freedesktop.org/series/125427/
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ lib/amdgpu/amd_pci_unplug.c   | 1 +
+ lib/igt_audio.c               | 1 +
+ lib/igt_aux.c                 | 1 +
+ lib/igt_device_scan.c         | 1 +
+ lib/igt_eld.c                 | 1 +
+ lib/igt_frame.c               | 1 +
+ lib/igt_hwmon.c               | 1 +
+ runner/executor.c             | 1 +
+ runner/runner_tests.c         | 1 +
+ tests/device_reset.c          | 1 +
+ tests/intel/i915_pm_rpm.c     | 1 +
+ tests/kms_sysfs_edid_timing.c | 1 +
+ tests/testdisplay.c           | 1 +
+ tests/tools_test.c            | 1 +
+ tools/igt_compliance_utils.c  | 1 +
+ 15 files changed, 15 insertions(+)
+
+diff --git a/lib/amdgpu/amd_pci_unplug.c b/lib/amdgpu/amd_pci_unplug.c
+index 078398b5e..554f489c6 100644
+--- a/lib/amdgpu/amd_pci_unplug.c
++++ b/lib/amdgpu/amd_pci_unplug.c
+@@ -21,6 +21,7 @@
+  *
+ */
+ #include <linux/limits.h>
++#include <limits.h> // PATH_MAX
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <pthread.h>
+diff --git a/lib/igt_audio.c b/lib/igt_audio.c
+index e0b1bafe1..dd5e0d2c1 100644
+--- a/lib/igt_audio.c
++++ b/lib/igt_audio.c
+@@ -26,6 +26,7 @@
+ 
+ #include "config.h"
+ 
++#include <limits.h> // PATH_MAX
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <gsl/gsl_fft_real.h>
+diff --git a/lib/igt_aux.c b/lib/igt_aux.c
+index 18edc5ef9..d6aeb876b 100644
+--- a/lib/igt_aux.c
++++ b/lib/igt_aux.c
+@@ -31,6 +31,7 @@
+ #endif
+ #include <stdio.h>
+ #include <fcntl.h>
++#include <limits.h> // PATH_MAX
+ #include <pwd.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
+index f4f95fef3..23b17a715 100644
+--- a/lib/igt_device_scan.c
++++ b/lib/igt_device_scan.c
+@@ -27,6 +27,7 @@
+ #include "igt_list.h"
+ #include "intel_chipset.h"
+ 
++#include <limits.h> // PATH_MAX
+ #include <ctype.h>
+ #include <dirent.h>
+ #include <fcntl.h>
+diff --git a/lib/igt_eld.c b/lib/igt_eld.c
+index ef6625df1..3e9b8a404 100644
+--- a/lib/igt_eld.c
++++ b/lib/igt_eld.c
+@@ -26,6 +26,7 @@
+ #include "config.h"
+ 
+ #include <dirent.h>
++#include <limits.h> // PATH_MAX
+ #include <errno.h>
+ #include <glob.h>
+ #include <stdint.h>
+diff --git a/lib/igt_frame.c b/lib/igt_frame.c
+index 45523a79f..86b8aad4d 100644
+--- a/lib/igt_frame.c
++++ b/lib/igt_frame.c
+@@ -26,6 +26,7 @@
+ 
+ #include "config.h"
+ 
++#include <limits.h> // PATH_MAX
+ #include <fcntl.h>
+ #include <pixman.h>
+ #include <cairo.h>
+diff --git a/lib/igt_hwmon.c b/lib/igt_hwmon.c
+index f37ced2d9..53c346e73 100644
+--- a/lib/igt_hwmon.c
++++ b/lib/igt_hwmon.c
+@@ -2,6 +2,7 @@
+ /*
+  * Copyright © 2022 Intel Corporation
+  */
++#include <limits.h> // PATH_MAX
+ #include <sys/stat.h>
+ #include <sys/sysmacros.h>
+ #include <dirent.h>
+diff --git a/runner/executor.c b/runner/executor.c
+index d3e6296dd..d2737af89 100644
+--- a/runner/executor.c
++++ b/runner/executor.c
+@@ -1,6 +1,7 @@
+ #include <ctype.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#include <limits.h> // PATH_MAX
+ #include <glib.h>
+ #ifdef __linux__
+ #include <linux/watchdog.h>
+diff --git a/runner/runner_tests.c b/runner/runner_tests.c
+index a7e968f85..6d605251f 100644
+--- a/runner/runner_tests.c
++++ b/runner/runner_tests.c
+@@ -1,5 +1,6 @@
+ #include <dirent.h>
+ #include <fcntl.h>
++#include <limits.h> // PATH_MAX
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+diff --git a/tests/device_reset.c b/tests/device_reset.c
+index 9ebd479df..ecb01d29f 100644
+--- a/tests/device_reset.c
++++ b/tests/device_reset.c
+@@ -3,6 +3,7 @@
+  * Copyright(c) 2020 Intel Corporation. All rights reserved.
+  */
+ #include <fcntl.h>
++#include <limits.h> // PATH_MAX
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <signal.h>
+diff --git a/tests/intel/i915_pm_rpm.c b/tests/intel/i915_pm_rpm.c
+index 2b0a63bde..289dfc508 100644
+--- a/tests/intel/i915_pm_rpm.c
++++ b/tests/intel/i915_pm_rpm.c
+@@ -27,6 +27,7 @@
+ 
+ #include "config.h"
+ 
++#include <limits.h> // PATH_MAX
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <stdbool.h>
+diff --git a/tests/kms_sysfs_edid_timing.c b/tests/kms_sysfs_edid_timing.c
+index ee47a024e..5df2da533 100644
+--- a/tests/kms_sysfs_edid_timing.c
++++ b/tests/kms_sysfs_edid_timing.c
+@@ -22,6 +22,7 @@
+  */
+ #include "igt.h"
+ 
++#include <limits.h> // PATH_MAX
+ #include <dirent.h>
+ #include <fcntl.h>
+ #include <sys/stat.h>
+diff --git a/tests/testdisplay.c b/tests/testdisplay.c
+index 42218210f..4c31c0e59 100644
+--- a/tests/testdisplay.c
++++ b/tests/testdisplay.c
+@@ -58,6 +58,7 @@
+ #include <strings.h>
+ #include <unistd.h>
+ #include <termios.h>
++#include <limits.h> // PATH_MAX
+ #include <sys/poll.h>
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
+diff --git a/tests/tools_test.c b/tests/tools_test.c
+index 8412ba521..f36a61927 100644
+--- a/tests/tools_test.c
++++ b/tests/tools_test.c
+@@ -26,6 +26,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#include <limits.h> // PATH_MAX
+ #include <libgen.h>
+ #include <unistd.h>
+ #ifdef __linux__
+diff --git a/tools/igt_compliance_utils.c b/tools/igt_compliance_utils.c
+index 0faf3fc87..f6bd970e3 100644
+--- a/tools/igt_compliance_utils.c
++++ b/tools/igt_compliance_utils.c
+@@ -24,6 +24,7 @@
+  */
+ 
+ #include "igt.h"
++#include <limits.h> // PATH_MAX
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+-- 
+2.39.2
+
diff --git a/package/igt-gpu-tools/0003-lib-igt_aux.h-Fix-musl-build.patch b/package/igt-gpu-tools/0003-lib-igt_aux.h-Fix-musl-build.patch
new file mode 100644
index 0000000000..2ccf587963
--- /dev/null
+++ b/package/igt-gpu-tools/0003-lib-igt_aux.h-Fix-musl-build.patch
@@ -0,0 +1,46 @@
+From 3359989ee93c73f574dde5ed076536dd4d4398a6 Mon Sep 17 00:00:00 2001
+From: Stefano Ragni <st3r4g at protonmail.com>
+Date: Sun, 22 Oct 2023 11:57:32 +0200
+Subject: [PATCH] lib/igt_aux.h: Fix musl build
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Original patch was added to void-linux:
+https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7
+
+Bug report with request to split the original patch into some
+functional changes:
+https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
+
+Fixes build error:
+
+../lib/igt_aux.c:191:20: error: ‘struct sigevent’ has no member named ‘_sigev_un’
+  191 |                 sev.sigev_notify_thread_id = __igt_sigiter.tid;
+
+../lib/igt_aux.c:1994:12: error: ‘struct sigevent’ has no member named ‘_sigev_un’
+ 1994 |         sev.sigev_notify_thread_id = gettid();
+
+Upstream: https://patchwork.freedesktop.org/series/125427/
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ lib/igt_aux.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/igt_aux.h b/lib/igt_aux.h
+index fb76b0313..a13e8156a 100644
+--- a/lib/igt_aux.h
++++ b/lib/igt_aux.h
+@@ -48,7 +48,7 @@
+ # ifndef HAVE_GETTID
+ #  define gettid() (pid_t)(syscall(__NR_gettid))
+ # endif
+-# define sigev_notify_thread_id _sigev_un._tid
++# define sigev_notify_thread_id sigev_notify_function
+ #endif
+ 
+ /* auxialiary igt helpers from igt_aux.c */
+-- 
+2.39.2
+
diff --git a/package/igt-gpu-tools/0004-lib-igt_x86.c-Fix-musl-uclibc-build.patch b/package/igt-gpu-tools/0004-lib-igt_x86.c-Fix-musl-uclibc-build.patch
new file mode 100644
index 0000000000..122474e8a3
--- /dev/null
+++ b/package/igt-gpu-tools/0004-lib-igt_x86.c-Fix-musl-uclibc-build.patch
@@ -0,0 +1,42 @@
+From d68ce435fcfa52038e43c0997898e9c706fe36a4 Mon Sep 17 00:00:00 2001
+From: Stefano Ragni <st3r4g at protonmail.com>
+Date: Sun, 22 Oct 2023 12:06:01 +0200
+Subject: [PATCH] lib/igt_x86.c: Fix musl/uclibc build
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Original patch was added to void-linux:
+https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7
+
+Bug report with request to split the original patch into some
+functional changes:
+https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
+
+Fixes build error:
+../lib/igt_x86.c:295:6: error: ‘ifunc’ is not supported on this target
+  295 | void igt_memcpy_from_wc(void *dst, const void *src, unsigned long len)
+
+Upstream: https://patchwork.freedesktop.org/series/125427/
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ lib/igt_x86.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/igt_x86.c b/lib/igt_x86.c
+index 6ac700df0..8c102fd13 100644
+--- a/lib/igt_x86.c
++++ b/lib/igt_x86.c
+@@ -190,7 +190,7 @@ char *igt_x86_features_to_string(unsigned features, char *line)
+ }
+ #endif
+ 
+-#if defined(__x86_64__) && !defined(__clang__)
++#if defined(__x86_64__) && !defined(__clang__) && defined(__GLIBC__) && !defined(__UCLIBC__)
+ #pragma GCC push_options
+ #pragma GCC target("sse4.1")
+ #pragma GCC diagnostic ignored "-Wpointer-arith"
+-- 
+2.39.2
+
diff --git a/package/igt-gpu-tools/0005-lib-igt_halffloat.c-Fix-musl-uclibc-build.patch b/package/igt-gpu-tools/0005-lib-igt_halffloat.c-Fix-musl-uclibc-build.patch
new file mode 100644
index 0000000000..0591b5f256
--- /dev/null
+++ b/package/igt-gpu-tools/0005-lib-igt_halffloat.c-Fix-musl-uclibc-build.patch
@@ -0,0 +1,45 @@
+From 7da0501278532d4dde7b9fddd6300c24d4172628 Mon Sep 17 00:00:00 2001
+From: Stefano Ragni <st3r4g at protonmail.com>
+Date: Sun, 22 Oct 2023 12:08:54 +0200
+Subject: [PATCH] lib/igt_halffloat.c: Fix musl/uclibc build
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Original patch was added to void-linux:
+https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7
+
+Bug report with request to split the original patch into some
+functional changes:
+https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
+
+Fixes build error:
+../lib/igt_halffloat.c:205:6: error: ‘ifunc’ is not supported on this target
+  205 | void igt_float_to_half(const float *f, uint16_t *h, unsigned int num)
+
+../lib/igt_halffloat.c:216:6: error: ‘ifunc’ is not supported on this target
+  216 | void igt_half_to_float(const uint16_t *h, float *f, unsigned int num)
+
+Upstream: https://patchwork.freedesktop.org/series/125427/
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ lib/igt_halffloat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/igt_halffloat.c b/lib/igt_halffloat.c
+index 08ab05fce..5dbe08e01 100644
+--- a/lib/igt_halffloat.c
++++ b/lib/igt_halffloat.c
+@@ -162,7 +162,7 @@ static inline float _half_to_float(uint16_t val)
+ 	return fi.f;
+ }
+ 
+-#if defined(__x86_64__) && !defined(__clang__)
++#if defined(__x86_64__) && !defined(__clang__) && defined(__GLIBC__) && !defined(__UCLIBC__)
+ #pragma GCC push_options
+ #pragma GCC target("f16c")
+ 
+-- 
+2.39.2
+
diff --git a/package/igt-gpu-tools/0006-benchmarks-gem_exec_tracer.c-Fix-musl-build.patch b/package/igt-gpu-tools/0006-benchmarks-gem_exec_tracer.c-Fix-musl-build.patch
new file mode 100644
index 0000000000..f29c3a7d03
--- /dev/null
+++ b/package/igt-gpu-tools/0006-benchmarks-gem_exec_tracer.c-Fix-musl-build.patch
@@ -0,0 +1,45 @@
+From d69dbc4683cbefacf0901f4ff96973850ad33500 Mon Sep 17 00:00:00 2001
+From: mhmdanas <triallax at tutanota.com>
+Date: Sun, 22 Oct 2023 12:10:23 +0200
+Subject: [PATCH] benchmarks/gem_exec_tracer.c: Fix musl build
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Original patch was added to void-linux:
+https://github.com/void-linux/void-packages/commit/111918317d06598fe1459dbe139923404f3f4b9d
+
+Bug report with request to split the original patch into some
+functional changes:
+https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
+
+Fixes build error:
+../benchmarks/gem_exec_tracer.c:274:1: error: conflicting types for ‘ioctl’; have ‘int(int,  long unsigned int, ...)’
+  274 | ioctl(int fd, unsigned long request, ...)
+
+Upstream: https://patchwork.freedesktop.org/series/125427/
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ benchmarks/gem_exec_tracer.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/benchmarks/gem_exec_tracer.c b/benchmarks/gem_exec_tracer.c
+index 7e86473e4..3156dfc23 100644
+--- a/benchmarks/gem_exec_tracer.c
++++ b/benchmarks/gem_exec_tracer.c
+@@ -271,7 +271,11 @@ static int is_i915(int fd)
+ }
+ 
+ int
++#ifdef __GLIBC__
+ ioctl(int fd, unsigned long request, ...)
++#else
++ioctl(int fd, int request, ...)
++#endif
+ {
+ 	struct trace *t, **p;
+ 	va_list args;
+-- 
+2.39.2
+
diff --git a/package/igt-gpu-tools/0007-benchmarks-gem_syslatency.c-Fix-musl-build.patch b/package/igt-gpu-tools/0007-benchmarks-gem_syslatency.c-Fix-musl-build.patch
new file mode 100644
index 0000000000..94021a0fd3
--- /dev/null
+++ b/package/igt-gpu-tools/0007-benchmarks-gem_syslatency.c-Fix-musl-build.patch
@@ -0,0 +1,42 @@
+From 23654df67b8bf8170a8650d9a350345add52c742 Mon Sep 17 00:00:00 2001
+From: Stefano Ragni <st3r4g at protonmail.com>
+Date: Sun, 22 Oct 2023 12:11:43 +0200
+Subject: [PATCH] benchmarks/gem_syslatency.c: Fix musl build
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Original patch was added to void-linux:
+https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7
+
+Bug report with request to split the original patch into some
+functional changes:
+https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
+
+Fixes build error:
+../benchmarks/gem_syslatency.c:166:13: error: ‘union <anonymous>’ has no member named ‘sigev_notify_thread_id’
+  166 |         sev.sigev_notify_thread_id = gettid();
+
+Upstream: https://patchwork.freedesktop.org/series/125427/
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ benchmarks/gem_syslatency.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
+index 312c428b7..e0740fc11 100644
+--- a/benchmarks/gem_syslatency.c
++++ b/benchmarks/gem_syslatency.c
+@@ -46,6 +46,8 @@
+ #include <linux/unistd.h>
+ #endif
+ 
++#define sigev_notify_thread_id sigev_notify_function
++
+ #include "i915/gem_create.h"
+ #include "i915/gem_ring.h"
+ #include "igt_aux.h"
+-- 
+2.39.2
+
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..95cc3a639b
--- /dev/null
+++ b/package/igt-gpu-tools/igt-gpu-tools.hash
@@ -0,0 +1,5 @@
+# Locally calculated from download
+sha256  6f8b2b12704c0b37c22f32a3751688e7144f850faa715e85b26effdc5209cfd1  igt-gpu-tools-v1.28.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..6aecd42429
--- /dev/null
+++ b/package/igt-gpu-tools/igt-gpu-tools.mk
@@ -0,0 +1,38 @@
+################################################################################
+#
+# igt-gpu-tools
+#
+################################################################################
+
+IGT_GPU_TOOLS_VERSION = 1.28
+IGT_GPU_TOOLS_SOURCE = igt-gpu-tools-v$(IGT_GPU_TOOLS_VERSION).tar.bz2
+IGT_GPU_TOOLS_SITE = https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/archive/v$(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 zlib
+
+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
+
+# igt_stats is broken with Relocation link-time protections enabled
+# https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/102
+ifeq ($(BR2_RELRO_NONE),)
+define IGT_GPU_TOOLS_REMOVE_IGT_STATS
+	$(RM) -fr $(TARGET_DIR)/usr/bin/igt_stats
+endef
+IGT_GPU_TOOLS_POST_INSTALL_TARGET_HOOKS += IGT_GPU_TOOLS_REMOVE_IGT_STATS
+endif
+
+$(eval $(meson-package))
-- 
2.39.2




More information about the buildroot mailing list