From nobody Fri Sep 9 15:07:59 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MPK9q5zT2z4bcKg; Fri, 9 Sep 2022 15:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MPK9q5jYyz3qC8; Fri, 9 Sep 2022 15:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662736079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VksbzRS7F44POD8FbMwuRZ953MXJfm/tU1ATbWVIJDA=; b=uN9wgOLy9t6urjBmgssngU4vRzjaLy0axKXxxpx4j9z4RqDFzb800nEPPR/ICdUlpxlSLe s+oA3YWkMVnhiWhqQLAu9rKSuUKz9nIRKjBb5MFrZCXki/E/p3KbOJz6DpWc7MTUQh1xLM gu6Nf2rOTXgHBK6tDW4DLvDdIGjOV2v8gRDgf94SHbKel6GFnpYg0uQU5oyIQWEMFI780x p4+8sJ7UYFos4jLRMWWDOPrYqBXC5CKs67T7KslrrUCCGE1op+eAniG0cIIX/E1y4pKa5J BIr7UUiSobzrZq510kufXhwtWBVXfWzSldWzlpLZIZt7l14P1l4ZOmArUW7QtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MPK9q4fHpz1FFC; Fri, 9 Sep 2022 15:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 289F7xbF083437; Fri, 9 Sep 2022 15:07:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 289F7xNA083436; Fri, 9 Sep 2022 15:07:59 GMT (envelope-from git) Date: Fri, 9 Sep 2022 15:07:59 GMT Message-Id: <202209091507.289F7xNA083436@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Joseph Mingrone Subject: git: 5d303ab48075 - main - graphics/igt-gpu-tools: Test suite for drm drivers List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrm X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d303ab480752af223894480f7494e23785e9cd7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662736079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VksbzRS7F44POD8FbMwuRZ953MXJfm/tU1ATbWVIJDA=; b=fbD9rC/+BYd/LLYYTUviAK1qe5rhrAGq7VCVy4qqEdcU/5snUi32zLAy8159+/h7ggNY+w FCrClIe2CIF7flCpTX7sT+daKpv52m1z/1alJXIQ3O58uwr92+q4pPP68XypmYuacqbEyN Ke69ZCJWPCEli7jCOCm/hF5q2aDHItTp8mriWPjwsSR9JBqSpZTDjr54zQDiJ/l/PjQivd wW+xcS9IxMDOvp+DotnqwOr6yIeaXQb7JO/I4Ne5+88x39VEdWHy3kEoI5ipcbI1hQ92Ov RyGbiZQf9fxkjGri+4nt3bFgqdDWXBgjOOsE+IE241SWuP06tXvlydizUMl04g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662736079; a=rsa-sha256; cv=none; b=fFvMUc5JpH35y4Ilfe8YMV8zpjl+nzdvum+5/L+iP9TFVwTx1jlIBgasQVdUyauKLcHpXE JYV3f3AJ9P40o6gn9fDigCl/ohjyfN1deA0W9AgSezr8Ou/VjXk0TDuJYp1DcfZ4Dw4GW4 teGiF4qu8mKoLHvspsVXRcceNPTHy2BMUdu2SBhB4dWfwV19Mb5DP4yk7gCtuYhCx2vwhK J8L01+nLXcRAwZS8oFUS8TxElWat55ewqabyd8v1502AVBYhSm3S0KJh4oLAN4RAd68oNF OgSU9eJS20r8IOVz6kwo6zxg69gsOts1Q8UR0yZG2VjWA1e6MpIjliElHEnhVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrm: URL: https://cgit.FreeBSD.org/ports/commit/?id=5d303ab480752af223894480f7494e23785e9cd7 commit 5d303ab480752af223894480f7494e23785e9cd7 Author: Jake Freeland AuthorDate: 2022-09-08 18:44:40 +0000 Commit: Joseph Mingrone CommitDate: 2022-09-09 15:06:45 +0000 graphics/igt-gpu-tools: Test suite for drm drivers The igt testing suite is separated into tests and tools that target kms, memory management, and command submission. These tests are especially helpful for low-level reporting, transparent tracking of kernel changes, and efficient debugging of modern drm drivers. Reviewed by: diizzy, lwhsu, jrm Differential Revision: https://reviews.freebsd.org/D36213 --- graphics/Makefile | 1 + graphics/igt-gpu-tools/Makefile | 70 +++ graphics/igt-gpu-tools/distinfo | 3 + .../files/patch-benchmarks_gem__exec__tracer.c | 13 + .../files/patch-benchmarks_gem__syslatency.c | 24 + .../files/patch-include_linux-uapi_sync__file.h | 19 + .../files/patch-lib_i915_gem__engine__topology.c | 13 + .../igt-gpu-tools/files/patch-lib_i915_gem__mman.c | 14 + .../files/patch-lib_i915_intel__memory__region.c | 14 + graphics/igt-gpu-tools/files/patch-lib_i915_perf.c | 12 + .../igt-gpu-tools/files/patch-lib_igt__audio.c | 13 + graphics/igt-gpu-tools/files/patch-lib_igt__aux.c | 75 ++++ graphics/igt-gpu-tools/files/patch-lib_igt__aux.h | 23 + graphics/igt-gpu-tools/files/patch-lib_igt__core.c | 54 +++ graphics/igt-gpu-tools/files/patch-lib_igt__core.h | 23 + .../igt-gpu-tools/files/patch-lib_igt__debugfs.c | 23 + .../igt-gpu-tools/files/patch-lib_igt__device.c | 12 + .../files/patch-lib_igt__device__scan.c | 14 + .../igt-gpu-tools/files/patch-lib_igt__dummyload.c | 29 ++ graphics/igt-gpu-tools/files/patch-lib_igt__eld.c | 13 + .../igt-gpu-tools/files/patch-lib_igt__frame.c | 13 + graphics/igt-gpu-tools/files/patch-lib_igt__kmod.c | 131 ++++++ graphics/igt-gpu-tools/files/patch-lib_igt__kmod.h | 12 + graphics/igt-gpu-tools/files/patch-lib_igt__kms.c | 13 + graphics/igt-gpu-tools/files/patch-lib_igt__os.c | 42 ++ graphics/igt-gpu-tools/files/patch-lib_igt__perf.c | 78 ++++ graphics/igt-gpu-tools/files/patch-lib_igt__perf.h | 24 + graphics/igt-gpu-tools/files/patch-lib_igt__pm.c | 12 + .../igt-gpu-tools/files/patch-lib_igt__syncobj.c | 13 + .../igt-gpu-tools/files/patch-lib_igt__sysfs.c | 12 + graphics/igt-gpu-tools/files/patch-lib_igt__vgem.c | 14 + .../files/patch-lib_intel__allocator.c | 13 + .../files/patch-lib_intel__batchbuffer.c | 14 + graphics/igt-gpu-tools/files/patch-lib_sw__sync.c | 13 + .../files/patch-lib_tests_igt__exit__handler.c | 12 + .../files/patch-lib_tests_igt__fork.c | 14 + .../files/patch-lib_tests_igt__tests__common.h | 20 + graphics/igt-gpu-tools/files/patch-meson.build | 31 ++ .../igt-gpu-tools/files/patch-runner_executor.c | 39 ++ .../igt-gpu-tools/files/patch-runner_job__list.c | 72 +++ .../files/patch-runner_runner__tests.c | 183 ++++++++ .../igt-gpu-tools/files/patch-runner_settings.c | 51 +++ .../igt-gpu-tools/files/patch-tests_core__auth.c | 13 + .../files/patch-tests_drm__import__export.c | 13 + .../igt-gpu-tools/files/patch-tests_dumb__buffer.c | 14 + .../files/patch-tests_i915_gem__close__race.c | 23 + .../files/patch-tests_i915_gem__concurrent__all.c | 14 + .../files/patch-tests_i915_gem__create.c | 13 + .../files/patch-tests_i915_gem__ctx__exec.c | 13 + .../files/patch-tests_i915_gem__ctx__persistence.c | 13 + .../files/patch-tests_i915_gem__ctx__shared.c | 13 + .../files/patch-tests_i915_gem__exec__fence.c | 13 + .../files/patch-tests_i915_gem__exec__latency.c | 13 + .../files/patch-tests_i915_gem__exec__schedule.c | 67 +++ .../files/patch-tests_i915_gem__lmem__swapping.c | 13 + .../files/patch-tests_i915_gem__madvise.c | 13 + .../files/patch-tests_i915_gem__mmap__gtt.c | 31 ++ .../files/patch-tests_i915_gem__mmap__offset.c | 31 ++ .../files/patch-tests_i915_gem__pread.c | 40 ++ .../files/patch-tests_i915_gem__pwrite.c | 40 ++ .../files/patch-tests_i915_gem__shrink.c | 13 + .../files/patch-tests_i915_gem__userptr__blits.c | 52 +++ .../files/patch-tests_i915_gem__wait.c | 13 + .../files/patch-tests_i915_i915__hangman.c | 13 + .../files/patch-tests_i915_i915__module__load.c | 12 + .../files/patch-tests_i915_i915__pm__backlight.c | 13 + .../files/patch-tests_i915_i915__pm__rpm.c | 31 ++ .../files/patch-tests_i915_kms__psr2__su.c | 18 + .../patch-tests_i915_kms__psr__stress__test.c | 32 ++ .../patch-tests_i915_sysfs__heartbeat__interval.c | 13 + .../files/patch-tests_kms__content__protection.c | 12 + .../files/patch-tests_kms__cursor__legacy.c | 13 + .../igt-gpu-tools/files/patch-tests_kms__flip.c | 13 + .../files/patch-tests_kms__sysfs__edid__timing.c | 13 + .../igt-gpu-tools/files/patch-tests_meson.build | 174 +++++++ .../igt-gpu-tools/files/patch-tests_sw__sync.c | 12 + .../files/patch-tests_syncobj__timeline.c | 13 + .../files/patch-tests_syncobj__wait.c | 13 + .../igt-gpu-tools/files/patch-tests_tools__test.c | 15 + .../files/patch-tests_vc4__purgeable__bo.c | 13 + .../files/patch-tests_vc4__wait__bo.c | 13 + .../files/patch-tests_vc4__wait__seqno.c | 13 + .../files/patch-tools_intel__gvtg__test.c | 12 + .../igt-gpu-tools/files/patch-tools_meson.build | 24 + graphics/igt-gpu-tools/pkg-descr | 7 + graphics/igt-gpu-tools/pkg-plist | 498 +++++++++++++++++++++ 86 files changed, 2746 insertions(+) diff --git a/graphics/Makefile b/graphics/Makefile index 08b6ea89c477..26c2447b9337 100644 --- a/graphics/Makefile +++ b/graphics/Makefile @@ -352,6 +352,7 @@ SUBDIR += icoutils SUBDIR += ida SUBDIR += iec16022 + SUBDIR += igt-gpu-tools SUBDIR += iiview SUBDIR += ikona SUBDIR += imageindex diff --git a/graphics/igt-gpu-tools/Makefile b/graphics/igt-gpu-tools/Makefile new file mode 100644 index 000000000000..e7a9a1ce4eab --- /dev/null +++ b/graphics/igt-gpu-tools/Makefile @@ -0,0 +1,70 @@ +PORTNAME= igt-gpu-tools +DISTVERSION= 1.26.1266 +CATEGORIES= graphics + +MAINTAINER= jfree@FreeBSD.org +COMMENT= IGT gpu tools and tests +WWW= https://drm.pages.freedesktop.org/igt-gpu-tools/ + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/COPYING + +IGNORE_FreeBSD_12= unsupported on FreeBSD versions < 13.1 + +BUILD_DEPENDS= rst2man:textproc/py-docutils@${PY_FLAVOR} +LIB_DEPENDS= libdrm.so:graphics/libdrm \ + libdw.so:devel/elfutils \ + libpciaccess.so:devel/libpciaccess \ + libudev.so:devel/libudev-devd + +USES= bison gnome meson pkgconfig python shebangfix xorg + +USE_GITLAB= yes +GL_SITE= https://gitlab.freedesktop.org +GL_ACCOUNT= drm +GL_COMMIT= 9338ab3ec085292817ab1e74d1f2fb90b6a98332 + +USE_GNOME= cairo glib20 + +USE_LDCONFIG= yes + +USE_XORG= pixman + +SHEBANG_FILES= scripts/code_cov_gather_on_test scripts/code_cov_parse_info + +OPTIONS_DEFINE= CHAMELIUM DOCS RUNNER TEST +OPTIONS_DEFAULT= DOCS RUNNER TEST + +OPTIONS_SUB= yes + +CHAMELIUM_DESC= Build chamelium display tests +RUNNER_DESC= Build test runner + +CHAMELIUM_IMPLIES= TEST +CHAMELIUM_LIB_DEPENDS= libasound.so:audio/alsa-lib \ + libcurl.so:ftp/curl \ + libgsl.so:math/gsl \ + libxmlrpc.so:net/xmlrpc-c +CHAMELIUM_MESON_ENABLED= chamelium + +DOCS_IMPLIES= TEST +DOCS_BUILD_DEPENDS= gtkdoc-mkhtml:textproc/gtk-doc +DOCS_MESON_ENABLED= docs + +RUNNER_IMPLIES= TEST +RUNNER_LIB_DEPENDS= libjson-c.so:devel/json-c \ + liboping.so:net/liboping +RUNNER_MESON_ENABLED= runner + +TEST_LIB_DEPENDS= libunwind.so:devel/libunwind +TEST_MESON_ENABLED= tests + +.include + +.if ${ARCH} == "amd64" +PLIST_SUB+= AMD64="" +.else +PLIST_SUB+= AMD64="@comment " +.endif + +.include diff --git a/graphics/igt-gpu-tools/distinfo b/graphics/igt-gpu-tools/distinfo new file mode 100644 index 000000000000..d1c1376ca171 --- /dev/null +++ b/graphics/igt-gpu-tools/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1661919740 +SHA256 (drm-igt-gpu-tools-9338ab3ec085292817ab1e74d1f2fb90b6a98332_GL0.tar.gz) = c1b1ce7c3370e4e7030c76d43a312ba655d567c8f427b48f451525f81ef0a833 +SIZE (drm-igt-gpu-tools-9338ab3ec085292817ab1e74d1f2fb90b6a98332_GL0.tar.gz) = 2936270 diff --git a/graphics/igt-gpu-tools/files/patch-benchmarks_gem__exec__tracer.c b/graphics/igt-gpu-tools/files/patch-benchmarks_gem__exec__tracer.c new file mode 100644 index 000000000000..59708e57f20e --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-benchmarks_gem__exec__tracer.c @@ -0,0 +1,13 @@ +--- benchmarks/gem_exec_tracer.c.orig 2022-08-31 20:00:00 UTC ++++ benchmarks/gem_exec_tracer.c +@@ -41,6 +41,10 @@ + #include "intel_aub.h" + #include "intel_chipset.h" + ++#ifdef __FreeBSD__ ++#define _IOC_TYPE(nr) (((nr) >> 8) & 255) ++#endif ++ + static int (*libc_close)(int fd); + static int (*libc_ioctl)(int fd, unsigned long request, void *argp); + diff --git a/graphics/igt-gpu-tools/files/patch-benchmarks_gem__syslatency.c b/graphics/igt-gpu-tools/files/patch-benchmarks_gem__syslatency.c new file mode 100644 index 000000000000..717c89777bae --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-benchmarks_gem__syslatency.c @@ -0,0 +1,24 @@ +--- benchmarks/gem_syslatency.c.orig 2022-08-31 20:00:00 UTC ++++ benchmarks/gem_syslatency.c +@@ -42,12 +42,21 @@ + #include + #include "drm.h" + ++#ifdef __linux__ + #include ++#elif defined(__FreeBSD__) ++#include ++#define MAP_POPULATE MAP_PREFAULT_READ ++#define gettid() getpid() ++#define MADV_HUGEPAGE MADV_SEQUENTIAL ++#endif + + #include "i915/gem_create.h" + #include "i915/gem_ring.h" + ++#ifdef __linux__ + #define sigev_notify_thread_id _sigev_un._tid ++#endif + + static volatile int done; + diff --git a/graphics/igt-gpu-tools/files/patch-include_linux-uapi_sync__file.h b/graphics/igt-gpu-tools/files/patch-include_linux-uapi_sync__file.h new file mode 100644 index 000000000000..9fa37118dde4 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-include_linux-uapi_sync__file.h @@ -0,0 +1,19 @@ +--- include/linux-uapi/sync_file.h.orig 2022-08-31 20:00:01 UTC ++++ include/linux-uapi/sync_file.h +@@ -12,8 +12,16 @@ + #ifndef _LINUX_SYNC_H + #define _LINUX_SYNC_H + ++#ifdef __linux__ + #include + #include ++#elif defined(__FreeBSD__) ++#include ++#include ++#define __s32 int32_t ++#define __u32 uint32_t ++#define __u64 uint64_t ++#endif + + /** + * struct sync_merge_data - data passed to merge ioctl diff --git a/graphics/igt-gpu-tools/files/patch-lib_i915_gem__engine__topology.c b/graphics/igt-gpu-tools/files/patch-lib_i915_gem__engine__topology.c new file mode 100644 index 000000000000..8ee04959a904 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_i915_gem__engine__topology.c @@ -0,0 +1,13 @@ +--- lib/i915/gem_engine_topology.c.orig 2022-08-31 20:00:01 UTC ++++ lib/i915/gem_engine_topology.c +@@ -88,6 +88,10 @@ + */ + #define SIZEOF_QUERY offsetof(struct drm_i915_query_engine_info, \ + engines[GEM_MAX_ENGINES]) ++#ifdef __FreeBSD__ ++#define SYS_getdents64 SYS_freebsd11_getdents ++#define ino64_t ino_t ++#endif + + static int __gem_query(int fd, struct drm_i915_query *q) + { diff --git a/graphics/igt-gpu-tools/files/patch-lib_i915_gem__mman.c b/graphics/igt-gpu-tools/files/patch-lib_i915_gem__mman.c new file mode 100644 index 000000000000..d16771ef15b1 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_i915_gem__mman.c @@ -0,0 +1,14 @@ +--- lib/i915/gem_mman.c.orig 2022-08-31 20:00:01 UTC ++++ lib/i915/gem_mman.c +@@ -44,6 +44,11 @@ + #define VG(x) do {} while (0) + #endif + ++#ifdef __FreeBSD__ ++#define mmap64(addr, len, prot, flags, fd, offset) \ ++ mmap(addr, len, prot, flags, fd, offset) ++#endif ++ + static int gem_mmap_gtt_version(int fd) + { + struct drm_i915_getparam gp; diff --git a/graphics/igt-gpu-tools/files/patch-lib_i915_intel__memory__region.c b/graphics/igt-gpu-tools/files/patch-lib_i915_intel__memory__region.c new file mode 100644 index 000000000000..c4f07d793b96 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_i915_intel__memory__region.c @@ -0,0 +1,14 @@ +--- lib/i915/intel_memory_region.c.orig 2022-08-31 20:00:01 UTC ++++ lib/i915/intel_memory_region.c +@@ -21,7 +21,11 @@ + * IN THE SOFTWARE. + */ + ++#ifdef __linux__ + #include ++#elif defined(__FreeBSD__) ++#include ++#endif + #include + #include + #include diff --git a/graphics/igt-gpu-tools/files/patch-lib_i915_perf.c b/graphics/igt-gpu-tools/files/patch-lib_i915_perf.c new file mode 100644 index 000000000000..91b6cf3bde11 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_i915_perf.c @@ -0,0 +1,12 @@ +--- lib/i915/perf.c.orig 2022-08-31 20:00:01 UTC ++++ lib/i915/perf.c +@@ -29,7 +29,9 @@ + #include + #include + #include ++#ifdef __linux__ + #include ++#endif + #include + #include + diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__audio.c b/graphics/igt-gpu-tools/files/patch-lib_igt__audio.c new file mode 100644 index 000000000000..bb6d184cae02 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__audio.c @@ -0,0 +1,13 @@ +--- lib/igt_audio.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_audio.c +@@ -26,6 +26,10 @@ + + #include "config.h" + ++#ifdef __FreeBSD__ ++#include ++#endif ++ + #include + #include + #include diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__aux.c b/graphics/igt-gpu-tools/files/patch-lib_igt__aux.c new file mode 100644 index 000000000000..77a1539a3e4f --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__aux.c @@ -0,0 +1,75 @@ +--- lib/igt_aux.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_aux.c +@@ -52,7 +52,9 @@ + #include + #include + ++#ifdef __linux__ + #include ++#endif + #include + + #include "drmtest.h" +@@ -75,6 +77,12 @@ + #include /* for dirname() */ + #endif + ++#ifdef __FreeBSD__ ++typedef struct { char state; } proc_t; ++#define gettid() getpid() ++#define setpgrp() setpgid(0, 0) ++#endif ++ + /** + * SECTION:igt_aux + * @short_description: Auxiliary libraries and support functions +@@ -1206,6 +1214,7 @@ void igt_unlock_mem(void) + locked_mem = NULL; + } + ++#ifdef __linux__ + /** + * igt_is_process_running: + * @comm: Name of process in the form found in /proc/pid/comm (limited to 15 +@@ -1780,6 +1789,41 @@ igt_lsof_kill_audio_processes(void) + + return fail; + } ++#elif defined(__FreeBSD__) ++int ++igt_is_process_running(const char *comm) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_terminate_process(int sig, const char *comm) ++{ ++ return -ENOSYS; ++} ++ ++void ++igt_lsof(const char *dpath) ++{ ++} ++ ++int ++igt_lsof_kill_audio_processes(void) ++{ ++ return -ENOSYS; ++} ++ ++int ++pipewire_pulse_start_reserve(void) ++{ ++ return -ENOSYS; ++} ++ ++void ++pipewire_pulse_stop_reserve(void) ++{ ++} ++#endif /* __linux__ */ + + static struct igt_siglatency { + timer_t timer; diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__aux.h b/graphics/igt-gpu-tools/files/patch-lib_igt__aux.h new file mode 100644 index 000000000000..fc083392b2e7 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__aux.h @@ -0,0 +1,23 @@ +--- lib/igt_aux.h.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_aux.h +@@ -34,9 +34,7 @@ + #include + #include + #include +-#ifdef __linux__ +-# include +-#endif ++#include + + #include + +@@ -48,8 +46,8 @@ + # ifndef HAVE_GETTID + # define gettid() (pid_t)(syscall(__NR_gettid)) + # endif +-#endif + #define sigev_notify_thread_id _sigev_un._tid ++#endif + + /* auxialiary igt helpers from igt_aux.c */ + /* generally useful helpers */ diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__core.c b/graphics/igt-gpu-tools/files/patch-lib_igt__core.c new file mode 100644 index 000000000000..012fae47e743 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__core.c @@ -0,0 +1,54 @@ +--- lib/igt_core.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_core.c +@@ -43,7 +43,7 @@ + #include + #include + #include +-#ifdef __linux__ ++#if defined(__linux__) || defined(__FreeBSD__) + #include + #endif + #include +@@ -85,6 +85,12 @@ + #include /* for basename() on Solaris */ + #endif + ++#ifdef __FreeBSD__ ++#define gettid() getpid() ++#define pthread_sigqueue(pid, signo, value) sigqueue(pid, signo, value) ++#define sighandler_t sig_t ++#endif ++ + /** + * SECTION:igt_core + * @short_description: Core i-g-t testing support +@@ -786,6 +792,7 @@ static void oom_adjust_for_doom(void) + + static void oom_adjust_for_doom(void) + { ++#ifdef __linux__ + int fd; + const char always_kill[] = "1000"; + +@@ -793,7 +800,7 @@ static void oom_adjust_for_doom(void) + igt_assert(fd != -1); + igt_assert(write(fd, always_kill, sizeof(always_kill)) == sizeof(always_kill)); + close(fd); +- ++#endif + } + + /** +@@ -2223,7 +2230,12 @@ bool __igt_fork_helper(struct igt_helper_process *proc + igt_assert(0); + case 0: + reset_helper_process_list(); ++#ifdef __linux__ + oom_adjust_for_doom(); ++#elif defined(__FreeBSD__) ++ /* not a great substitution for oom_adjust_for_doom() */ ++ raise(SIGTERM); ++#endif + + return true; + default: diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__core.h b/graphics/igt-gpu-tools/files/patch-lib_igt__core.h new file mode 100644 index 000000000000..42c8b79da821 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__core.h @@ -0,0 +1,23 @@ +--- lib/igt_core.h.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_core.h +@@ -31,7 +31,9 @@ + #define IGT_CORE_H + + #include ++#ifdef __linux__ + #include ++#endif + #include + #include + #include +@@ -47,6 +49,10 @@ + #define IGT_LOG_DOMAIN (NULL) + #endif + ++#ifdef __FreeBSD__ ++#include ++#define jmp_buf sigjmp_buf ++#endif + + #ifndef STATIC_ANALYSIS_BUILD + #if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__) diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__debugfs.c b/graphics/igt-gpu-tools/files/patch-lib_igt__debugfs.c new file mode 100644 index 000000000000..101d77f388e3 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__debugfs.c @@ -0,0 +1,23 @@ +--- lib/igt_debugfs.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_debugfs.c +@@ -25,7 +25,9 @@ + #include + #include + #include ++#ifdef __linux__ + #include ++#endif + #include + #include + #include +@@ -42,6 +44,10 @@ + #include "igt_kms.h" + #include "igt_debugfs.h" + #include "igt_sysfs.h" ++ ++#ifdef __FreeBSD__ ++#define mount(src, dest, fstype, flags, data) mount(fstype, dest, flags, data) ++#endif + + /** + * SECTION:igt_debugfs diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__device.c b/graphics/igt-gpu-tools/files/patch-lib_igt__device.c new file mode 100644 index 000000000000..edaf51f33e21 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__device.c @@ -0,0 +1,12 @@ +--- lib/igt_device.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_device.c +@@ -25,7 +25,9 @@ + #include + + #include ++#ifdef __linux__ + #include ++#endif + #include "igt.h" + #include "igt_device.h" + #include "igt_sysfs.h" diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__device__scan.c b/graphics/igt-gpu-tools/files/patch-lib_igt__device__scan.c new file mode 100644 index 000000000000..ece786e14737 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__device__scan.c @@ -0,0 +1,14 @@ +--- lib/igt_device_scan.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_device_scan.c +@@ -32,7 +32,11 @@ + #include + #include + #include ++#ifdef __linux__ + #include ++#elif defined(__FreeBSD__) ++#include ++#endif + #include + #include + #include diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__dummyload.c b/graphics/igt-gpu-tools/files/patch-lib_igt__dummyload.c new file mode 100644 index 000000000000..d97cc17f961d --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__dummyload.c @@ -0,0 +1,29 @@ +--- lib/igt_dummyload.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_dummyload.c +@@ -26,7 +26,9 @@ + #include + #include + #include ++#ifdef __linux__ + #include ++#endif + + #include + +@@ -523,6 +525,8 @@ void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns + */ + void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns) + { ++/* TODO: FreeBSD - POSIX TIMER */ ++#ifdef __linux__ + struct sched_param param = { .sched_priority = 99 }; + struct itimerspec its; + pthread_attr_t attr; +@@ -554,6 +558,7 @@ void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns + its.it_value.tv_sec = ns / NSEC_PER_SEC; + its.it_value.tv_nsec = ns % NSEC_PER_SEC; + igt_assert(timerfd_settime(timerfd, 0, &its, NULL) == 0); ++#endif + } + + static void sync_write(igt_spin_t *spin, uint32_t value) diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__eld.c b/graphics/igt-gpu-tools/files/patch-lib_igt__eld.c new file mode 100644 index 000000000000..ed32b1dafcaa --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__eld.c @@ -0,0 +1,13 @@ +--- lib/igt_eld.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_eld.c +@@ -23,6 +23,10 @@ + * Authors: Simon Ser + */ + ++#ifdef __FreeBSD__ ++#include ++#endif ++ + #include "config.h" + + #include diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__frame.c b/graphics/igt-gpu-tools/files/patch-lib_igt__frame.c new file mode 100644 index 000000000000..475a54bf3c5f --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__frame.c @@ -0,0 +1,13 @@ +--- lib/igt_frame.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_frame.c +@@ -24,6 +24,10 @@ + * Paul Kocialkowski + */ + ++#ifdef __FreeBSD__ ++#include ++#endif ++ + #include "config.h" + + #include diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__kmod.c b/graphics/igt-gpu-tools/files/patch-lib_igt__kmod.c new file mode 100644 index 000000000000..d30a18aecc7d --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__kmod.c @@ -0,0 +1,131 @@ +--- lib/igt_kmod.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_kmod.c +@@ -32,6 +32,7 @@ + #include "igt_sysfs.h" + #include "igt_taints.h" + ++#ifdef __linux__ + /** + * SECTION:igt_kmod + * @short_description: Wrappers around libkmod for module loading/unloading +@@ -853,3 +854,120 @@ void igt_kselftests(const char *module_name, + + igt_kselftest_fini(&tst); + } ++#elif defined(__FreeBSD__) ++struct kmod_module { ++ size_t size; ++}; ++ ++bool ++igt_kmod_is_loaded(const char *mod_name) ++{ ++ return false; ++} ++ ++void ++igt_kmod_list_loaded(void) ++{ ++} ++ ++bool ++igt_kmod_has_param(const char *mod_name, const char *param) ++{ ++ return false; ++} ++ ++int ++igt_kmod_load(const char *mod_name, const char *opts) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_kmod_unload(const char *mod_name, unsigned int flags) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_audio_driver_unload(char **whom) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_i915_driver_load(const char *opts) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_i915_driver_unload(void) ++{ ++ return -ENOSYS; ++} ++ ++int ++__igt_i915_driver_unload(char **whom) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_amdgpu_driver_load(const char *opts) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_amdgpu_driver_unload(void) ++{ ++ return -ENOSYS; ++} ++ ++void ++igt_kselftests(const char *module_name, ++ const char *module_options, ++ const char *result_option, ++ const char *filter) ++{ ++} ++ ++int ++igt_kselftest_init(struct igt_kselftest *tst, ++ const char *module_name) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_kselftest_begin(struct igt_kselftest *tst) ++{ ++ return -ENOSYS; ++} ++ ++void ++igt_kselftest_get_tests(struct kmod_module *kmod, ++ const char *filter, ++ struct igt_list_head *tests) ++{ ++} ++ ++int ++igt_kselftest_execute(struct igt_kselftest *tst, ++ struct igt_kselftest_list *tl, ++ const char *module_options, ++ const char *result) ++{ ++ return -ENOSYS; ++} ++ ++void ++igt_kselftest_end(struct igt_kselftest *tst) ++{ ++} ++ ++void ++igt_kselftest_fini(struct igt_kselftest *tst) ++{ ++} ++#endif /* __linux__ */ diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__kmod.h b/graphics/igt-gpu-tools/files/patch-lib_igt__kmod.h new file mode 100644 index 000000000000..0714358f05d6 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__kmod.h @@ -0,0 +1,12 @@ +--- lib/igt_kmod.h.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_kmod.h +@@ -24,7 +24,9 @@ + #ifndef IGT_KMOD_H + #define IGT_KMOD_H + ++#ifdef __linux__ + #include ++#endif + + #include "igt_list.h" + diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__kms.c b/graphics/igt-gpu-tools/files/patch-lib_igt__kms.c new file mode 100644 index 000000000000..35efd4de24aa --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__kms.c @@ -0,0 +1,13 @@ +--- lib/igt_kms.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_kms.c +@@ -43,6 +43,10 @@ + #include + #endif + ++#ifdef __FreeBSD__ ++#include ++#endif ++ + #include + #include + #include diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__os.c b/graphics/igt-gpu-tools/files/patch-lib_igt__os.c new file mode 100644 index 000000000000..902dba8cb6e0 --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__os.c @@ -0,0 +1,42 @@ +--- lib/igt_os.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_os.c +@@ -44,6 +44,9 @@ + #include + #elif defined(HAVE_SWAPCTL) /* Solaris */ + #include ++#elif defined(__FreeBSD__) ++#include ++#include + #endif + #include + +@@ -148,6 +151,15 @@ igt_get_avail_ram_mb(void) + npages = sysconf(_SC_AVPHYS_PAGES); + + retval = (uint64_t) pagesize * npages; ++#elif defined(__FreeBSD__) /* FreeBSD */ ++ uint64_t npages, pagesize; ++ size_t npages_len = sizeof(npages); ++ size_t pagesize_len = sizeof(pagesize); ++ ++ sysctlbyname("vm.stats.vm.v_free_count", &npages, &npages_len, NULL, 0); ++ sysctlbyname("vm.stats.vm.v_page_size", &pagesize, &pagesize_len, NULL, 0); ++ ++ retval = pagesize * npages; + #else + #error "Unknown how to get available RAM for this OS" + #endif +@@ -210,6 +222,13 @@ igt_get_total_swap_mb(void) + free(buf); + + retval = (uint64_t) pagesize * totalpages; ++#elif defined(__FreeBSD__) /* FreeBSD */ ++ uint64_t swap_total; ++ size_t swap_total_len = sizeof(swap_total); ++ ++ sysctlbyname("vm.swap_total", &swap_total, &swap_total_len, NULL, 0); ++ ++ retval = swap_total; + #else + #warning "Unknown how to get swap size for this OS" + return 0; diff --git a/graphics/igt-gpu-tools/files/patch-lib_igt__perf.c b/graphics/igt-gpu-tools/files/patch-lib_igt__perf.c new file mode 100644 index 000000000000..c1fadfe1b86f --- /dev/null +++ b/graphics/igt-gpu-tools/files/patch-lib_igt__perf.c @@ -0,0 +1,78 @@ +--- lib/igt_perf.c.orig 2022-08-31 20:00:01 UTC ++++ lib/igt_perf.c +@@ -4,13 +4,16 @@ + #include + #include + #include ++#ifdef __linux__ + #include + #include ++#endif + #include + #include + + #include "igt_perf.h" + ++#ifdef __linux__ + static char *bus_address(int i915, char *path, int pathlen) + { + struct stat st; +@@ -157,3 +160,58 @@ int igt_perf_open_group(uint64_t type, uint64_t config + return _perf_open(type, config, group, + PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); + } ++#elif defined(__FreeBSD__) ++uint64_t ++igt_perf_type_id(const char *device) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_perf_open(uint64_t type, uint64_t config) ++{ ++ return -ENOSYS; ++} ++ ++int ++igt_perf_open_group(uint64_t type, uint64_t config, int group) ++{ ++ return -ENOSYS; ++} ++ ++const char * ++i915_perf_device(int i915, char *buf, int buflen) ++{ *** 2388 LINES SKIPPED ***