Skip to contentSkip to conversation

Introduced partial FreeBSD compatibility

PATCH In review Jake Freeland 4 participants 6 messages Sep 11, 2022 – Sep 18, 2022 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Introduced partial FreeBSD compatibility

---
 benchmarks/gem_exec_tracer.c        |   4 +
 benchmarks/gem_syslatency.c         |   6 ++
 include/linux-uapi/sync_file.h      |   5 ++
 lib/i915/gem_mman.c                 |   4 +-
 lib/i915/intel_memory_region.c      |   4 +
 lib/i915/perf.c                     |   2 +
 lib/igt_audio.c                     |   4 +
 lib/igt_aux.c                       |   6 +-
 lib/igt_aux.h                       |   6 +-
 lib/igt_core.c                      |   8 +-
 lib/igt_core.h                      |   5 ++
 lib/igt_debugfs.c                   |   2 +
 lib/igt_device.c                    |   2 +
 lib/igt_device_scan.c               |   4 +
 lib/igt_eld.c                       |   4 +
 lib/igt_frame.c                     |   4 +
 lib/igt_freebsd.h                   | 123 ++++++++++++++++++++++++++++
 lib/igt_kmod.h                      |   2 +
 lib/igt_kms.c                       |   4 +
 lib/igt_os.c                        |  19 +++++
 lib/igt_perf.c                      |   2 +
 lib/igt_perf.h                      |   4 +
 lib/igt_pm.c                        |   2 +
 lib/igt_sysfs.c                     |   2 +
 lib/igt_vgem.c                      |   2 +-
 lib/tests/igt_exit_handler.c        |   4 +
 lib/tests/igt_fork.c                |   2 +-
 lib/tests/igt_tests_common.h        |   9 ++
 runner/executor.c                   |   6 ++
 runner/job_list.c                   |   5 ++
 tests/i915/gem_close_race.c         |   2 +
 tests/i915/gem_mmap_gtt.c           |  24 +++---
 tests/i915/gem_mmap_offset.c        |  16 ++--
 tests/i915/i915_module_load.c       |   2 +
 tests/i915/i915_pm_backlight.c      |   4 +
 tests/i915/i915_pm_rpm.c            |   8 ++
 tests/kms_content_protection.c      |   2 +
 tests/kms_flip.c                    |   4 +
 tests/kms_sysfs_edid_timing.c       |   4 +
 tests/tools_test.c                  |  10 ++-
 tools/i915-perf/i915_perf_control.c |   2 +-
 tools/intel_gvtg_test.c             |   4 +
 42 files changed, 301 insertions(+), 37 deletions(-)
 create mode 100644 lib/igt_freebsd.h
benchmarks/gem_exec_tracer.c +4 -0
index e6973991..7e86473e 100644
@@ -41,6 +41,10 @@
 #include "intel_aub.h"
 #include "intel_chipset.h"
 
+#ifdef __FreeBSD__
+#include "igt_freebsd.h"
+#endif
+
 static int (*libc_close)(int fd);
 static int (*libc_ioctl)(int fd, unsigned long request, void *argp);
 
benchmarks/gem_syslatency.c +6 -0
index 035ee934..dafc6ac0 100644
@@ -42,12 +42,18 @@
 #include <limits.h>
 #include "drm.h"
 
+#ifdef __linux__
 #include <linux/unistd.h>
+#elif defined(__FreeBSD__)
+#include "igt_freebsd.h"
+#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;
 
include/linux-uapi/sync_file.h +5 -0
index b4f2db00..270c1cbc 100644
@@ -12,8 +12,13 @@
 #ifndef _LINUX_SYNC_H
 #define _LINUX_SYNC_H
 
+#ifdef __linux__
 #include <linux/ioctl.h>
 #include <linux/types.h>
+#elif defined(__FreeBSD__)
+#include <sys/ioctl.h>
+#include "igt_freebsd.h"
+#endif
 
 /**
  * struct sync_merge_data - data passed to merge ioctl
lib/i915/gem_mman.c +2 -2
index aa9ac6f3..0b41ba70 100644
@@ -118,7 +118,7 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
 	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
 	else
@@ -331,7 +331,7 @@ void *__gem_mmap_offset(int fd, uint32_t handle, uint64_t offset, uint64_t size,
 	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET, &arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
 
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
lib/i915/intel_memory_region.c +4 -0
index 93a18982..ca7f9140 100644
@@ -21,7 +21,11 @@
  * IN THE SOFTWARE.
  */
 
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
lib/i915/perf.c +2 -0
index d88835ff..beda6b8a 100644
@@ -29,7 +29,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <unistd.h>
 
lib/igt_audio.c +4 -0
index e0b1bafe..201a39c6 100644
@@ -26,6 +26,10 @@
 
 #include "config.h"
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include <errno.h>
 #include <fcntl.h>
 #include <gsl/gsl_fft_real.h>
lib/igt_aux.c +4 -2
index edb53425..ba2d52e8 100644
@@ -52,7 +52,9 @@
 #include <assert.h>
 #include <grp.h>
 
+#ifdef __linux__
 #include <proc/readproc.h>
+#endif
 #include <libudev.h>
 
 #include "drmtest.h"
@@ -323,10 +325,10 @@ void igt_fork_signal_helper(void)
 	 * and we send the signal at exactly the wrong time).
 	 */
 	signal(SIGCONT, sig_handler);
-	setpgrp(); /* define a new process group for the tests */
+	setpgid(0, 0); /* define a new process group for the tests */
 
 	igt_fork_helper(&signal_helper) {
-		setpgrp(); /* Escape from the test process group */
+		setpgid(0, 0); /* Escape from the test process group */
 
 		/* Pass along the test process group identifier,
 		 * negative pid => send signal to everyone in the group.
lib/igt_aux.h +2 -4
index c8d487b6..912f36c1 100644
@@ -34,9 +34,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
-#ifdef __linux__
-# include <sys/syscall.h>
-#endif
+#include <sys/syscall.h>
 
 #include <i915/gem_submission.h>
 
@@ -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 */
lib/igt_core.c +5 -3
index e7425326..17d5e013 100644
@@ -43,9 +43,7 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include <sys/types.h>
-#ifdef __linux__
 #include <sys/syscall.h>
-#endif
 #include <pthread.h>
 #include <sys/utsname.h>
 #include <termios.h>
@@ -786,6 +784,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 
 static void oom_adjust_for_doom(void)
 {
+#ifdef __linux__
 	int fd;
 	const char always_kill[] = "1000";
 
@@ -793,7 +792,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
 }
 
 /**
@@ -2224,6 +2223,9 @@ bool __igt_fork_helper(struct igt_helper_process *proc)
 	case 0:
 		reset_helper_process_list();
 		oom_adjust_for_doom();
+#ifdef __FreeBSD__
+		raise(SIGTERM);
+#endif
 
 		return true;
 	default:
lib/igt_core.h +5 -0
index aa98e8ed..295bb5d9 100644
@@ -31,7 +31,9 @@
 #define IGT_CORE_H
 
 #include <assert.h>
+#ifdef __linux__
 #include <byteswap.h>
+#endif
 #include <setjmp.h>
 #include <stdbool.h>
 #include <stdint.h>
@@ -47,6 +49,9 @@
 #define IGT_LOG_DOMAIN (NULL)
 #endif
 
+#ifdef __FreeBSD__
+#include "igt_freebsd.h"
+#endif
 
 #ifndef STATIC_ANALYSIS_BUILD
 #if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__)
lib/igt_debugfs.c +2 -0
index a56688a5..fa1e3b69 100644
@@ -25,7 +25,9 @@
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <dirent.h>
 #include <errno.h>
 #include <stdio.h>
lib/igt_device.c +2 -0
index fddfba72..49b77122 100644
@@ -25,7 +25,9 @@
 #include <fcntl.h>
 
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
lib/igt_device_scan.c +4 -0
index eb6b45b8..6a921d52 100644
@@ -32,7 +32,11 @@
 #include <fcntl.h>
 #include <glib.h>
 #include <libudev.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
lib/igt_eld.c +4 -0
index ef6625df..e05ad6de 100644
@@ -23,6 +23,10 @@
  * Authors: Simon Ser <[email protected]>
  */
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include "config.h"
 
 #include <dirent.h>
lib/igt_frame.c +4 -0
index 45523a79..ab74e678 100644
@@ -24,6 +24,10 @@
  *  Paul Kocialkowski <[email protected]>
  */
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include "config.h"
 
 #include <fcntl.h>
lib/igt_freebsd.h new file +123 -0

123 lines not on this page · raw message

lib/igt_kmod.h +2 -0
index f98dd29f..6596092b 100644
@@ -24,7 +24,9 @@
 #ifndef IGT_KMOD_H
 #define IGT_KMOD_H
 
+#ifdef __linux__
 #include <libkmod.h>
+#endif
 
 #include "igt_list.h"
 
lib/igt_kms.c +4 -0
index 1ba3bd2a..f0208c10 100644
@@ -43,6 +43,10 @@
 #include <sys/kd.h>
 #endif
 
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
 #include <libudev.h>
 #include <poll.h>
 #include <errno.h>
lib/igt_os.c +19 -0
index bdd5d933..ae426e3a 100644
@@ -44,6 +44,9 @@
 #include <sys/sysinfo.h>
 #elif defined(HAVE_SWAPCTL) /* Solaris */
 #include <sys/swap.h>
+#elif defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#include <sys/types.h>
 #endif
 #include <sys/resource.h>
 
@@ -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;
lib/igt_perf.c +2 -0
index b743859f..11c91c5f 100644
@@ -4,8 +4,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysinfo.h>
 #include <sys/sysmacros.h>
+#endif
 #include <time.h>
 #include <unistd.h>
 
lib/igt_perf.h +4 -0
index a8328c70..0cd91386 100644
@@ -27,10 +27,13 @@
 
 #include <stdint.h>
 
+#ifdef __linux__
 #include <linux/perf_event.h>
+#endif
 
 #include "igt_gt.h"
 
+#ifdef __linux__
 static inline int
 perf_event_open(struct perf_event_attr *attr,
 		pid_t pid,
@@ -50,6 +53,7 @@ perf_event_open(struct perf_event_attr *attr,
     attr->size = sizeof(*attr);
     return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags);
 }
+#endif /* __linux__ */
 
 uint64_t igt_perf_type_id(const char *device);
 int igt_perf_open(uint64_t type, uint64_t config);
lib/igt_pm.c +2 -0
index 99251b40..a6036e03 100644
@@ -33,7 +33,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <dirent.h>
 
lib/igt_sysfs.c +2 -0
index 9c307694..a913be4c 100644
@@ -24,7 +24,9 @@
 
 #include <inttypes.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/mount.h>
 #include <errno.h>
 #include <stdarg.h>
lib/igt_vgem.c +1 -1
index 7f933b23..468383c7 100644
@@ -76,7 +76,7 @@ void *__vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot)
 	if (drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg))
 		return NULL;
 
-	ptr = mmap64(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
+	ptr = mmap(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
 	if (ptr == MAP_FAILED)
 		return NULL;
 
lib/tests/igt_exit_handler.c +4 -0
index 892a7f14..d2381944 100644
@@ -125,5 +125,9 @@ int main(int argc, char **argv)
 	internal_assert_wexited(status, IGT_EXIT_SKIP);
 
 	status = testfunc(SIG);
+#ifdef __linux__
 	internal_assert_wsignaled(status, SIGTERM);
+#elif defined(__FreeBSD__)
+	internal_assert(status == 0);
+#endif
 }
lib/tests/igt_fork.c +1 -1
index d19d0945..c7193b06 100644
@@ -109,7 +109,7 @@ __noreturn static void igt_fork_timeout_leak(void)
 __noreturn static void subtest_leak(void)
 {
 	pid_t *children =
-		mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+		mmap(0, 4096, PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANON, -1, 0);
 	const int num_children = 4096 / sizeof(*children);
 
 	igt_subtest_init(fake_argc, fake_argv);
lib/tests/igt_tests_common.h +9 -0
index 058f6265..e8183897 100644
@@ -48,8 +48,17 @@ static inline void internal_assert_wexited(int wstatus, int exitcode)
 
 static inline void internal_assert_wsignaled(int wstatus, int signal)
 {
+#ifdef __linux__
 	internal_assert(WIFSIGNALED(wstatus) &&
 			WTERMSIG(wstatus) == signal);
+#elif defined(__FreeBSD__)
+	if (WIFSIGNALED(wstatus))
+		internal_assert(WTERMSIG(wstatus) == signal);
+	else if (WIFEXITED(wstatus))
+		internal_assert(WEXITSTATUS(wstatus) == signal + 128);
+	else
+		internal_assert(0);
+#endif
 }
 
 static inline void internal_assert_not_wsignaled(int wstatus)
runner/executor.c +6 -0
index 964d0063..c54072cf 100644
@@ -2,7 +2,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <glib.h>
+#ifdef __linux__
 #include <linux/watchdog.h>
+#endif
 #if HAVE_OPING
 #include <oping.h>
 #endif
@@ -33,6 +35,10 @@
 #define KMSG_HEADER "[IGT] "
 #define KMSG_WARN 4
 
+#ifdef __FreeBSD__
+#include <sys/watchdog.h>
+#endif
+
 static struct {
 	int *fds;
 	size_t num_dogs;
runner/job_list.c +5 -0
index 520a98da..6bfa7162 100644
@@ -1,7 +1,12 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <sys/wait.h>
+#include <limits.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
tests/i915/gem_close_race.c +2 -0
index 938fde8f..42fe1657 100644
@@ -61,7 +61,9 @@ static bool has_softpin;
 static uint64_t exec_addr;
 static uint64_t data_addr;
 
+#ifdef __linux__
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 static void selfcopy(int fd, uint32_t ctx, uint32_t handle, int loops)
 {
tests/i915/gem_mmap_gtt.c +12 -12
index e39b9047..683eaf16 100644
@@ -113,11 +113,11 @@ test_access(int fd)
 	mmap_arg.handle = handle;
 	do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
 
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd, mmap_arg.offset));
 
 	/* Check that the same offset on the other fd doesn't work. */
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd2, mmap_arg.offset) == MAP_FAILED);
 	igt_assert(errno == EACCES);
 
@@ -128,7 +128,7 @@ test_access(int fd)
 
 	/* Recheck that it works after flink. */
 	/* Check that the same offset on the other fd doesn't work. */
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd2, mmap_arg.offset));
 }
 
@@ -159,11 +159,11 @@ test_short(int fd)
 	for (pages = 1; pages <= OBJECT_SIZE / PAGE_SIZE; pages <<= 1) {
 		uint8_t *r, *w;
 
-		w = mmap64(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
+		w = mmap(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
 			   MAP_SHARED, fd, mmap_arg.offset);
 		igt_assert(w != MAP_FAILED);
 
-		r = mmap64(0, pages * PAGE_SIZE, PROT_READ,
+		r = mmap(0, pages * PAGE_SIZE, PROT_READ,
 			   MAP_SHARED, fd, mmap_arg.offset);
 		igt_assert(r != MAP_FAILED);
 
@@ -384,13 +384,13 @@ test_isolation(int i915)
 
 	close(B);
 
-	ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+	ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 	igt_assert(ptr != MAP_FAILED);
 	munmap(ptr, 4096);
 
 	close(A);
 
-	ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+	ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 	igt_assert(ptr == MAP_FAILED);
 }
 
@@ -400,7 +400,7 @@ test_close_race(int i915)
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	_Atomic uint32_t *handles;
 
-	handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -418,7 +418,7 @@ test_close_race(int i915)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, i915,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
@@ -444,7 +444,7 @@ test_flink_race(int i915)
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	_Atomic uint32_t *handles;
 
-	handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -469,7 +469,7 @@ test_flink_race(int i915)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, fd,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
@@ -566,7 +566,7 @@ test_ptrace(int fd)
 	for (int i = 0; i < sz / sizeof(long); i++) {
 		long ret;
 
-		ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i);
+		ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i, NULL);
 		igt_assert_eq_u64(ret, CC);
 		cpy[i] = ret;
 
tests/i915/gem_mmap_offset.c +8 -8
index 5e6b19eb..0933ed94 100644
@@ -66,7 +66,7 @@ __mmap_offset(int i915, uint32_t handle, uint64_t offset, uint64_t size,
 	if (mmap_offset_ioctl(i915, &arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
 	else
@@ -214,12 +214,12 @@ static void isolation(int i915)
 			 t->name, B, b, offset_b);
 
 		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
 		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
@@ -237,13 +237,13 @@ static void isolation(int i915)
 
 		close(B);
 
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 		igt_assert(ptr != MAP_FAILED);
 		munmap(ptr, 4096);
 
 		close(A);
 
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 		igt_assert(ptr == MAP_FAILED);
 	}
 }
@@ -370,7 +370,7 @@ static void test_ptrace(int i915)
 			for (int i = 0; i < SZ / sizeof(long); i++) {
 				long ret;
 
-				ret = ptrace(PTRACE_PEEKDATA, pid, ptr + i);
+				ret = ptrace(PTRACE_PEEKDATA, pid, ptr + i, NULL);
 				igt_assert_eq_u64(ret, CC);
 				cpy[i] = ret;
 
@@ -401,7 +401,7 @@ static void close_race(int i915, int timeout)
 	_Atomic uint32_t *handles;
 	size_t len = ALIGN((ncpus + 1) * sizeof(uint32_t), 4096);
 
-	handles = mmap64(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -420,7 +420,7 @@ static void close_race(int i915, int timeout)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, i915,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
tests/i915/i915_module_load.c +2 -0
index 4c72157c..9bec4c18 100644
@@ -23,7 +23,9 @@
 #include "igt.h"
 #include <dirent.h>
 #include <sys/utsname.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#endif
 #include <signal.h>
 #include <libgen.h>
 #include <signal.h>
tests/i915/i915_pm_backlight.c +4 -0
index cafae7f7..c520cf20 100644
@@ -46,6 +46,10 @@ struct context {
 #define FADESTEPS 10
 #define FADESPEED 100 /* milliseconds between steps */
 
+#ifdef __FreeBSD__
+#include <libgen.h>
+#endif
+
 IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
 
 static int backlight_read(int *result, const char *fname)
tests/i915/i915_pm_rpm.c +8 -0
index e95875dc..761e76f9 100644
@@ -40,8 +40,10 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
+#endif
 
 #include <drm.h>
 
@@ -54,6 +56,12 @@
 #include "igt_device.h"
 #include "igt_edid.h"
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#include <dev/iicbus/iic.h>
+#define	addr	slave
+#endif
+
 #define MSR_PC8_RES	0x630
 #define MSR_PC9_RES	0x631
 #define MSR_PC10_RES	0x632
tests/kms_content_protection.c +2 -0
index 3041f1cd..e0e5af78 100644
@@ -24,7 +24,9 @@
 
 #include <poll.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <sys/epoll.h>
+#endif
 #include <sys/stat.h>
 #include <libudev.h>
 #include "igt.h"
tests/kms_flip.c +4 -0
index 0567edea..1127e418 100755
@@ -45,6 +45,10 @@
 #include "i915/gem_create.h"
 #include "igt_stats.h"
 
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
 #define TEST_DPMS		(1 << 0)
 
 #define TEST_PAN		(1 << 3)
tests/kms_sysfs_edid_timing.c +4 -0
index 77521108..cd980c6a 100644
@@ -26,6 +26,10 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #define THRESHOLD_PER_CONNECTOR		150
 #define THRESHOLD_PER_CONNECTOR_MEAN	140
 #define THRESHOLD_ALL_CONNECTORS_MEAN	100
tests/tools_test.c +7 -3
index 237f0433..d0684d57 100644
@@ -28,7 +28,11 @@
 #include <fcntl.h>
 #include <libgen.h>
 #include <unistd.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 
 #define TOOLS "../tools/"
 
@@ -65,7 +69,7 @@ static bool chdir_to_tools_dir(void)
 	char path[PATH_MAX];
 	char *cwd;
 
-	cwd = get_current_dir_name();
+	cwd = getcwd(NULL, 0);
 	igt_info("Current working directory: %s\n", cwd);
 	free(cwd);
 
@@ -83,7 +87,7 @@ static bool chdir_to_tools_dir(void)
 		chdir(dirname(path));
 	}
 
-	cwd = get_current_dir_name();
+	cwd = getcwd(NULL, 0);
 	igt_info("Current working directory: %s\n", cwd);
 	free(cwd);
 
@@ -99,7 +103,7 @@ igt_main
 
 		igt_require_f(chdir_to_tools_dir(),
 			      "Unable to determine the tools directory, expecting them in $cwd/" TOOLS " or $path/" TOOLS "\n");
-		path = get_current_dir_name();
+		path = getcwd(NULL, 0);
 		igt_info("Using tools from %s\n", path);
 		free(path);
 	}
tools/i915-perf/i915_perf_control.c +1 -1
index be5996c0..f7db2f5c 100644
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
 
 			fwrite(data, total_len, 1, command_fifo_file);
 		} else {
-			char *cwd = get_current_dir_name();
+			char *cwd = getcwd(NULL, 0);
 			uint32_t path_len = strlen(cwd) + 1 + strlen(dump_file) + 1;
 			uint32_t total_len = sizeof(struct recorder_command_base) + path_len;
 			struct {
tools/intel_gvtg_test.c +4 -0
index ad5ee6a6..3e53c6d9 100644
@@ -55,6 +55,10 @@
 #include <limits.h>
 #include <dirent.h>
 
+#ifdef __FreeBSD__
+#include <sys/wait.h>
+#endif
+
 #define RANDOM(x) (rand() % x)
 
 
Signature · 1 line
2.37.3
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for Introduced partial FreeBSD compatibility (rev2)

== Series Details ==

== Series Details ==

Series: Introduced partial FreeBSD compatibility (rev2)
URL : https://patchwork.freedesktop.org/series/108081/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12114 -> IGTPW_7766
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/index.html

Participating hosts (39 -> 38)
------------------------------

Missing (1): fi-bdw-samus

Known issues
------------

Here are the changes found in IGTPW_7766 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@requests:
- fi-pnv-d510: [PASS][1] -> [DMESG-FAIL][2] ([i915#4528])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/fi-pnv-d510/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-pnv-d510/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s2idle-without-i915:
- fi-bdw-gvtdvm: NOTRUN -> [INCOMPLETE][3] ([i915#4817] / [i915#6598])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-bdw-gvtdvm/igt@[email protected]

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-hsw-4770: NOTRUN -> [SKIP][4] ([fdo#109271] / [fdo#111827])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-hsw-4770/igt@[email protected]
- fi-cfl-8109u: NOTRUN -> [SKIP][5] ([fdo#109271] / [fdo#111827])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-cfl-8109u/igt@[email protected]

* igt@kms_chamelium@vga-hpd-fast:
- fi-snb-2600: NOTRUN -> [SKIP][6] ([fdo#109271] / [fdo#111827]) +8 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-snb-2600/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size:
- fi-bsw-kefka: [PASS][7] -> [FAIL][8] ([i915#6298])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html

* igt@kms_psr@sprite_plane_onoff:
- fi-snb-2600: NOTRUN -> [SKIP][9] ([fdo#109271]) +20 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-snb-2600/igt@kms_psr@sprite_plane_onoff.html

* igt@runner@aborted:
- fi-pnv-d510: NOTRUN -> [FAIL][10] ([fdo#109271] / [i915#2403] / [i915#4312])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-pnv-d510/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s0@smem:
- {bat-rplp-1}: [DMESG-WARN][11] ([i915#2867]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/bat-rplp-1/igt@gem_exec_suspend@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-cfl-8109u: [DMESG-FAIL][13] ([i915#62]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/fi-cfl-8109u/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-cfl-8109u/igt@[email protected]

* igt@i915_selftest@live@execlists:
- fi-bdw-gvtdvm: [INCOMPLETE][15] ([i915#2940]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/fi-bdw-gvtdvm/igt@i915_selftest@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-bdw-gvtdvm/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@gt_engines:
- {bat-rpls-1}: [INCOMPLETE][17] ([i915#6503]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/bat-rpls-1/igt@i915_selftest@live@gt_engines.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/bat-rpls-1/igt@i915_selftest@live@gt_engines.html

* igt@i915_selftest@live@hangcheck:
- fi-hsw-4770: [INCOMPLETE][19] ([i915#4785]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/fi-hsw-4770/igt@i915_selftest@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-hsw-4770/igt@i915_selftest@[email protected]
- {fi-ehl-2}: [INCOMPLETE][21] ([i915#5153]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/fi-ehl-2/igt@i915_selftest@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-ehl-2/igt@i915_selftest@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
- fi-bsw-kefka: [FAIL][23] ([i915#6298]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-cfl-8109u: [DMESG-WARN][25] ([i915#62]) -> [PASS][26] +11 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/fi-cfl-8109u/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/fi-cfl-8109u/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#2403]: https://gitlab.freedesktop.org/drm/intel/issues/2403
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4528]: https://gitlab.freedesktop.org/drm/intel/issues/4528
[i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
[i915#4817]: https://gitlab.freedesktop.org/drm/intel/issues/4817
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5153]: https://gitlab.freedesktop.org/drm/intel/issues/5153
[i915#5828]: https://gitlab.freedesktop.org/drm/intel/issues/5828
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6503]: https://gitlab.freedesktop.org/drm/intel/issues/6503
[i915#6580]: https://gitlab.freedesktop.org/drm/intel/issues/6580
[i915#6598]: https://gitlab.freedesktop.org/drm/intel/issues/6598
[i915#6670]: https://gitlab.freedesktop.org/drm/intel/issues/6670

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_6650 -> IGTPW_7766

CI-20190529: 20190529
CI_DRM_12114: 346251322fc81f256ed89dd437bcf4c83b578019 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_7766: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/index.html
IGT_6650: f7aff600ab16d6405f0704b1743d2b7909715752 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/index.html

#2 lore raw

[igt-dev] ✗ Fi.CI.IGT: failure for Introduced partial FreeBSD compatibility (rev2)

In reply to Jake Freeland
== Series Details ==

== Series Details ==

Series: Introduced partial FreeBSD compatibility (rev2)
URL : https://patchwork.freedesktop.org/series/108081/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12114_full -> IGTPW_7766_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_7766_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_7766_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/index.html

Participating hosts (10 -> 8)
------------------------------

Additional (1): shard-rkl
Missing (3): pig-skl-6260u pig-kbl-iris pig-glk-j5005

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_7766_full:

### IGT changes ###

#### Possible regressions ####

* igt@api_intel_bb@full-batch:
- shard-glk: [PASS][1] -> [TIMEOUT][2] +2 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk7/igt@[email protected]

* igt@gem_exec_schedule@reorder-wide:
- shard-glk: NOTRUN -> [TIMEOUT][3] +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk7/igt@[email protected]

* igt@i915_module_load@reload-with-fault-injection:
- shard-tglb: [PASS][4] -> [INCOMPLETE][5]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb1/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb3/igt@[email protected]

#### Warnings ####

* igt@kms_big_fb@y-tiled-16bpp-rotate-270:
- shard-glk: [SKIP][6] ([fdo#109271]) -> [TIMEOUT][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk9/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk7/igt@[email protected]

* igt@kms_chamelium@vga-hpd-after-suspend:
- shard-glk: [SKIP][8] ([fdo#109271] / [fdo#111827]) -> [TIMEOUT][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk7/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk7/igt@[email protected]

Known issues
------------

Here are the changes found in IGTPW_7766_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@feature_discovery@psr2:
- shard-iclb: [PASS][10] -> [SKIP][11] ([i915#658])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb2/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb8/igt@[email protected]

* igt@gem_eio@in-flight-contexts-10ms:
- shard-tglb: [PASS][12] -> [TIMEOUT][13] ([i915#3063])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb2/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb7/igt@[email protected]

* igt@gem_eio@kms:
- shard-tglb: [PASS][14] -> [FAIL][15] ([i915#5784])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb7/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb1/igt@[email protected]

* igt@gem_eio@unwedge-stress:
- shard-iclb: [PASS][16] -> [TIMEOUT][17] ([i915#3070])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb5/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb8/igt@[email protected]

* igt@gem_exec_fair@basic-flow@rcs0:
- shard-tglb: [PASS][18] -> [FAIL][19] ([i915#2842]) +1 similar issue
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb7/igt@gem_exec_fair@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-iclb: [PASS][20] -> [FAIL][21] ([i915#2842])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb8/igt@gem_exec_fair@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-glk: [PASS][22] -> [FAIL][23] ([i915#2842])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk5/igt@gem_exec_fair@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk2/igt@gem_exec_fair@[email protected]

* igt@gem_lmem_swapping@smem-oom:
- shard-apl: NOTRUN -> [SKIP][24] ([fdo#109271] / [i915#4613]) +1 similar issue
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl1/igt@[email protected]

* igt@gem_pread@exhaustion:
- shard-snb: NOTRUN -> [WARN][25] ([i915#2658])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-snb7/igt@[email protected]

* igt@gem_userptr_blits@vma-merge:
- shard-apl: NOTRUN -> [FAIL][26] ([i915#3318])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl6/igt@[email protected]

* igt@gen7_exec_parse@oacontrol-tracking:
- shard-snb: NOTRUN -> [SKIP][27] ([fdo#109271]) +58 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-snb2/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [PASS][28] -> [FAIL][29] ([i915#454])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb6/igt@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb7/igt@[email protected]

* igt@i915_pm_dc@dc9-dpms:
- shard-apl: [PASS][30] -> [SKIP][31] ([fdo#109271])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl4/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl7/igt@[email protected]

* igt@kms_atomic_transition@plane-all-modeset-transition-fencing-internal-panels:
- shard-tglb: NOTRUN -> [SKIP][32] ([i915#1769] / [i915#3555])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb6/igt@kms_atomic_transition@plane-all-modeset-transition-fencing-internal-panels.html
- shard-iclb: NOTRUN -> [SKIP][33] ([i915#1769] / [i915#3555])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb3/igt@kms_atomic_transition@plane-all-modeset-transition-fencing-internal-panels.html

* igt@kms_ccs@pipe-a-ccs-on-another-bo-y_tiled_ccs:
- shard-tglb: NOTRUN -> [SKIP][34] ([i915#3689])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb2/igt@kms_ccs@pipe-a-ccs-on-another-bo-y_tiled_ccs.html

* igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_mc_ccs:
- shard-tglb: NOTRUN -> [SKIP][35] ([i915#3689] / [i915#3886])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb1/igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_mc_ccs.html
- shard-glk: NOTRUN -> [SKIP][36] ([fdo#109271] / [i915#3886])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk7/igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_mc_ccs.html
- shard-iclb: NOTRUN -> [SKIP][37] ([fdo#109278] / [i915#3886])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb6/igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc:
- shard-apl: NOTRUN -> [SKIP][38] ([fdo#109271] / [i915#3886]) +8 similar issues
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl6/igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_ccs@pipe-b-crc-primary-rotation-180-4_tiled_dg2_rc_ccs_cc:
- shard-tglb: NOTRUN -> [SKIP][39] ([i915#6095])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb5/igt@kms_ccs@pipe-b-crc-primary-rotation-180-4_tiled_dg2_rc_ccs_cc.html
- shard-iclb: NOTRUN -> [SKIP][40] ([fdo#109278])
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb4/igt@kms_ccs@pipe-b-crc-primary-rotation-180-4_tiled_dg2_rc_ccs_cc.html

* igt@kms_ccs@pipe-c-bad-rotation-90-yf_tiled_ccs:
- shard-tglb: NOTRUN -> [SKIP][41] ([fdo#111615] / [i915#3689])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb3/igt@kms_ccs@pipe-c-bad-rotation-90-yf_tiled_ccs.html

* igt@kms_chamelium@common-hpd-after-suspend:
- shard-apl: NOTRUN -> [SKIP][42] ([fdo#109271] / [fdo#111827]) +5 similar issues
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl4/igt@[email protected]

* igt@kms_chamelium@vga-hpd-enable-disable-mode:
- shard-snb: NOTRUN -> [SKIP][43] ([fdo#109271] / [fdo#111827])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-snb5/igt@[email protected]

* igt@kms_content_protection@content_type_change:
- shard-tglb: NOTRUN -> [SKIP][44] ([i915#1063])
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb3/igt@kms_content_protection@content_type_change.html
- shard-iclb: NOTRUN -> [SKIP][45] ([fdo#109300] / [fdo#111066])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb3/igt@kms_content_protection@content_type_change.html

* igt@kms_content_protection@lic:
- shard-apl: NOTRUN -> [TIMEOUT][46] ([i915#1319])
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl6/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor@atomic-transitions:
- shard-apl: [PASS][47] -> [FAIL][48] ([i915#2346])
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl6/igt@kms_cursor_legacy@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl8/igt@kms_cursor_legacy@[email protected]
- shard-glk: [PASS][49] -> [FAIL][50] ([i915#2346])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk9/igt@kms_cursor_legacy@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk7/igt@kms_cursor_legacy@[email protected]

* igt@kms_flip@2x-flip-vs-panning:
- shard-iclb: NOTRUN -> [SKIP][51] ([fdo#109274])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb8/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][52] ([fdo#109274] / [fdo#111825] / [i915#3637])
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb5/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@c-hdmi-a1:
- shard-glk: [PASS][53] -> [FAIL][54] ([i915#79])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk9/igt@kms_flip@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk1/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend@a-dp1:
- shard-apl: [PASS][55] -> [DMESG-WARN][56] ([i915#180])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl1/igt@kms_flip@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl4/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-64bpp-yftile-to-32bpp-yftile-upscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][57] ([i915#2672]) +11 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb3/igt@kms_flip_scaled_crc@flip-64bpp-yftile-to-32bpp-yftile-upscaling@pipe-a-default-mode.html

* igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][58] ([i915#2672] / [i915#3555]) +2 similar issues
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb3/igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling@pipe-a-default-mode.html

* igt@kms_frontbuffer_tracking@psr-2p-primscrn-spr-indfb-move:
- shard-tglb: NOTRUN -> [SKIP][59] ([fdo#109280] / [fdo#111825]) +1 similar issue
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb2/igt@[email protected]
- shard-glk: NOTRUN -> [SKIP][60] ([fdo#109271]) +5 similar issues
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][61] ([fdo#109280]) +1 similar issue
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb5/igt@[email protected]

* igt@kms_plane_scaling@plane-downscale-with-modifiers-factor-0-5@pipe-a-dp-1:
- shard-apl: NOTRUN -> [SKIP][62] ([fdo#109271]) +130 similar issues
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl4/igt@kms_plane_scaling@[email protected]

* igt@kms_psr2_sf@overlay-plane-update-continuous-sf:
- shard-apl: NOTRUN -> [SKIP][63] ([fdo#109271] / [i915#658])
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl4/igt@[email protected]

* igt@kms_psr2_su@frontbuffer-xrgb8888:
- shard-iclb: [PASS][64] -> [SKIP][65] ([fdo#109642] / [fdo#111068] / [i915#658])
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb2/igt@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb4/igt@[email protected]

* igt@kms_psr@psr2_primary_page_flip:
- shard-iclb: [PASS][66] -> [SKIP][67] ([fdo#109441]) +1 similar issue
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb5/igt@kms_psr@psr2_primary_page_flip.html

* igt@kms_psr_stress_test@invalidate-primary-flip-overlay:
- shard-tglb: [PASS][68] -> [SKIP][69] ([i915#5519])
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb3/igt@[email protected]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb1/igt@[email protected]

* igt@kms_vblank@pipe-d-wait-idle:
- shard-apl: NOTRUN -> [SKIP][70] ([fdo#109271] / [i915#533])
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl3/igt@[email protected]

* igt@kms_writeback@writeback-check-output:
- shard-apl: NOTRUN -> [SKIP][71] ([fdo#109271] / [i915#2437])
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl1/igt@[email protected]

* igt@perf@non-zero-reason:
- shard-glk: [PASS][72] -> [TIMEOUT][73] ([i915#2836])
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk2/igt@[email protected]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk7/igt@[email protected]

* igt@perf@polling-parameterized:
- shard-glk: [PASS][74] -> [FAIL][75] ([i915#5639])
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk2/igt@[email protected]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk5/igt@[email protected]

* igt@perf@stress-open-close:
- shard-glk: [PASS][76] -> [INCOMPLETE][77] ([i915#5213])
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk7/igt@[email protected]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk8/igt@[email protected]

* igt@prime_nv_pcopy@test3_1:
- shard-tglb: NOTRUN -> [SKIP][78] ([fdo#109291])
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb6/igt@prime_nv_pcopy@test3_1.html
- shard-iclb: NOTRUN -> [SKIP][79] ([fdo#109291])
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb5/igt@prime_nv_pcopy@test3_1.html

* igt@sysfs_clients@pidname:
- shard-apl: NOTRUN -> [SKIP][80] ([fdo#109271] / [i915#2994]) +2 similar issues
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl8/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_exec@basic-nohangcheck:
- shard-tglb: [FAIL][81] ([i915#6268]) -> [PASS][82]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb7/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb1/igt@[email protected]

* igt@gem_eio@unwedge-stress:
- shard-tglb: [FAIL][83] ([i915#5784]) -> [PASS][84]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb2/igt@[email protected]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb5/igt@[email protected]

* igt@gem_exec_balancer@parallel-bb-first:
- shard-iclb: [SKIP][85] ([i915#4525]) -> [PASS][86] +1 similar issue
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb3/igt@[email protected]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb4/igt@[email protected]

* igt@gem_exec_endless@dispatch@vcs0:
- shard-tglb: [INCOMPLETE][87] ([i915#3778]) -> [PASS][88]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb3/igt@gem_exec_endless@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb7/igt@gem_exec_endless@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- {shard-tglu}: [FAIL][89] ([i915#2842]) -> [PASS][90]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglu-2/igt@gem_exec_fair@[email protected]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglu-3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-solo@rcs0:
- shard-apl: [FAIL][91] ([i915#2842]) -> [PASS][92]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl7/igt@gem_exec_fair@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl1/igt@gem_exec_fair@[email protected]

* igt@gem_mmap_gtt@fault-concurrent-x:
- shard-snb: [INCOMPLETE][93] ([i915#5161]) -> [PASS][94]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-snb6/igt@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-snb7/igt@[email protected]

* igt@gem_workarounds@suspend-resume:
- shard-apl: [DMESG-WARN][95] ([i915#180]) -> [PASS][96] +3 similar issues
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl1/igt@[email protected]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl7/igt@[email protected]

* igt@i915_pm_dc@dc9-dpms:
- {shard-tglu}: [SKIP][97] ([i915#4281]) -> [PASS][98]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglu-1/igt@[email protected]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglu-4/igt@[email protected]

* igt@i915_pm_rps@engine-order:
- shard-apl: [FAIL][99] ([i915#6537]) -> [PASS][100]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl8/igt@[email protected]
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl1/igt@[email protected]
- shard-tglb: [FAIL][101] -> [PASS][102]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-tglb5/igt@[email protected]
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-tglb1/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible@ab-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][103] ([i915#79]) -> [PASS][104]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk1/igt@kms_flip@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk5/igt@kms_flip@[email protected]

* igt@kms_flip@2x-plain-flip-ts-check@ab-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][105] ([i915#2122]) -> [PASS][106]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-glk9/igt@kms_flip@[email protected]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-glk8/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@psr-slowdraw:
- shard-iclb: [FAIL][107] ([i915#1888] / [i915#2546]) -> [PASS][108]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb3/igt@[email protected]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb3/igt@[email protected]

* igt@kms_psr@psr2_no_drrs:
- shard-iclb: [SKIP][109] ([fdo#109441]) -> [PASS][110] +1 similar issue
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb7/igt@kms_psr@psr2_no_drrs.html
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb2/igt@kms_psr@psr2_no_drrs.html

#### Warnings ####

* igt@i915_pm_rc6_residency@rc6-idle@vecs0:
- shard-iclb: [FAIL][111] ([i915#2684]) -> [WARN][112] ([i915#2684])
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb8/igt@i915_pm_rc6_residency@[email protected]
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb3/igt@i915_pm_rc6_residency@[email protected]

* igt@kms_psr2_sf@overlay-plane-move-continuous-exceed-sf:
- shard-iclb: [SKIP][113] ([i915#658]) -> [SKIP][114] ([i915#2920])
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb8/igt@[email protected]
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb2/igt@[email protected]

* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-big-fb:
- shard-iclb: [SKIP][115] ([i915#2920]) -> [SKIP][116] ([i915#658]) +1 similar issue
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-iclb2/igt@[email protected]
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-iclb6/igt@[email protected]

* igt@runner@aborted:
- shard-apl: ([FAIL][117], [FAIL][118], [FAIL][119], [FAIL][120], [FAIL][121], [FAIL][122]) ([fdo#109271] / [i915#180] / [i915#3002] / [i915#4312] / [i915#5257] / [i915#6599]) -> ([FAIL][123], [FAIL][124], [FAIL][125]) ([i915#180] / [i915#3002] / [i915#4312] / [i915#5257] / [i915#6599])
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl1/igt@[email protected]
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl6/igt@[email protected]
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl1/igt@[email protected]
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl8/igt@[email protected]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl4/igt@[email protected]
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12114/shard-apl1/igt@[email protected]
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl4/igt@[email protected]
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl4/igt@[email protected]
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/shard-apl6/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
[fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
[fdo#109307]: https://bugs.freedesktop.org/show_bug.cgi?id=109307
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109314]: https://bugs.freedesktop.org/show_bug.cgi?id=109314
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110254]: https://bugs.freedesktop.org/show_bug.cgi?id=110254
[fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111066]: https://bugs.freedesktop.org/show_bug.cgi?id=111066
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111644]: https://bugs.freedesktop.org/show_bug.cgi?id=111644
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1063]: https://gitlab.freedesktop.org/drm/intel/issues/1063
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1257]: https://gitlab.freedesktop.org/drm/intel/issues/1257
[i915#1319]: https://gitlab.freedesktop.org/drm/intel/issues/1319
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1722]: https://gitlab.freedesktop.org/drm/intel/issues/1722
[i915#1769]: https://gitlab.freedesktop.org/drm/intel/issues/1769
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#1850]: https://gitlab.freedesktop.org/drm/intel/issues/1850
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#1902]: https://gitlab.freedesktop.org/drm/intel/issues/1902
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2232]: https://gitlab.freedesktop.org/drm/intel/issues/2232
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2434]: https://gitlab.freedesktop.org/drm/intel/issues/2434
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2530]: https://gitlab.freedesktop.org/drm/intel/issues/2530
[i915#2546]: https://gitlab.freedesktop.org/drm/intel/issues/2546
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2684]: https://gitlab.freedesktop.org/drm/intel/issues/2684
[i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
[i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
[i915#2836]: https://gitlab.freedesktop.org/drm/intel/issues/2836
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3002]: https://gitlab.freedesktop.org/drm/intel/issues/3002
[i915#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
[i915#3063]: https://gitlab.freedesktop.org/drm/intel/issues/3063
[i915#3070]: https://gitlab.freedesktop.org/drm/intel/issues/3070
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
[i915#3323]: https://gitlab.freedesktop.org/drm/intel/issues/3323
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
[i915#3528]: https://gitlab.freedesktop.org/drm/intel/issues/3528
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3778]: https://gitlab.freedesktop.org/drm/intel/issues/3778
[i915#3804]: https://gitlab.freedesktop.org/drm/intel/issues/3804
[i915#3810]: https://gitlab.freedesktop.org/drm/intel/issues/3810
[i915#3828]: https://gitlab.freedesktop.org/drm/intel/issues/3828
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
[i915#3987]: https://gitlab.freedesktop.org/drm/intel/issues/3987
[i915#4016]: https://gitlab.freedesktop.org/drm/intel/issues/4016
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4281]: https://gitlab.freedesktop.org/drm/intel/issues/4281
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4387]: https://gitlab.freedesktop.org/drm/intel/issues/4387
[i915#4525]: https://gitlab.freedesktop.org/drm/intel/issues/4525
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#5161]: https://gitlab.freedesktop.org/drm/intel/issues/5161
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5213]: https://gitlab.freedesktop.org/drm/intel/issues/5213
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5257]: https://gitlab.freedesktop.org/drm/intel/issues/5257
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
[i915#5519]: https://gitlab.freedesktop.org/drm/intel/issues/5519
[i915#5639]: https://gitlab.freedesktop.org/drm/intel/issues/5639
[i915#5723]: https://gitlab.freedesktop.org/drm/intel/issues/5723
[i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6227]: https://gitlab.freedesktop.org/drm/intel/issues/6227
[i915#6230]: https://gitlab.freedesktop.org/drm/intel/issues/6230
[i915#6245]: https://gitlab.freedesktop.org/drm/intel/issues/6245
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
[i915#6412]: https://gitlab.freedesktop.org/drm/intel/issues/6412
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#6537]: https://gitlab.freedesktop.org/drm/intel/issues/6537
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6590]: https://gitlab.freedesktop.org/drm/intel/issues/6590
[i915#6599]: https://gitlab.freedesktop.org/drm/intel/issues/6599
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_6650 -> IGTPW_7766
* Piglit: piglit_4509 -> None

CI-20190529: 20190529
CI_DRM_12114: 346251322fc81f256ed89dd437bcf4c83b578019 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_7766: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/index.html
IGT_6650: f7aff600ab16d6405f0704b1743d2b7909715752 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7766/index.html

#3 lore raw
In reply to Jake Freeland
Quoted 1,041 lines · Jake Freeland
---
 benchmarks/gem_exec_tracer.c        |   4 +
 benchmarks/gem_syslatency.c         |   6 ++
 include/linux-uapi/sync_file.h      |   5 ++
 lib/i915/gem_mman.c                 |   4 +-
 lib/i915/intel_memory_region.c      |   4 +
 lib/i915/perf.c                     |   2 +
 lib/igt_audio.c                     |   4 +
 lib/igt_aux.c                       |   6 +-
 lib/igt_aux.h                       |   6 +-
 lib/igt_core.c                      |   8 +-
 lib/igt_core.h                      |   5 ++
 lib/igt_debugfs.c                   |   2 +
 lib/igt_device.c                    |   2 +
 lib/igt_device_scan.c               |   4 +
 lib/igt_eld.c                       |   4 +
 lib/igt_frame.c                     |   4 +
 lib/igt_freebsd.h                   | 123 ++++++++++++++++++++++++++++
 lib/igt_kmod.h                      |   2 +
 lib/igt_kms.c                       |   4 +
 lib/igt_os.c                        |  19 +++++
 lib/igt_perf.c                      |   2 +
 lib/igt_perf.h                      |   4 +
 lib/igt_pm.c                        |   2 +
 lib/igt_sysfs.c                     |   2 +
 lib/igt_vgem.c                      |   2 +-
 lib/tests/igt_exit_handler.c        |   4 +
 lib/tests/igt_fork.c                |   2 +-
 lib/tests/igt_tests_common.h        |   9 ++
 runner/executor.c                   |   6 ++
 runner/job_list.c                   |   5 ++
 tests/i915/gem_close_race.c         |   2 +
 tests/i915/gem_mmap_gtt.c           |  24 +++---
 tests/i915/gem_mmap_offset.c        |  16 ++--
 tests/i915/i915_module_load.c       |   2 +
 tests/i915/i915_pm_backlight.c      |   4 +
 tests/i915/i915_pm_rpm.c            |   8 ++
 tests/kms_content_protection.c      |   2 +
 tests/kms_flip.c                    |   4 +
 tests/kms_sysfs_edid_timing.c       |   4 +
 tests/tools_test.c                  |  10 ++-
 tools/i915-perf/i915_perf_control.c |   2 +-
 tools/intel_gvtg_test.c             |   4 +
 42 files changed, 301 insertions(+), 37 deletions(-)
 create mode 100644 lib/igt_freebsd.h
benchmarks/gem_exec_tracer.c +4 -0
index e6973991..7e86473e 100644
@@ -41,6 +41,10 @@
 #include "intel_aub.h"
 #include "intel_chipset.h"
 
+#ifdef __FreeBSD__
+#include "igt_freebsd.h"
+#endif
+
 static int (*libc_close)(int fd);
 static int (*libc_ioctl)(int fd, unsigned long request, void *argp);
 
benchmarks/gem_syslatency.c +6 -0
index 035ee934..dafc6ac0 100644
@@ -42,12 +42,18 @@
 #include <limits.h>
 #include "drm.h"
 
+#ifdef __linux__
 #include <linux/unistd.h>
+#elif defined(__FreeBSD__)
+#include "igt_freebsd.h"
+#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;
 
include/linux-uapi/sync_file.h +5 -0
index b4f2db00..270c1cbc 100644
@@ -12,8 +12,13 @@
 #ifndef _LINUX_SYNC_H
 #define _LINUX_SYNC_H
 
+#ifdef __linux__
 #include <linux/ioctl.h>
 #include <linux/types.h>
+#elif defined(__FreeBSD__)
+#include <sys/ioctl.h>
+#include "igt_freebsd.h"
+#endif
 
 /**
  * struct sync_merge_data - data passed to merge ioctl
lib/i915/gem_mman.c +2 -2
index aa9ac6f3..0b41ba70 100644
@@ -118,7 +118,7 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
 	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
 	else
@@ -331,7 +331,7 @@ void *__gem_mmap_offset(int fd, uint32_t handle, uint64_t offset, uint64_t size,
 	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET, &arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
 
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
lib/i915/intel_memory_region.c +4 -0
index 93a18982..ca7f9140 100644
@@ -21,7 +21,11 @@
  * IN THE SOFTWARE.
  */
 
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
lib/i915/perf.c +2 -0
index d88835ff..beda6b8a 100644
@@ -29,7 +29,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <unistd.h>
 
lib/igt_audio.c +4 -0
index e0b1bafe..201a39c6 100644
@@ -26,6 +26,10 @@
 
 #include "config.h"
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include <errno.h>
 #include <fcntl.h>
 #include <gsl/gsl_fft_real.h>
lib/igt_aux.c +4 -2
index edb53425..ba2d52e8 100644
@@ -52,7 +52,9 @@
 #include <assert.h>
 #include <grp.h>
 
+#ifdef __linux__
 #include <proc/readproc.h>
+#endif
 #include <libudev.h>
 
 #include "drmtest.h"
@@ -323,10 +325,10 @@ void igt_fork_signal_helper(void)
 	 * and we send the signal at exactly the wrong time).
 	 */
 	signal(SIGCONT, sig_handler);
-	setpgrp(); /* define a new process group for the tests */
+	setpgid(0, 0); /* define a new process group for the tests */
 
 	igt_fork_helper(&signal_helper) {
-		setpgrp(); /* Escape from the test process group */
+		setpgid(0, 0); /* Escape from the test process group */
 
 		/* Pass along the test process group identifier,
 		 * negative pid => send signal to everyone in the group.
lib/igt_aux.h +2 -4
index c8d487b6..912f36c1 100644
@@ -34,9 +34,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
-#ifdef __linux__
-# include <sys/syscall.h>
-#endif
+#include <sys/syscall.h>
 
 #include <i915/gem_submission.h>
 
@@ -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 */
lib/igt_core.c +5 -3
index e7425326..17d5e013 100644
@@ -43,9 +43,7 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include <sys/types.h>
-#ifdef __linux__
 #include <sys/syscall.h>
-#endif
 #include <pthread.h>
 #include <sys/utsname.h>
 #include <termios.h>
@@ -786,6 +784,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 
 static void oom_adjust_for_doom(void)
 {
+#ifdef __linux__
 	int fd;
 	const char always_kill[] = "1000";
 
@@ -793,7 +792,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
 }
 
 /**
@@ -2224,6 +2223,9 @@ bool __igt_fork_helper(struct igt_helper_process *proc)
 	case 0:
 		reset_helper_process_list();
 		oom_adjust_for_doom();
+#ifdef __FreeBSD__
+		raise(SIGTERM);
+#endif
 
 		return true;
 	default:
lib/igt_core.h +5 -0
index aa98e8ed..295bb5d9 100644
@@ -31,7 +31,9 @@
 #define IGT_CORE_H
 
 #include <assert.h>
+#ifdef __linux__
 #include <byteswap.h>
+#endif
 #include <setjmp.h>
 #include <stdbool.h>
 #include <stdint.h>
@@ -47,6 +49,9 @@
 #define IGT_LOG_DOMAIN (NULL)
 #endif
 
+#ifdef __FreeBSD__
+#include "igt_freebsd.h"
+#endif
 
 #ifndef STATIC_ANALYSIS_BUILD
 #if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__)
lib/igt_debugfs.c +2 -0
index a56688a5..fa1e3b69 100644
@@ -25,7 +25,9 @@
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <dirent.h>
 #include <errno.h>
 #include <stdio.h>
lib/igt_device.c +2 -0
index fddfba72..49b77122 100644
@@ -25,7 +25,9 @@
 #include <fcntl.h>
 
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
lib/igt_device_scan.c +4 -0
index eb6b45b8..6a921d52 100644
@@ -32,7 +32,11 @@
 #include <fcntl.h>
 #include <glib.h>
 #include <libudev.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
lib/igt_eld.c +4 -0
index ef6625df..e05ad6de 100644
@@ -23,6 +23,10 @@
  * Authors: Simon Ser <[email protected]>
  */
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include "config.h"
 
 #include <dirent.h>
lib/igt_frame.c +4 -0
index 45523a79..ab74e678 100644
@@ -24,6 +24,10 @@
  *  Paul Kocialkowski <[email protected]>
  */
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include "config.h"
 
 #include <fcntl.h>
lib/igt_freebsd.h new file +123 -0
new file mode 100644
index 00000000..ea2603e4
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2022 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Jake Freeland <[email protected]>
+ *
+ */
+
+#if !defined(IGT_FREEBSD_H) && defined(__FreeBSD__)
+#define IGT_FREEBSD_H
+
+#include <sys/errno.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/sched.h>
+#include <sys/types.h>
+#include <sys/watchdog.h>
+
+#include <pthread.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <unistd.h>
+
+/*
+ * Proper substitutions:
+ * The following macros replace Linux-specific functions
+ * and macros with their FreeBSD equivalents.
+ */
+
+#define	__s32	int32_t
+#define	__u32	uint32_t
+#define	__u64	uint64_t
+
+#define	sighandler_t	sig_t
+#define	ino64_t		ino_t
+
+#define	jmp_buf	sigjmp_buf
+
+#define	PTRACE_TRACEME  PT_TRACE_ME
+#define	PTRACE_ATTACH   PT_ATTACH
+#define	PTRACE_PEEKDATA PT_READ_D
+#define	PTRACE_POKEDATA PT_WRITE_D
+#define	PTRACE_DETACH   PT_DETACH
+
+#define	I2C_RDWR		I2CRDWR
+#define	I2C_M_RD		IIC_M_RD
+#define	i2c_msg			iic_msg
+#define	i2c_rdwr_ioctl_data	iic_rdwr_data
+
+#define	_IOC_TYPE(nr)	(((nr) >> 8) & 255)
+
+#define	SYS_getdents64	SYS_freebsd11_getdents
+
+#define	mount(src, dest, fstype, flags, data)	\
+	mount(fstype, dest, flags, data)
+
+/*
+ * Improper substitutions:
+ * The following macros are temporary replacements for functions
+ * and macros that exist on Linux and do not exist on FreeBSD.
+ */
+
+#define	ETIME	ETIMEDOUT
+
+#define	MAP_POPULATE	MAP_PREFAULT_READ
+
+#define	MADV_HUGEPAGE	MADV_SEQUENTIAL
+#define	MADV_DONTFORK	MADV_NOSYNC
+
+#define	WDIOC_KEEPALIVE	WDIOCPATPAT
+
+#define	SCHED_RESET_ON_FORK	0
+#define	SCHED_IDLE	SCHED_OTHER
+
+#define	gettid()	getpid()
+
+#define	pthread_sigqueue(pid, signo, value)	\
+	sigqueue(pid, signo, value)
+
+#define	signalfd(fd, mask, flags)	-ENOSYS
+#define	timerfd_create(c, f)		-ENOSYS
+#define	timerfd_settime(fd, f, n, o)	-ENOSYS
+
+/*
+ * Macro conflict resolution.
+ */
+
+#undef	ALIGN
+#undef	PAGE_SIZE
+
+struct signalfd_siginfo {
+	uint32_t ssi_signo;
+	uint32_t ssi_pid;
+};
+
+struct kmod_module {
+	size_t size;
+};
+
+typedef struct {
+	char state;
+} proc_t;
+
+#endif /* IGT_FREEBSD_H */
lib/igt_kmod.h +2 -0
index f98dd29f..6596092b 100644
@@ -24,7 +24,9 @@
 #ifndef IGT_KMOD_H
 #define IGT_KMOD_H
 
+#ifdef __linux__
 #include <libkmod.h>
+#endif
 
 #include "igt_list.h"
 
lib/igt_kms.c +4 -0
index 1ba3bd2a..f0208c10 100644
@@ -43,6 +43,10 @@
 #include <sys/kd.h>
 #endif
 
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
 #include <libudev.h>
 #include <poll.h>
 #include <errno.h>
lib/igt_os.c +19 -0
index bdd5d933..ae426e3a 100644
@@ -44,6 +44,9 @@
 #include <sys/sysinfo.h>
 #elif defined(HAVE_SWAPCTL) /* Solaris */
 #include <sys/swap.h>
+#elif defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#include <sys/types.h>
 #endif
 #include <sys/resource.h>
 
@@ -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;
lib/igt_perf.c +2 -0
index b743859f..11c91c5f 100644
@@ -4,8 +4,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysinfo.h>
 #include <sys/sysmacros.h>
+#endif
 #include <time.h>
 #include <unistd.h>
 
lib/igt_perf.h +4 -0
index a8328c70..0cd91386 100644
@@ -27,10 +27,13 @@
 
 #include <stdint.h>
 
+#ifdef __linux__
 #include <linux/perf_event.h>
+#endif
 
 #include "igt_gt.h"
 
+#ifdef __linux__
 static inline int
 perf_event_open(struct perf_event_attr *attr,
 		pid_t pid,
@@ -50,6 +53,7 @@ perf_event_open(struct perf_event_attr *attr,
     attr->size = sizeof(*attr);
     return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags);
 }
+#endif /* __linux__ */
 
 uint64_t igt_perf_type_id(const char *device);
 int igt_perf_open(uint64_t type, uint64_t config);
lib/igt_pm.c +2 -0
index 99251b40..a6036e03 100644
@@ -33,7 +33,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <dirent.h>
 
lib/igt_sysfs.c +2 -0
index 9c307694..a913be4c 100644
@@ -24,7 +24,9 @@
 
 #include <inttypes.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/mount.h>
 #include <errno.h>
 #include <stdarg.h>
lib/igt_vgem.c +1 -1
index 7f933b23..468383c7 100644
@@ -76,7 +76,7 @@ void *__vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot)
 	if (drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg))
 		return NULL;
 
-	ptr = mmap64(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
+	ptr = mmap(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
 	if (ptr == MAP_FAILED)
 		return NULL;
 
lib/tests/igt_exit_handler.c +4 -0
index 892a7f14..d2381944 100644
@@ -125,5 +125,9 @@ int main(int argc, char **argv)
 	internal_assert_wexited(status, IGT_EXIT_SKIP);
 
 	status = testfunc(SIG);
+#ifdef __linux__
 	internal_assert_wsignaled(status, SIGTERM);
+#elif defined(__FreeBSD__)
+	internal_assert(status == 0);
+#endif
 }
lib/tests/igt_fork.c +1 -1
index d19d0945..c7193b06 100644
@@ -109,7 +109,7 @@ __noreturn static void igt_fork_timeout_leak(void)
 __noreturn static void subtest_leak(void)
 {
 	pid_t *children =
-		mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+		mmap(0, 4096, PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANON, -1, 0);
 	const int num_children = 4096 / sizeof(*children);
 
 	igt_subtest_init(fake_argc, fake_argv);
lib/tests/igt_tests_common.h +9 -0
index 058f6265..e8183897 100644
@@ -48,8 +48,17 @@ static inline void internal_assert_wexited(int wstatus, int exitcode)
 
 static inline void internal_assert_wsignaled(int wstatus, int signal)
 {
+#ifdef __linux__
 	internal_assert(WIFSIGNALED(wstatus) &&
 			WTERMSIG(wstatus) == signal);
+#elif defined(__FreeBSD__)
+	if (WIFSIGNALED(wstatus))
+		internal_assert(WTERMSIG(wstatus) == signal);
+	else if (WIFEXITED(wstatus))
+		internal_assert(WEXITSTATUS(wstatus) == signal + 128);
+	else
+		internal_assert(0);
+#endif
 }
 
 static inline void internal_assert_not_wsignaled(int wstatus)
runner/executor.c +6 -0
index 964d0063..c54072cf 100644
@@ -2,7 +2,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <glib.h>
+#ifdef __linux__
 #include <linux/watchdog.h>
+#endif
 #if HAVE_OPING
 #include <oping.h>
 #endif
@@ -33,6 +35,10 @@
 #define KMSG_HEADER "[IGT] "
 #define KMSG_WARN 4
 
+#ifdef __FreeBSD__
+#include <sys/watchdog.h>
+#endif
+
 static struct {
 	int *fds;
 	size_t num_dogs;
runner/job_list.c +5 -0
index 520a98da..6bfa7162 100644
@@ -1,7 +1,12 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <sys/wait.h>
+#include <limits.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
tests/i915/gem_close_race.c +2 -0
index 938fde8f..42fe1657 100644
@@ -61,7 +61,9 @@ static bool has_softpin;
 static uint64_t exec_addr;
 static uint64_t data_addr;
 
+#ifdef __linux__
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 static void selfcopy(int fd, uint32_t ctx, uint32_t handle, int loops)
 {
tests/i915/gem_mmap_gtt.c +12 -12
index e39b9047..683eaf16 100644
@@ -113,11 +113,11 @@ test_access(int fd)
 	mmap_arg.handle = handle;
 	do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
 
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd, mmap_arg.offset));
 
 	/* Check that the same offset on the other fd doesn't work. */
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd2, mmap_arg.offset) == MAP_FAILED);
 	igt_assert(errno == EACCES);
 
@@ -128,7 +128,7 @@ test_access(int fd)
 
 	/* Recheck that it works after flink. */
 	/* Check that the same offset on the other fd doesn't work. */
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd2, mmap_arg.offset));
 }
 
@@ -159,11 +159,11 @@ test_short(int fd)
 	for (pages = 1; pages <= OBJECT_SIZE / PAGE_SIZE; pages <<= 1) {
 		uint8_t *r, *w;
 
-		w = mmap64(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
+		w = mmap(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
 			   MAP_SHARED, fd, mmap_arg.offset);
 		igt_assert(w != MAP_FAILED);
 
-		r = mmap64(0, pages * PAGE_SIZE, PROT_READ,
+		r = mmap(0, pages * PAGE_SIZE, PROT_READ,
 			   MAP_SHARED, fd, mmap_arg.offset);
 		igt_assert(r != MAP_FAILED);
 
@@ -384,13 +384,13 @@ test_isolation(int i915)
 
 	close(B);
 
-	ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+	ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 	igt_assert(ptr != MAP_FAILED);
 	munmap(ptr, 4096);
 
 	close(A);
 
-	ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+	ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 	igt_assert(ptr == MAP_FAILED);
 }
 
@@ -400,7 +400,7 @@ test_close_race(int i915)
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	_Atomic uint32_t *handles;
 
-	handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -418,7 +418,7 @@ test_close_race(int i915)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, i915,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
@@ -444,7 +444,7 @@ test_flink_race(int i915)
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	_Atomic uint32_t *handles;
 
-	handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -469,7 +469,7 @@ test_flink_race(int i915)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, fd,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
@@ -566,7 +566,7 @@ test_ptrace(int fd)
 	for (int i = 0; i < sz / sizeof(long); i++) {
 		long ret;
 
-		ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i);
+		ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i, NULL);
 		igt_assert_eq_u64(ret, CC);
 		cpy[i] = ret;
 
tests/i915/gem_mmap_offset.c +8 -8
index 5e6b19eb..0933ed94 100644
@@ -66,7 +66,7 @@ __mmap_offset(int i915, uint32_t handle, uint64_t offset, uint64_t size,
 	if (mmap_offset_ioctl(i915, &arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
 	else
@@ -214,12 +214,12 @@ static void isolation(int i915)
 			 t->name, B, b, offset_b);
 
 		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
 		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
@@ -237,13 +237,13 @@ static void isolation(int i915)
 
 		close(B);
 
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 		igt_assert(ptr != MAP_FAILED);
 		munmap(ptr, 4096);
 
 		close(A);
 
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 		igt_assert(ptr == MAP_FAILED);
 	}
 }
@@ -370,7 +370,7 @@ static void test_ptrace(int i915)
 			for (int i = 0; i < SZ / sizeof(long); i++) {
 				long ret;
 
-				ret = ptrace(PTRACE_PEEKDATA, pid, ptr + i);
+				ret = ptrace(PTRACE_PEEKDATA, pid, ptr + i, NULL);
 				igt_assert_eq_u64(ret, CC);
 				cpy[i] = ret;
 
@@ -401,7 +401,7 @@ static void close_race(int i915, int timeout)
 	_Atomic uint32_t *handles;
 	size_t len = ALIGN((ncpus + 1) * sizeof(uint32_t), 4096);
 
-	handles = mmap64(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -420,7 +420,7 @@ static void close_race(int i915, int timeout)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, i915,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
tests/i915/i915_module_load.c +2 -0
index 4c72157c..9bec4c18 100644
@@ -23,7 +23,9 @@
 #include "igt.h"
 #include <dirent.h>
 #include <sys/utsname.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#endif
 #include <signal.h>
 #include <libgen.h>
 #include <signal.h>
tests/i915/i915_pm_backlight.c +4 -0
index cafae7f7..c520cf20 100644
@@ -46,6 +46,10 @@ struct context {
 #define FADESTEPS 10
 #define FADESPEED 100 /* milliseconds between steps */
 
+#ifdef __FreeBSD__
+#include <libgen.h>
+#endif
+
 IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
 
 static int backlight_read(int *result, const char *fname)
tests/i915/i915_pm_rpm.c +8 -0
index e95875dc..761e76f9 100644
@@ -40,8 +40,10 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
+#endif
 
 #include <drm.h>
 
@@ -54,6 +56,12 @@
 #include "igt_device.h"
 #include "igt_edid.h"
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#include <dev/iicbus/iic.h>
+#define	addr	slave
+#endif
+
 #define MSR_PC8_RES	0x630
 #define MSR_PC9_RES	0x631
 #define MSR_PC10_RES	0x632
tests/kms_content_protection.c +2 -0
index 3041f1cd..e0e5af78 100644
@@ -24,7 +24,9 @@
 
 #include <poll.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <sys/epoll.h>
+#endif
 #include <sys/stat.h>
 #include <libudev.h>
 #include "igt.h"
tests/kms_flip.c +4 -0
index 0567edea..1127e418 100755
@@ -45,6 +45,10 @@
 #include "i915/gem_create.h"
 #include "igt_stats.h"
 
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
 #define TEST_DPMS		(1 << 0)
 
 #define TEST_PAN		(1 << 3)
tests/kms_sysfs_edid_timing.c +4 -0
index 77521108..cd980c6a 100644
@@ -26,6 +26,10 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #define THRESHOLD_PER_CONNECTOR		150
 #define THRESHOLD_PER_CONNECTOR_MEAN	140
 #define THRESHOLD_ALL_CONNECTORS_MEAN	100
tests/tools_test.c +4 -0
index 237f0433..d0684d57 100644
@@ -28,7 +28,11 @@
 #include <fcntl.h>
 #include <libgen.h>
 #include <unistd.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 
 #define TOOLS "../tools/"
 

tests/tools_test.c static bool chdir_to_tools_dir(void) · line 72

Quoted 5 lines
tests/tools_test.c +1 -1
@@ -65,7 +69,7 @@ static bool chdir_to_tools_dir(void)
 	char path[PATH_MAX];
 	char *cwd;
 
-	cwd = get_current_dir_name();
+	cwd = getcwd(NULL, 0);

According to my man pages, making getcwd malloc a buffer itself when NULL is passed is a glibc extension. Does it work that way for FreeBSD too?

Signature · 1 line
Petri Latvala
Quoted 52 lines
tests/tools_test.c +2 -2
 	igt_info("Current working directory: %s\n", cwd);
 	free(cwd);
 
@@ -83,7 +87,7 @@ static bool chdir_to_tools_dir(void)
 		chdir(dirname(path));
 	}
 
-	cwd = get_current_dir_name();
+	cwd = getcwd(NULL, 0);
 	igt_info("Current working directory: %s\n", cwd);
 	free(cwd);
 
@@ -99,7 +103,7 @@ igt_main
 
 		igt_require_f(chdir_to_tools_dir(),
 			      "Unable to determine the tools directory, expecting them in $cwd/" TOOLS " or $path/" TOOLS "\n");
-		path = get_current_dir_name();
+		path = getcwd(NULL, 0);
 		igt_info("Using tools from %s\n", path);
 		free(path);
 	}
tools/i915-perf/i915_perf_control.c +1 -1
index be5996c0..f7db2f5c 100644
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
 
 			fwrite(data, total_len, 1, command_fifo_file);
 		} else {
-			char *cwd = get_current_dir_name();
+			char *cwd = getcwd(NULL, 0);
 			uint32_t path_len = strlen(cwd) + 1 + strlen(dump_file) + 1;
 			uint32_t total_len = sizeof(struct recorder_command_base) + path_len;
 			struct {
tools/intel_gvtg_test.c +4 -0
index ad5ee6a6..3e53c6d9 100644
@@ -55,6 +55,10 @@
 #include <limits.h>
 #include <dirent.h>
 
+#ifdef __FreeBSD__
+#include <sys/wait.h>
+#endif
+
 #define RANDOM(x) (rand() % x)
 
 
Signature · 1 line
2.37.3
#4 lore raw
In reply to Jake Freeland

Hi Jake,

Quoted 52 lines · Jake Freeland
---
 benchmarks/gem_exec_tracer.c        |   4 +
 benchmarks/gem_syslatency.c         |   6 ++
 include/linux-uapi/sync_file.h      |   5 ++
 lib/i915/gem_mman.c                 |   4 +-
 lib/i915/intel_memory_region.c      |   4 +
 lib/i915/perf.c                     |   2 +
 lib/igt_audio.c                     |   4 +
 lib/igt_aux.c                       |   6 +-
 lib/igt_aux.h                       |   6 +-
 lib/igt_core.c                      |   8 +-
 lib/igt_core.h                      |   5 ++
 lib/igt_debugfs.c                   |   2 +
 lib/igt_device.c                    |   2 +
 lib/igt_device_scan.c               |   4 +
 lib/igt_eld.c                       |   4 +
 lib/igt_frame.c                     |   4 +
 lib/igt_freebsd.h                   | 123 ++++++++++++++++++++++++++++
 lib/igt_kmod.h                      |   2 +
 lib/igt_kms.c                       |   4 +
 lib/igt_os.c                        |  19 +++++
 lib/igt_perf.c                      |   2 +
 lib/igt_perf.h                      |   4 +
 lib/igt_pm.c                        |   2 +
 lib/igt_sysfs.c                     |   2 +
 lib/igt_vgem.c                      |   2 +-
 lib/tests/igt_exit_handler.c        |   4 +
 lib/tests/igt_fork.c                |   2 +-
 lib/tests/igt_tests_common.h        |   9 ++
 runner/executor.c                   |   6 ++
 runner/job_list.c                   |   5 ++
 tests/i915/gem_close_race.c         |   2 +
 tests/i915/gem_mmap_gtt.c           |  24 +++---
 tests/i915/gem_mmap_offset.c        |  16 ++--
 tests/i915/i915_module_load.c       |   2 +
 tests/i915/i915_pm_backlight.c      |   4 +
 tests/i915/i915_pm_rpm.c            |   8 ++
 tests/kms_content_protection.c      |   2 +
 tests/kms_flip.c                    |   4 +
 tests/kms_sysfs_edid_timing.c       |   4 +
 tests/tools_test.c                  |  10 ++-
 tools/i915-perf/i915_perf_control.c |   2 +-
 tools/intel_gvtg_test.c             |   4 +
 42 files changed, 301 insertions(+), 37 deletions(-)
 create mode 100644 lib/igt_freebsd.h
benchmarks/gem_exec_tracer.c +0 -0
index e6973991..7e86473e 100644

benchmarks/gem_exec_tracer.c line 47

Quoted 7 lines
benchmarks/gem_exec_tracer.c +4 -0
@@ -41,6 +41,10 @@
 #include "intel_aub.h"
 #include "intel_chipset.h"
 
+#ifdef __FreeBSD__
+#include "igt_freebsd.h"
+#endif
+

Is it possible to keep changes as minimal as possible ? E.g. change as much as you can in libs and/or includes, so you can do not touch tests or benchmarks ?

Quoted 49 lines
benchmarks/gem_exec_tracer.c +0 -0
 static int (*libc_close)(int fd);
 static int (*libc_ioctl)(int fd, unsigned long request, void *argp);
 
benchmarks/gem_syslatency.c +6 -0
index 035ee934..dafc6ac0 100644
@@ -42,12 +42,18 @@
 #include <limits.h>
 #include "drm.h"
 
+#ifdef __linux__
 #include <linux/unistd.h>
+#elif defined(__FreeBSD__)
+#include "igt_freebsd.h"
+#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;
 
include/linux-uapi/sync_file.h +5 -0
index b4f2db00..270c1cbc 100644
@@ -12,8 +12,13 @@
 #ifndef _LINUX_SYNC_H
 #define _LINUX_SYNC_H
 
+#ifdef __linux__
 #include <linux/ioctl.h>
 #include <linux/types.h>
+#elif defined(__FreeBSD__)
+#include <sys/ioctl.h>
+#include "igt_freebsd.h"
+#endif
 
 /**
  * struct sync_merge_data - data passed to merge ioctl
lib/i915/gem_mman.c +0 -0
index aa9ac6f3..0b41ba70 100644

lib/i915/gem_mman.c void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot) · line 121

Quoted 5 lines
lib/i915/gem_mman.c +1 -1
@@ -118,7 +118,7 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
 	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);

Please move all mmap changes to separate patch, it will improve readeability.

Quoted 265 lines
lib/i915/gem_mman.c +1 -1
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
 	else
@@ -331,7 +331,7 @@ void *__gem_mmap_offset(int fd, uint32_t handle, uint64_t offset, uint64_t size,
 	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET, &arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
 
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
lib/i915/intel_memory_region.c +4 -0
index 93a18982..ca7f9140 100644
@@ -21,7 +21,11 @@
  * IN THE SOFTWARE.
  */
 
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
lib/i915/perf.c +2 -0
index d88835ff..beda6b8a 100644
@@ -29,7 +29,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <unistd.h>
 
lib/igt_audio.c +4 -0
index e0b1bafe..201a39c6 100644
@@ -26,6 +26,10 @@
 
 #include "config.h"
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include <errno.h>
 #include <fcntl.h>
 #include <gsl/gsl_fft_real.h>
lib/igt_aux.c +4 -2
index edb53425..ba2d52e8 100644
@@ -52,7 +52,9 @@
 #include <assert.h>
 #include <grp.h>
 
+#ifdef __linux__
 #include <proc/readproc.h>
+#endif
 #include <libudev.h>
 
 #include "drmtest.h"
@@ -323,10 +325,10 @@ void igt_fork_signal_helper(void)
 	 * and we send the signal at exactly the wrong time).
 	 */
 	signal(SIGCONT, sig_handler);
-	setpgrp(); /* define a new process group for the tests */
+	setpgid(0, 0); /* define a new process group for the tests */
 
 	igt_fork_helper(&signal_helper) {
-		setpgrp(); /* Escape from the test process group */
+		setpgid(0, 0); /* Escape from the test process group */
 
 		/* Pass along the test process group identifier,
 		 * negative pid => send signal to everyone in the group.
lib/igt_aux.h +2 -4
index c8d487b6..912f36c1 100644
@@ -34,9 +34,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
-#ifdef __linux__
-# include <sys/syscall.h>
-#endif
+#include <sys/syscall.h>
 
 #include <i915/gem_submission.h>
 
@@ -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 */
lib/igt_core.c +5 -3
index e7425326..17d5e013 100644
@@ -43,9 +43,7 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include <sys/types.h>
-#ifdef __linux__
 #include <sys/syscall.h>
-#endif
 #include <pthread.h>
 #include <sys/utsname.h>
 #include <termios.h>
@@ -786,6 +784,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 
 static void oom_adjust_for_doom(void)
 {
+#ifdef __linux__
 	int fd;
 	const char always_kill[] = "1000";
 
@@ -793,7 +792,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
 }
 
 /**
@@ -2224,6 +2223,9 @@ bool __igt_fork_helper(struct igt_helper_process *proc)
 	case 0:
 		reset_helper_process_list();
 		oom_adjust_for_doom();
+#ifdef __FreeBSD__
+		raise(SIGTERM);
+#endif
 
 		return true;
 	default:
lib/igt_core.h +5 -0
index aa98e8ed..295bb5d9 100644
@@ -31,7 +31,9 @@
 #define IGT_CORE_H
 
 #include <assert.h>
+#ifdef __linux__
 #include <byteswap.h>
+#endif
 #include <setjmp.h>
 #include <stdbool.h>
 #include <stdint.h>
@@ -47,6 +49,9 @@
 #define IGT_LOG_DOMAIN (NULL)
 #endif
 
+#ifdef __FreeBSD__
+#include "igt_freebsd.h"
+#endif
 
 #ifndef STATIC_ANALYSIS_BUILD
 #if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__)
lib/igt_debugfs.c +2 -0
index a56688a5..fa1e3b69 100644
@@ -25,7 +25,9 @@
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <dirent.h>
 #include <errno.h>
 #include <stdio.h>
lib/igt_device.c +2 -0
index fddfba72..49b77122 100644
@@ -25,7 +25,9 @@
 #include <fcntl.h>
 
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
lib/igt_device_scan.c +4 -0
index eb6b45b8..6a921d52 100644
@@ -32,7 +32,11 @@
 #include <fcntl.h>
 #include <glib.h>
 #include <libudev.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
lib/igt_eld.c +4 -0
index ef6625df..e05ad6de 100644
@@ -23,6 +23,10 @@
  * Authors: Simon Ser <[email protected]>
  */
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include "config.h"
 
 #include <dirent.h>
lib/igt_frame.c +4 -0
index 45523a79..ab74e678 100644
@@ -24,6 +24,10 @@
  *  Paul Kocialkowski <[email protected]>
  */
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include "config.h"
 
 #include <fcntl.h>
lib/igt_freebsd.h new file +11 -0
new file mode 100644
index 00000000..ea2603e4
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2022 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next

lib/igt_freebsd.h line 21

Quoted 10 lines
lib/igt_freebsd.h new file +10 -0
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.

Please use SPDX licence.

Quoted 146 lines
lib/igt_freebsd.h new file +102 -0
+ *
+ * Authors:
+ *    Jake Freeland <[email protected]>
+ *
+ */
+
+#if !defined(IGT_FREEBSD_H) && defined(__FreeBSD__)
+#define IGT_FREEBSD_H
+
+#include <sys/errno.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/sched.h>
+#include <sys/types.h>
+#include <sys/watchdog.h>
+
+#include <pthread.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <unistd.h>
+
+/*
+ * Proper substitutions:
+ * The following macros replace Linux-specific functions
+ * and macros with their FreeBSD equivalents.
+ */
+
+#define	__s32	int32_t
+#define	__u32	uint32_t
+#define	__u64	uint64_t
+
+#define	sighandler_t	sig_t
+#define	ino64_t		ino_t
+
+#define	jmp_buf	sigjmp_buf
+
+#define	PTRACE_TRACEME  PT_TRACE_ME
+#define	PTRACE_ATTACH   PT_ATTACH
+#define	PTRACE_PEEKDATA PT_READ_D
+#define	PTRACE_POKEDATA PT_WRITE_D
+#define	PTRACE_DETACH   PT_DETACH
+
+#define	I2C_RDWR		I2CRDWR
+#define	I2C_M_RD		IIC_M_RD
+#define	i2c_msg			iic_msg
+#define	i2c_rdwr_ioctl_data	iic_rdwr_data
+
+#define	_IOC_TYPE(nr)	(((nr) >> 8) & 255)
+
+#define	SYS_getdents64	SYS_freebsd11_getdents
+
+#define	mount(src, dest, fstype, flags, data)	\
+	mount(fstype, dest, flags, data)
+
+/*
+ * Improper substitutions:
+ * The following macros are temporary replacements for functions
+ * and macros that exist on Linux and do not exist on FreeBSD.
+ */
+
+#define	ETIME	ETIMEDOUT
+
+#define	MAP_POPULATE	MAP_PREFAULT_READ
+
+#define	MADV_HUGEPAGE	MADV_SEQUENTIAL
+#define	MADV_DONTFORK	MADV_NOSYNC
+
+#define	WDIOC_KEEPALIVE	WDIOCPATPAT
+
+#define	SCHED_RESET_ON_FORK	0
+#define	SCHED_IDLE	SCHED_OTHER
+
+#define	gettid()	getpid()
+
+#define	pthread_sigqueue(pid, signo, value)	\
+	sigqueue(pid, signo, value)
+
+#define	signalfd(fd, mask, flags)	-ENOSYS
+#define	timerfd_create(c, f)		-ENOSYS
+#define	timerfd_settime(fd, f, n, o)	-ENOSYS
+
+/*
+ * Macro conflict resolution.
+ */
+
+#undef	ALIGN
+#undef	PAGE_SIZE
+
+struct signalfd_siginfo {
+	uint32_t ssi_signo;
+	uint32_t ssi_pid;
+};
+
+struct kmod_module {
+	size_t size;
+};
+
+typedef struct {
+	char state;
+} proc_t;
+
+#endif /* IGT_FREEBSD_H */
lib/igt_kmod.h +2 -0
index f98dd29f..6596092b 100644
@@ -24,7 +24,9 @@
 #ifndef IGT_KMOD_H
 #define IGT_KMOD_H
 
+#ifdef __linux__
 #include <libkmod.h>
+#endif
 
 #include "igt_list.h"
 
lib/igt_kms.c +4 -0
index 1ba3bd2a..f0208c10 100644
@@ -43,6 +43,10 @@
 #include <sys/kd.h>
 #endif
 
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
 #include <libudev.h>
 #include <poll.h>
 #include <errno.h>
lib/igt_os.c +3 -0
index bdd5d933..ae426e3a 100644
@@ -44,6 +44,9 @@
 #include <sys/sysinfo.h>
 #elif defined(HAVE_SWAPCTL) /* Solaris */
 #include <sys/swap.h>
+#elif defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#include <sys/types.h>
 #endif
 #include <sys/resource.h>
 

lib/igt_os.c igt_get_avail_ram_mb(void) · line 154

Quoted 4 lines
lib/igt_os.c +1 -0
@@ -148,6 +151,15 @@ igt_get_avail_ram_mb(void)
 	npages = sysconf(_SC_AVPHYS_PAGES);
 
 	retval = (uint64_t) pagesize * npages;
+#elif defined(__FreeBSD__) /* FreeBSD */

-------------------------------- ^
You do not need to repeat it here.

Quoted 12 lines
lib/igt_os.c +8 -0
+	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

lib/igt_os.c igt_get_total_swap_mb(void) · line 225

Quoted 4 lines
lib/igt_os.c +1 -0
@@ -210,6 +222,13 @@ igt_get_total_swap_mb(void)
 	free(buf);
 
 	retval = (uint64_t) pagesize * totalpages;
+#elif defined(__FreeBSD__) /* FreeBSD */

-------------------------------- ^
Same here.

Regards,
Kamil

Quoted 544 lines
lib/igt_os.c +6 -0
+	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;
lib/igt_perf.c +2 -0
index b743859f..11c91c5f 100644
@@ -4,8 +4,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysinfo.h>
 #include <sys/sysmacros.h>
+#endif
 #include <time.h>
 #include <unistd.h>
 
lib/igt_perf.h +4 -0
index a8328c70..0cd91386 100644
@@ -27,10 +27,13 @@
 
 #include <stdint.h>
 
+#ifdef __linux__
 #include <linux/perf_event.h>
+#endif
 
 #include "igt_gt.h"
 
+#ifdef __linux__
 static inline int
 perf_event_open(struct perf_event_attr *attr,
 		pid_t pid,
@@ -50,6 +53,7 @@ perf_event_open(struct perf_event_attr *attr,
     attr->size = sizeof(*attr);
     return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags);
 }
+#endif /* __linux__ */
 
 uint64_t igt_perf_type_id(const char *device);
 int igt_perf_open(uint64_t type, uint64_t config);
lib/igt_pm.c +2 -0
index 99251b40..a6036e03 100644
@@ -33,7 +33,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <dirent.h>
 
lib/igt_sysfs.c +2 -0
index 9c307694..a913be4c 100644
@@ -24,7 +24,9 @@
 
 #include <inttypes.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/mount.h>
 #include <errno.h>
 #include <stdarg.h>
lib/igt_vgem.c +1 -1
index 7f933b23..468383c7 100644
@@ -76,7 +76,7 @@ void *__vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot)
 	if (drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg))
 		return NULL;
 
-	ptr = mmap64(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
+	ptr = mmap(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
 	if (ptr == MAP_FAILED)
 		return NULL;
 
lib/tests/igt_exit_handler.c +4 -0
index 892a7f14..d2381944 100644
@@ -125,5 +125,9 @@ int main(int argc, char **argv)
 	internal_assert_wexited(status, IGT_EXIT_SKIP);
 
 	status = testfunc(SIG);
+#ifdef __linux__
 	internal_assert_wsignaled(status, SIGTERM);
+#elif defined(__FreeBSD__)
+	internal_assert(status == 0);
+#endif
 }
lib/tests/igt_fork.c +1 -1
index d19d0945..c7193b06 100644
@@ -109,7 +109,7 @@ __noreturn static void igt_fork_timeout_leak(void)
 __noreturn static void subtest_leak(void)
 {
 	pid_t *children =
-		mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+		mmap(0, 4096, PROT_WRITE | PROT_READ, MAP_SHARED | MAP_ANON, -1, 0);
 	const int num_children = 4096 / sizeof(*children);
 
 	igt_subtest_init(fake_argc, fake_argv);
lib/tests/igt_tests_common.h +9 -0
index 058f6265..e8183897 100644
@@ -48,8 +48,17 @@ static inline void internal_assert_wexited(int wstatus, int exitcode)
 
 static inline void internal_assert_wsignaled(int wstatus, int signal)
 {
+#ifdef __linux__
 	internal_assert(WIFSIGNALED(wstatus) &&
 			WTERMSIG(wstatus) == signal);
+#elif defined(__FreeBSD__)
+	if (WIFSIGNALED(wstatus))
+		internal_assert(WTERMSIG(wstatus) == signal);
+	else if (WIFEXITED(wstatus))
+		internal_assert(WEXITSTATUS(wstatus) == signal + 128);
+	else
+		internal_assert(0);
+#endif
 }
 
 static inline void internal_assert_not_wsignaled(int wstatus)
runner/executor.c +6 -0
index 964d0063..c54072cf 100644
@@ -2,7 +2,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <glib.h>
+#ifdef __linux__
 #include <linux/watchdog.h>
+#endif
 #if HAVE_OPING
 #include <oping.h>
 #endif
@@ -33,6 +35,10 @@
 #define KMSG_HEADER "[IGT] "
 #define KMSG_WARN 4
 
+#ifdef __FreeBSD__
+#include <sys/watchdog.h>
+#endif
+
 static struct {
 	int *fds;
 	size_t num_dogs;
runner/job_list.c +5 -0
index 520a98da..6bfa7162 100644
@@ -1,7 +1,12 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <sys/wait.h>
+#include <limits.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
tests/i915/gem_close_race.c +2 -0
index 938fde8f..42fe1657 100644
@@ -61,7 +61,9 @@ static bool has_softpin;
 static uint64_t exec_addr;
 static uint64_t data_addr;
 
+#ifdef __linux__
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 static void selfcopy(int fd, uint32_t ctx, uint32_t handle, int loops)
 {
tests/i915/gem_mmap_gtt.c +12 -12
index e39b9047..683eaf16 100644
@@ -113,11 +113,11 @@ test_access(int fd)
 	mmap_arg.handle = handle;
 	do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
 
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd, mmap_arg.offset));
 
 	/* Check that the same offset on the other fd doesn't work. */
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd2, mmap_arg.offset) == MAP_FAILED);
 	igt_assert(errno == EACCES);
 
@@ -128,7 +128,7 @@ test_access(int fd)
 
 	/* Recheck that it works after flink. */
 	/* Check that the same offset on the other fd doesn't work. */
-	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+	igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd2, mmap_arg.offset));
 }
 
@@ -159,11 +159,11 @@ test_short(int fd)
 	for (pages = 1; pages <= OBJECT_SIZE / PAGE_SIZE; pages <<= 1) {
 		uint8_t *r, *w;
 
-		w = mmap64(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
+		w = mmap(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
 			   MAP_SHARED, fd, mmap_arg.offset);
 		igt_assert(w != MAP_FAILED);
 
-		r = mmap64(0, pages * PAGE_SIZE, PROT_READ,
+		r = mmap(0, pages * PAGE_SIZE, PROT_READ,
 			   MAP_SHARED, fd, mmap_arg.offset);
 		igt_assert(r != MAP_FAILED);
 
@@ -384,13 +384,13 @@ test_isolation(int i915)
 
 	close(B);
 
-	ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+	ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 	igt_assert(ptr != MAP_FAILED);
 	munmap(ptr, 4096);
 
 	close(A);
 
-	ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+	ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 	igt_assert(ptr == MAP_FAILED);
 }
 
@@ -400,7 +400,7 @@ test_close_race(int i915)
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	_Atomic uint32_t *handles;
 
-	handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -418,7 +418,7 @@ test_close_race(int i915)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, i915,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
@@ -444,7 +444,7 @@ test_flink_race(int i915)
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	_Atomic uint32_t *handles;
 
-	handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -469,7 +469,7 @@ test_flink_race(int i915)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, fd,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
@@ -566,7 +566,7 @@ test_ptrace(int fd)
 	for (int i = 0; i < sz / sizeof(long); i++) {
 		long ret;
 
-		ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i);
+		ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i, NULL);
 		igt_assert_eq_u64(ret, CC);
 		cpy[i] = ret;
 
tests/i915/gem_mmap_offset.c +8 -8
index 5e6b19eb..0933ed94 100644
@@ -66,7 +66,7 @@ __mmap_offset(int i915, uint32_t handle, uint64_t offset, uint64_t size,
 	if (mmap_offset_ioctl(i915, &arg))
 		return NULL;
 
-	ptr = mmap64(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
+	ptr = mmap(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
 	if (ptr == MAP_FAILED)
 		ptr = NULL;
 	else
@@ -214,12 +214,12 @@ static void isolation(int i915)
 			 t->name, B, b, offset_b);
 
 		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
 		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
@@ -237,13 +237,13 @@ static void isolation(int i915)
 
 		close(B);
 
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 		igt_assert(ptr != MAP_FAILED);
 		munmap(ptr, 4096);
 
 		close(A);
 
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
 		igt_assert(ptr == MAP_FAILED);
 	}
 }
@@ -370,7 +370,7 @@ static void test_ptrace(int i915)
 			for (int i = 0; i < SZ / sizeof(long); i++) {
 				long ret;
 
-				ret = ptrace(PTRACE_PEEKDATA, pid, ptr + i);
+				ret = ptrace(PTRACE_PEEKDATA, pid, ptr + i, NULL);
 				igt_assert_eq_u64(ret, CC);
 				cpy[i] = ret;
 
@@ -401,7 +401,7 @@ static void close_race(int i915, int timeout)
 	_Atomic uint32_t *handles;
 	size_t len = ALIGN((ncpus + 1) * sizeof(uint32_t), 4096);
 
-	handles = mmap64(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	handles = mmap(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(handles != MAP_FAILED);
 
 	igt_fork(child, ncpus + 1) {
@@ -420,7 +420,7 @@ static void close_race(int i915, int timeout)
 				  &mmap_arg) != -1) {
 				void *ptr;
 
-				ptr = mmap64(0, 4096,
+				ptr = mmap(0, 4096,
 					     PROT_WRITE, MAP_SHARED, i915,
 					     mmap_arg.offset);
 				if (ptr != MAP_FAILED) {
tests/i915/i915_module_load.c +2 -0
index 4c72157c..9bec4c18 100644
@@ -23,7 +23,9 @@
 #include "igt.h"
 #include <dirent.h>
 #include <sys/utsname.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#endif
 #include <signal.h>
 #include <libgen.h>
 #include <signal.h>
tests/i915/i915_pm_backlight.c +4 -0
index cafae7f7..c520cf20 100644
@@ -46,6 +46,10 @@ struct context {
 #define FADESTEPS 10
 #define FADESPEED 100 /* milliseconds between steps */
 
+#ifdef __FreeBSD__
+#include <libgen.h>
+#endif
+
 IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
 
 static int backlight_read(int *result, const char *fname)
tests/i915/i915_pm_rpm.c +8 -0
index e95875dc..761e76f9 100644
@@ -40,8 +40,10 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
+#endif
 
 #include <drm.h>
 
@@ -54,6 +56,12 @@
 #include "igt_device.h"
 #include "igt_edid.h"
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#include <dev/iicbus/iic.h>
+#define	addr	slave
+#endif
+
 #define MSR_PC8_RES	0x630
 #define MSR_PC9_RES	0x631
 #define MSR_PC10_RES	0x632
tests/kms_content_protection.c +2 -0
index 3041f1cd..e0e5af78 100644
@@ -24,7 +24,9 @@
 
 #include <poll.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <sys/epoll.h>
+#endif
 #include <sys/stat.h>
 #include <libudev.h>
 #include "igt.h"
tests/kms_flip.c +4 -0
index 0567edea..1127e418 100755
@@ -45,6 +45,10 @@
 #include "i915/gem_create.h"
 #include "igt_stats.h"
 
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
 #define TEST_DPMS		(1 << 0)
 
 #define TEST_PAN		(1 << 3)
tests/kms_sysfs_edid_timing.c +4 -0
index 77521108..cd980c6a 100644
@@ -26,6 +26,10 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #define THRESHOLD_PER_CONNECTOR		150
 #define THRESHOLD_PER_CONNECTOR_MEAN	140
 #define THRESHOLD_ALL_CONNECTORS_MEAN	100
tests/tools_test.c +7 -3
index 237f0433..d0684d57 100644
@@ -28,7 +28,11 @@
 #include <fcntl.h>
 #include <libgen.h>
 #include <unistd.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 
 #define TOOLS "../tools/"
 
@@ -65,7 +69,7 @@ static bool chdir_to_tools_dir(void)
 	char path[PATH_MAX];
 	char *cwd;
 
-	cwd = get_current_dir_name();
+	cwd = getcwd(NULL, 0);
 	igt_info("Current working directory: %s\n", cwd);
 	free(cwd);
 
@@ -83,7 +87,7 @@ static bool chdir_to_tools_dir(void)
 		chdir(dirname(path));
 	}
 
-	cwd = get_current_dir_name();
+	cwd = getcwd(NULL, 0);
 	igt_info("Current working directory: %s\n", cwd);
 	free(cwd);
 
@@ -99,7 +103,7 @@ igt_main
 
 		igt_require_f(chdir_to_tools_dir(),
 			      "Unable to determine the tools directory, expecting them in $cwd/" TOOLS " or $path/" TOOLS "\n");
-		path = get_current_dir_name();
+		path = getcwd(NULL, 0);
 		igt_info("Using tools from %s\n", path);
 		free(path);
 	}
tools/i915-perf/i915_perf_control.c +1 -1
index be5996c0..f7db2f5c 100644
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
 
 			fwrite(data, total_len, 1, command_fifo_file);
 		} else {
-			char *cwd = get_current_dir_name();
+			char *cwd = getcwd(NULL, 0);
 			uint32_t path_len = strlen(cwd) + 1 + strlen(dump_file) + 1;
 			uint32_t total_len = sizeof(struct recorder_command_base) + path_len;
 			struct {
tools/intel_gvtg_test.c +4 -0
index ad5ee6a6..3e53c6d9 100644
@@ -55,6 +55,10 @@
 #include <limits.h>
 #include <dirent.h>
 
+#ifdef __FreeBSD__
+#include <sys/wait.h>
+#endif
+
 #define RANDOM(x) (rand() % x)
 
 
Signature · 1 line
2.37.3
#5 lore raw

Kamil,

Thank you for the patch review. I just submitted a new diff following your suggestions.

Unfortunately there are some major differences in the way that FreeBSD handles signals
and return values compared to Linux. This makes directly modifying tests with #ifdefs necessary in
some cases. I have and will continue to try to keep the tests as untouched as possible, though.

Thank you,
Jake Freeland

Quoted 1,166 lines · Kamil Konieczny

Hi Jake,

Quoted 52 lines · Jake Freeland
---
 benchmarks/gem_exec_tracer.c        |   4 +
 benchmarks/gem_syslatency.c         |   6 ++
 include/linux-uapi/sync_file.h      |   5 ++
 lib/i915/gem_mman.c                 |   4 +-
 lib/i915/intel_memory_region.c      |   4 +
 lib/i915/perf.c                     |   2 +
 lib/igt_audio.c                     |   4 +
 lib/igt_aux.c                       |   6 +-
 lib/igt_aux.h                       |   6 +-
 lib/igt_core.c                      |   8 +-
 lib/igt_core.h                      |   5 ++
 lib/igt_debugfs.c                   |   2 +
 lib/igt_device.c                    |   2 +
 lib/igt_device_scan.c               |   4 +
 lib/igt_eld.c                       |   4 +
 lib/igt_frame.c                     |   4 +
 lib/igt_freebsd.h                   | 123 ++++++++++++++++++++++++++++
 lib/igt_kmod.h                      |   2 +
 lib/igt_kms.c                       |   4 +
 lib/igt_os.c                        |  19 +++++
 lib/igt_perf.c                      |   2 +
 lib/igt_perf.h                      |   4 +
 lib/igt_pm.c                        |   2 +
 lib/igt_sysfs.c                     |   2 +
 lib/igt_vgem.c                      |   2 +-
 lib/tests/igt_exit_handler.c        |   4 +
 lib/tests/igt_fork.c                |   2 +-
 lib/tests/igt_tests_common.h        |   9 ++
 runner/executor.c                   |   6 ++
 runner/job_list.c                   |   5 ++
 tests/i915/gem_close_race.c         |   2 +
 tests/i915/gem_mmap_gtt.c           |  24 +++---
 tests/i915/gem_mmap_offset.c        |  16 ++--
 tests/i915/i915_module_load.c       |   2 +
 tests/i915/i915_pm_backlight.c      |   4 +
 tests/i915/i915_pm_rpm.c            |   8 ++
 tests/kms_content_protection.c      |   2 +
 tests/kms_flip.c                    |   4 +
 tests/kms_sysfs_edid_timing.c       |   4 +
 tests/tools_test.c                  |  10 ++-
 tools/i915-perf/i915_perf_control.c |   2 +-
 tools/intel_gvtg_test.c             |   4 +
 42 files changed, 301 insertions(+), 37 deletions(-)
 create mode 100644 lib/igt_freebsd.h
benchmarks/gem_exec_tracer.c +0 -0
index e6973991..7e86473e 100644

benchmarks/gem_exec_tracer.c line 47

Quoted 7 lines
benchmarks/gem_exec_tracer.c +4 -0
@@ -41,6 +41,10 @@
 #include "intel_aub.h"
 #include "intel_chipset.h"
 
+#ifdef __FreeBSD__
+#include "igt_freebsd.h"
+#endif
+

Is it possible to keep changes as minimal as possible ? E.g. change as much as you can in libs and/or includes, so you can do not touch tests or benchmarks ?

Review

Quoted 27 lines
benchmarks/gem_exec_tracer.c +0 -0
 static int (*libc_close)(int fd);
 static int (*libc_ioctl)(int fd, unsigned long request, void *argp);
 
benchmarks/gem_syslatency.c +6 -0
index 035ee934..dafc6ac0 100644
@@ -42,12 +42,18 @@
 #include <limits.h>
 #include "drm.h"
 
+#ifdef __linux__
 #include <linux/unistd.h>
+#elif defined(__FreeBSD__)
+#include "igt_freebsd.h"
+#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;
 
(quoted diff) +0 -0

b/include/linux-uapi/sync_file.h

lib/i915/gem_mman.c void *__gem_mmap__gtt(int fd, uint32_t handle,

Quoted 22 lines

index b4f2db00..270c1cbc 100644

include/linux-uapi/sync_file.h +5 -0
@@ -12,8 +12,13 @@
 #ifndef _LINUX_SYNC_H
 #define _LINUX_SYNC_H
 
+#ifdef __linux__
 #include <linux/ioctl.h>
 #include <linux/types.h>
+#elif defined(__FreeBSD__)
+#include <sys/ioctl.h>
+#include "igt_freebsd.h"
+#endif
 
 /**
  * struct sync_merge_data - data passed to merge ioctl
lib/i915/gem_mman.c +0 -0
index aa9ac6f3..0b41ba70 100644
@@ -118,7 +118,7 @@ void *__gem_mmap__gtt(int fd, uint32_t handle,

uint64_t size, unsigned prot)

lib/i915/gem_mman.c void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot) · line 121

Quoted 5 lines
lib/i915/gem_mman.c +1 -1
      if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
              return NULL;
 
-     ptr = mmap64(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
+     ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);

Please move all mmap changes to separate patch, it will improve readeability.

lib/i915/gem_mman.c void *__gem_mmap_offset(int fd, uint32_t handle,

Quoted 4 lines
lib/i915/gem_mman.c +0 -0
      if (ptr == MAP_FAILED)
              ptr = NULL;
      else
@@ -331,7 +331,7 @@ void *__gem_mmap_offset(int fd, uint32_t handle,

uint64_t offset, uint64_t size,

Review

Quoted 9 lines
lib/i915/gem_mman.c +1 -1
      if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET, &arg))
              return NULL;
 
-     ptr = mmap64(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
+     ptr = mmap(0, size, prot, MAP_SHARED, fd, arg.offset + offset);
 
      if (ptr == MAP_FAILED)
              ptr = NULL;
(quoted diff) +0 -0

b/lib/i915/intel_memory_region.c

lib/igt_core.c static void print_usage(const char *help_str, bool

Quoted 111 lines

index 93a18982..ca7f9140 100644

lib/i915/intel_memory_region.c +4 -0
@@ -21,7 +21,11 @@
  * IN THE SOFTWARE.
  */
 
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
lib/i915/perf.c +2 -0
index d88835ff..beda6b8a 100644
@@ -29,7 +29,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <unistd.h>
 
lib/igt_audio.c +4 -0
index e0b1bafe..201a39c6 100644
@@ -26,6 +26,10 @@
 
 #include "config.h"
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include <errno.h>
 #include <fcntl.h>
 #include <gsl/gsl_fft_real.h>
lib/igt_aux.c +4 -2
index edb53425..ba2d52e8 100644
@@ -52,7 +52,9 @@
 #include <assert.h>
 #include <grp.h>
 
+#ifdef __linux__
 #include <proc/readproc.h>
+#endif
 #include <libudev.h>
 
 #include "drmtest.h"
@@ -323,10 +325,10 @@ void igt_fork_signal_helper(void)
       * and we send the signal at exactly the wrong time).
       */
      signal(SIGCONT, sig_handler);
-     setpgrp(); /* define a new process group for the tests */
+     setpgid(0, 0); /* define a new process group for the tests */
 
      igt_fork_helper(&signal_helper) {
-             setpgrp(); /* Escape from the test process group */
+             setpgid(0, 0); /* Escape from the test process group */
 
              /* Pass along the test process group identifier,
               * negative pid => send signal to everyone in the group.
lib/igt_aux.h +2 -4
index c8d487b6..912f36c1 100644
@@ -34,9 +34,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
-#ifdef __linux__
-# include <sys/syscall.h>
-#endif
+#include <sys/syscall.h>
 
 #include <i915/gem_submission.h>
 
@@ -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 */
lib/igt_core.c +0 -2
index e7425326..17d5e013 100644
@@ -43,9 +43,7 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include <sys/types.h>
-#ifdef __linux__
 #include <sys/syscall.h>
-#endif
 #include <pthread.h>
 #include <sys/utsname.h>
 #include <termios.h>
@@ -786,6 +784,7 @@ static void print_usage(const char *help_str, bool

output_on_stderr)

lib/igt_core.c static void oom_adjust_for_doom(void) · line 793

Quoted 10 lines
lib/igt_core.c +1 -0
 static void oom_adjust_for_doom(void)
 {
+#ifdef __linux__
      int fd;
      const char always_kill[] = "1000";
 
@@ -793,7 +792,7 @@ static void oom_adjust_for_doom(void)
      igt_assert(fd != -1);
      igt_assert(write(fd, always_kill, sizeof(always_kill)) ==

sizeof(always_kill));

lib/igt_core.c bool __igt_fork_helper(struct igt_helper_process

Quoted 7 lines
lib/igt_core.c +1 -1
      close(fd);
-
+#endif
 }
 
 /**
@@ -2224,6 +2223,9 @@ bool __igt_fork_helper(struct igt_helper_process

*proc)

Quoted 24 lines
lib/igt_core.c +3 -0
      case 0:
              reset_helper_process_list();
              oom_adjust_for_doom();
+#ifdef __FreeBSD__
+             raise(SIGTERM);
+#endif
 
              return true;
      default:
lib/igt_core.h +2 -0
index aa98e8ed..295bb5d9 100644
@@ -31,7 +31,9 @@
 #define IGT_CORE_H
 
 #include <assert.h>
+#ifdef __linux__
 #include <byteswap.h>
+#endif
 #include <setjmp.h>
 #include <stdbool.h>
 #include <stdint.h>

lib/igt_core.h line 57

Quoted 9 lines
lib/igt_core.h +3 -0
@@ -47,6 +49,9 @@
 #define IGT_LOG_DOMAIN (NULL)
 #endif
 
+#ifdef __FreeBSD__
+#include "igt_freebsd.h"
+#endif
 
 #ifndef STATIC_ANALYSIS_BUILD
 #if defined(__clang_analyzer__) || defined(__COVERITY__) ||

defined(__KLOCWORK__)

Quoted 80 lines
lib/igt_debugfs.c +2 -0
index a56688a5..fa1e3b69 100644
@@ -25,7 +25,9 @@
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <dirent.h>
 #include <errno.h>
 #include <stdio.h>
lib/igt_device.c +2 -0
index fddfba72..49b77122 100644
@@ -25,7 +25,9 @@
 #include <fcntl.h>
 
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
lib/igt_device_scan.c +4 -0
index eb6b45b8..6a921d52 100644
@@ -32,7 +32,11 @@
 #include <fcntl.h>
 #include <glib.h>
 #include <libudev.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
lib/igt_eld.c +4 -0
index ef6625df..e05ad6de 100644
@@ -23,6 +23,10 @@
  * Authors: Simon Ser <[email protected]>
  */
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include "config.h"
 
 #include <dirent.h>
lib/igt_frame.c +4 -0
index 45523a79..ab74e678 100644
@@ -24,6 +24,10 @@
  *  Paul Kocialkowski <[email protected]>
  */
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #include "config.h"
 
 #include <fcntl.h>
lib/igt_freebsd.h new file +0 -0
new file mode 100644
index 00000000..ea2603e4

lib/igt_freebsd.h line 4

Quoted 4 lines
lib/igt_freebsd.h new file +4 -0
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2022 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person

obtaining a

lib/igt_freebsd.h line 5

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * copy of this software and associated documentation files (the

"Software"),

lib/igt_freebsd.h line 6

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * to deal in the Software without restriction, including without

limitation

lib/igt_freebsd.h line 7

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * the rights to use, copy, modify, merge, publish, distribute,

sublicense,

lib/igt_freebsd.h

Quoted 4 lines
lib/igt_freebsd.h new file +4 -0
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the

next

lib/igt_freebsd.h line 12

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * paragraph) shall be included in all copies or substantial portions

of the

lib/igt_freebsd.h

Quoted 3 lines
lib/igt_freebsd.h new file +3 -0
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,

EXPRESS OR

lib/igt_freebsd.h line 16

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF

MERCHANTABILITY,

lib/igt_freebsd.h line 17

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT

SHALL

lib/igt_freebsd.h line 18

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR

OTHER

lib/igt_freebsd.h line 19

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,

ARISING

lib/igt_freebsd.h line 20

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

DEALINGS

lib/igt_freebsd.h line 21

Quoted 1 line
lib/igt_freebsd.h new file +1 -0
+ * IN THE SOFTWARE.

Please use SPDX licence.

Quoted 146 lines
lib/igt_freebsd.h new file +102 -0
+ *
+ * Authors:
+ *    Jake Freeland <[email protected]>
+ *
+ */
+
+#if !defined(IGT_FREEBSD_H) && defined(__FreeBSD__)
+#define IGT_FREEBSD_H
+
+#include <sys/errno.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/sched.h>
+#include <sys/types.h>
+#include <sys/watchdog.h>
+
+#include <pthread.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <unistd.h>
+
+/*
+ * Proper substitutions:
+ * The following macros replace Linux-specific functions
+ * and macros with their FreeBSD equivalents.
+ */
+
+#define      __s32   int32_t
+#define      __u32   uint32_t
+#define      __u64   uint64_t
+
+#define      sighandler_t    sig_t
+#define      ino64_t         ino_t
+
+#define      jmp_buf sigjmp_buf
+
+#define      PTRACE_TRACEME  PT_TRACE_ME
+#define      PTRACE_ATTACH   PT_ATTACH
+#define      PTRACE_PEEKDATA PT_READ_D
+#define      PTRACE_POKEDATA PT_WRITE_D
+#define      PTRACE_DETACH   PT_DETACH
+
+#define      I2C_RDWR                I2CRDWR
+#define      I2C_M_RD                IIC_M_RD
+#define      i2c_msg                 iic_msg
+#define      i2c_rdwr_ioctl_data     iic_rdwr_data
+
+#define      _IOC_TYPE(nr)   (((nr) >> 8) & 255)
+
+#define      SYS_getdents64  SYS_freebsd11_getdents
+
+#define      mount(src, dest, fstype, flags, data)   \
+     mount(fstype, dest, flags, data)
+
+/*
+ * Improper substitutions:
+ * The following macros are temporary replacements for functions
+ * and macros that exist on Linux and do not exist on FreeBSD.
+ */
+
+#define      ETIME   ETIMEDOUT
+
+#define      MAP_POPULATE    MAP_PREFAULT_READ
+
+#define      MADV_HUGEPAGE   MADV_SEQUENTIAL
+#define      MADV_DONTFORK   MADV_NOSYNC
+
+#define      WDIOC_KEEPALIVE WDIOCPATPAT
+
+#define      SCHED_RESET_ON_FORK     0
+#define      SCHED_IDLE      SCHED_OTHER
+
+#define      gettid()        getpid()
+
+#define      pthread_sigqueue(pid, signo, value)     \
+     sigqueue(pid, signo, value)
+
+#define      signalfd(fd, mask, flags)       -ENOSYS
+#define      timerfd_create(c, f)            -ENOSYS
+#define      timerfd_settime(fd, f, n, o)    -ENOSYS
+
+/*
+ * Macro conflict resolution.
+ */
+
+#undef       ALIGN
+#undef       PAGE_SIZE
+
+struct signalfd_siginfo {
+     uint32_t ssi_signo;
+     uint32_t ssi_pid;
+};
+
+struct kmod_module {
+     size_t size;
+};
+
+typedef struct {
+     char state;
+} proc_t;
+
+#endif /* IGT_FREEBSD_H */
lib/igt_kmod.h +2 -0
index f98dd29f..6596092b 100644
@@ -24,7 +24,9 @@
 #ifndef IGT_KMOD_H
 #define IGT_KMOD_H
 
+#ifdef __linux__
 #include <libkmod.h>
+#endif
 
 #include "igt_list.h"
 
lib/igt_kms.c +4 -0
index 1ba3bd2a..f0208c10 100644
@@ -43,6 +43,10 @@
 #include <sys/kd.h>
 #endif
 
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
 #include <libudev.h>
 #include <poll.h>
 #include <errno.h>
lib/igt_os.c +3 -0
index bdd5d933..ae426e3a 100644
@@ -44,6 +44,9 @@
 #include <sys/sysinfo.h>
 #elif defined(HAVE_SWAPCTL) /* Solaris */
 #include <sys/swap.h>
+#elif defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#include <sys/types.h>
 #endif
 #include <sys/resource.h>
 

lib/igt_os.c igt_get_avail_ram_mb(void) · line 154

Quoted 4 lines
lib/igt_os.c +1 -0
@@ -148,6 +151,15 @@ igt_get_avail_ram_mb(void)
      npages = sysconf(_SC_AVPHYS_PAGES);
 
      retval = (uint64_t) pagesize * npages;
+#elif defined(__FreeBSD__) /* FreeBSD */

-------------------------------- ^
You do not need to repeat it here.

lib/igt_os.c igt_get_avail_ram_mb(void)

Quoted 5 lines
lib/igt_os.c +5 -0
+     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);

lib/igt_os.c igt_get_avail_ram_mb(void) · line 160

Quoted 1 line
lib/igt_os.c +1 -0
+     sysctlbyname("vm.stats.vm.v_page_size", &pagesize, &pagesize_len,

NULL, 0);

lib/igt_os.c igt_get_total_swap_mb(void) · line 225

Quoted 10 lines
lib/igt_os.c +3 -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 */

-------------------------------- ^
Same here.

Regards,
Kamil

lib/igt_os.c igt_get_total_swap_mb(void)

Quoted 4 lines
lib/igt_os.c +4 -0
+     uint64_t swap_total;
+     size_t swap_total_len = sizeof(swap_total);
+
+     sysctlbyname("vm.swap_total", &swap_total, &swap_total_len, NULL,

0);

Quoted 39 lines
lib/igt_os.c +2 -0
+
+     retval = swap_total;
 #else
 #warning "Unknown how to get swap size for this OS"
      return 0;
lib/igt_perf.c +2 -0
index b743859f..11c91c5f 100644
@@ -4,8 +4,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysinfo.h>
 #include <sys/sysmacros.h>
+#endif
 #include <time.h>
 #include <unistd.h>
 
lib/igt_perf.h +3 -0
index a8328c70..0cd91386 100644
@@ -27,10 +27,13 @@
 
 #include <stdint.h>
 
+#ifdef __linux__
 #include <linux/perf_event.h>
+#endif
 
 #include "igt_gt.h"
 
+#ifdef __linux__
 static inline int
 perf_event_open(struct perf_event_attr *attr,
              pid_t pid,

lib/igt_perf.h perf_event_open(struct perf_event_attr *attr, · line 54

Quoted 2 lines
lib/igt_perf.h +0 -0
@@ -50,6 +53,7 @@ perf_event_open(struct perf_event_attr *attr,
     attr->size = sizeof(*attr);
     return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd,

flags);

lib/igt_vgem.c void *__vgem_mmap(int fd, struct vgem_bo *bo, unsigned

Quoted 38 lines
lib/igt_perf.h +1 -0
 }
+#endif /* __linux__ */
 
 uint64_t igt_perf_type_id(const char *device);
 int igt_perf_open(uint64_t type, uint64_t config);
lib/igt_pm.c +2 -0
index 99251b40..a6036e03 100644
@@ -33,7 +33,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <dirent.h>
 
lib/igt_sysfs.c +2 -0
index 9c307694..a913be4c 100644
@@ -24,7 +24,9 @@
 
 #include <inttypes.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <sys/sysmacros.h>
+#endif
 #include <sys/mount.h>
 #include <errno.h>
 #include <stdarg.h>
lib/igt_vgem.c +0 -0
index 7f933b23..468383c7 100644
@@ -76,7 +76,7 @@ void *__vgem_mmap(int fd, struct vgem_bo *bo, unsigned

prot)

Quoted 27 lines
lib/igt_vgem.c +1 -1
      if (drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg))
              return NULL;
 
-     ptr = mmap64(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
+     ptr = mmap(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
      if (ptr == MAP_FAILED)
              return NULL;
 
lib/tests/igt_exit_handler.c +4 -0
index 892a7f14..d2381944 100644
@@ -125,5 +125,9 @@ int main(int argc, char **argv)
      internal_assert_wexited(status, IGT_EXIT_SKIP);
 
      status = testfunc(SIG);
+#ifdef __linux__
      internal_assert_wsignaled(status, SIGTERM);
+#elif defined(__FreeBSD__)
+     internal_assert(status == 0);
+#endif
 }
lib/tests/igt_fork.c +0 -0
index d19d0945..c7193b06 100644

lib/tests/igt_fork.c __noreturn static void igt_fork_timeout_leak(void) · line 112

Quoted 5 lines
lib/tests/igt_fork.c +1 -1
@@ -109,7 +109,7 @@ __noreturn static void igt_fork_timeout_leak(void)
 __noreturn static void subtest_leak(void)
 {
      pid_t *children =
-             mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+             mmap(0, 4096, PROT_WRITE | PROT_READ, MAP_SHARED |

MAP_ANON, -1, 0);

lib/tests/igt_tests_common.h static inline void internal_assert_wexited(int

Quoted 8 lines
lib/tests/igt_fork.c +0 -0
      const int num_children = 4096 / sizeof(*children);
 
      igt_subtest_init(fake_argc, fake_argv);
lib/tests/igt_tests_common.h +0 -0
index 058f6265..e8183897 100644
@@ -48,8 +48,17 @@ static inline void internal_assert_wexited(int

wstatus, int exitcode)

Quoted 131 lines
lib/tests/igt_tests_common.h +9 -0
 static inline void internal_assert_wsignaled(int wstatus, int signal)
 {
+#ifdef __linux__
      internal_assert(WIFSIGNALED(wstatus) &&
                      WTERMSIG(wstatus) == signal);
+#elif defined(__FreeBSD__)
+     if (WIFSIGNALED(wstatus))
+             internal_assert(WTERMSIG(wstatus) == signal);
+     else if (WIFEXITED(wstatus))
+             internal_assert(WEXITSTATUS(wstatus) == signal + 128);
+     else
+             internal_assert(0);
+#endif
 }
 
 static inline void internal_assert_not_wsignaled(int wstatus)
runner/executor.c +6 -0
index 964d0063..c54072cf 100644
@@ -2,7 +2,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <glib.h>
+#ifdef __linux__
 #include <linux/watchdog.h>
+#endif
 #if HAVE_OPING
 #include <oping.h>
 #endif
@@ -33,6 +35,10 @@
 #define KMSG_HEADER "[IGT] "
 #define KMSG_WARN 4
 
+#ifdef __FreeBSD__
+#include <sys/watchdog.h>
+#endif
+
 static struct {
      int *fds;
      size_t num_dogs;
runner/job_list.c +5 -0
index 520a98da..6bfa7162 100644
@@ -1,7 +1,12 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <sys/wait.h>
+#include <limits.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
tests/i915/gem_close_race.c +2 -0
index 938fde8f..42fe1657 100644
@@ -61,7 +61,9 @@ static bool has_softpin;
 static uint64_t exec_addr;
 static uint64_t data_addr;
 
+#ifdef __linux__
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 static void selfcopy(int fd, uint32_t ctx, uint32_t handle, int loops)
 {
tests/i915/gem_mmap_gtt.c +7 -7
index e39b9047..683eaf16 100644
@@ -113,11 +113,11 @@ test_access(int fd)
      mmap_arg.handle = handle;
      do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
 
-     igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+     igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
                        MAP_SHARED, fd, mmap_arg.offset));
 
      /* Check that the same offset on the other fd doesn't work. */
-     igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+     igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
                        MAP_SHARED, fd2, mmap_arg.offset) == MAP_FAILED);
      igt_assert(errno == EACCES);
 
@@ -128,7 +128,7 @@ test_access(int fd)
 
      /* Recheck that it works after flink. */
      /* Check that the same offset on the other fd doesn't work. */
-     igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+     igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
                        MAP_SHARED, fd2, mmap_arg.offset));
 }
 
@@ -159,11 +159,11 @@ test_short(int fd)
      for (pages = 1; pages <= OBJECT_SIZE / PAGE_SIZE; pages <<= 1) {
              uint8_t *r, *w;
 
-             w = mmap64(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
+             w = mmap(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
                         MAP_SHARED, fd, mmap_arg.offset);
              igt_assert(w != MAP_FAILED);
 
-             r = mmap64(0, pages * PAGE_SIZE, PROT_READ,
+             r = mmap(0, pages * PAGE_SIZE, PROT_READ,
                         MAP_SHARED, fd, mmap_arg.offset);
              igt_assert(r != MAP_FAILED);
 
@@ -384,13 +384,13 @@ test_isolation(int i915)
 
      close(B);
 
-     ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+     ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
      igt_assert(ptr != MAP_FAILED);
      munmap(ptr, 4096);
 
      close(A);
 
-     ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+     ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
      igt_assert(ptr == MAP_FAILED);
 }
 

tests/i915/gem_mmap_gtt.c test_close_race(int i915) · line 403

Quoted 4 lines
tests/i915/gem_mmap_gtt.c +0 -1
@@ -400,7 +400,7 @@ test_close_race(int i915)
      const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
      _Atomic uint32_t *handles;
 
-     handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1,

0);

Quoted 14 lines
tests/i915/gem_mmap_gtt.c +2 -1
+     handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
      igt_assert(handles != MAP_FAILED);
 
      igt_fork(child, ncpus + 1) {
@@ -418,7 +418,7 @@ test_close_race(int i915)
                                &mmap_arg) != -1) {
                              void *ptr;
 
-                             ptr = mmap64(0, 4096,
+                             ptr = mmap(0, 4096,
                                           PROT_WRITE, MAP_SHARED, i915,
                                           mmap_arg.offset);
                              if (ptr != MAP_FAILED) {

tests/i915/gem_mmap_gtt.c test_flink_race(int i915) · line 447

Quoted 4 lines
tests/i915/gem_mmap_gtt.c +0 -1
@@ -444,7 +444,7 @@ test_flink_race(int i915)
      const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
      _Atomic uint32_t *handles;
 
-     handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1,

0);

tests/i915/gem_mmap_offset.c __mmap_offset(int i915, uint32_t handle, uint64_t

Quoted 27 lines
tests/i915/gem_mmap_gtt.c +3 -2
+     handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
      igt_assert(handles != MAP_FAILED);
 
      igt_fork(child, ncpus + 1) {
@@ -469,7 +469,7 @@ test_flink_race(int i915)
                                &mmap_arg) != -1) {
                              void *ptr;
 
-                             ptr = mmap64(0, 4096,
+                             ptr = mmap(0, 4096,
                                           PROT_WRITE, MAP_SHARED, fd,
                                           mmap_arg.offset);
                              if (ptr != MAP_FAILED) {
@@ -566,7 +566,7 @@ test_ptrace(int fd)
      for (int i = 0; i < sz / sizeof(long); i++) {
              long ret;
 
-             ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i);
+             ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i, NULL);
              igt_assert_eq_u64(ret, CC);
              cpy[i] = ret;
 
tests/i915/gem_mmap_offset.c +0 -0
index 5e6b19eb..0933ed94 100644
@@ -66,7 +66,7 @@ __mmap_offset(int i915, uint32_t handle, uint64_t

offset, uint64_t size,

tests/i915/gem_mmap_offset.c static void isolation(int i915) · line 217

Quoted 13 lines
tests/i915/gem_mmap_offset.c +1 -2
      if (mmap_offset_ioctl(i915, &arg))
              return NULL;
 
-     ptr = mmap64(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
+     ptr = mmap(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
      if (ptr == MAP_FAILED)
              ptr = NULL;
      else
@@ -214,12 +214,12 @@ static void isolation(int i915)
                       t->name, B, b, offset_b);
 
              errno = 0;
-             ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915,

offset_a);

tests/i915/gem_mmap_offset.c static void isolation(int i915)

Quoted 6 lines
tests/i915/gem_mmap_offset.c +1 -1
+             ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
              igt_assert(ptr == MAP_FAILED);
              igt_assert_eq(errno, EACCES);
 
              errno = 0;
-             ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915,

offset_b);

Quoted 21 lines
tests/i915/gem_mmap_offset.c +3 -2
+             ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
              igt_assert(ptr == MAP_FAILED);
              igt_assert_eq(errno, EACCES);
 
@@ -237,13 +237,13 @@ static void isolation(int i915)
 
              close(B);
 
-             ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+             ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
              igt_assert(ptr != MAP_FAILED);
              munmap(ptr, 4096);
 
              close(A);
 
-             ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+             ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
              igt_assert(ptr == MAP_FAILED);
      }
 }

tests/i915/gem_mmap_offset.c static void test_ptrace(int i915) · line 373

Quoted 4 lines
tests/i915/gem_mmap_offset.c +0 -1
@@ -370,7 +370,7 @@ static void test_ptrace(int i915)
                      for (int i = 0; i < SZ / sizeof(long); i++) {
                              long ret;
 
-                             ret = ptrace(PTRACE_PEEKDATA, pid, ptr +

i);

tests/i915/gem_mmap_offset.c static void test_ptrace(int i915) · line 373

Quoted 1 line
tests/i915/gem_mmap_offset.c +1 -0
+                             ret = ptrace(PTRACE_PEEKDATA, pid, ptr +

i, NULL);

Review

Quoted 22 lines
tests/i915/gem_mmap_offset.c +2 -2
                              igt_assert_eq_u64(ret, CC);
                              cpy[i] = ret;
 
@@ -401,7 +401,7 @@ static void close_race(int i915, int timeout)
      _Atomic uint32_t *handles;
      size_t len = ALIGN((ncpus + 1) * sizeof(uint32_t), 4096);
 
-     handles = mmap64(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+     handles = mmap(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
      igt_assert(handles != MAP_FAILED);
 
      igt_fork(child, ncpus + 1) {
@@ -420,7 +420,7 @@ static void close_race(int i915, int timeout)
                                &mmap_arg) != -1) {
                              void *ptr;
 
-                             ptr = mmap64(0, 4096,
+                             ptr = mmap(0, 4096,
                                           PROT_WRITE, MAP_SHARED, i915,
                                           mmap_arg.offset);
                              if (ptr != MAP_FAILED) {
(quoted diff) +0 -0

b/tests/i915/i915_module_load.c

Review

Quoted 14 lines

index 4c72157c..9bec4c18 100644

tests/i915/i915_module_load.c +2 -0
@@ -23,7 +23,9 @@
 #include "igt.h"
 #include <dirent.h>
 #include <sys/utsname.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#endif
 #include <signal.h>
 #include <libgen.h>
 #include <signal.h>
(quoted diff) +0 -0

b/tests/i915/i915_pm_backlight.c

Review

Quoted 43 lines

index cafae7f7..c520cf20 100644

tests/i915/i915_pm_backlight.c +4 -0
@@ -46,6 +46,10 @@ struct context {
 #define FADESTEPS 10
 #define FADESPEED 100 /* milliseconds between steps */
 
+#ifdef __FreeBSD__
+#include <libgen.h>
+#endif
+
 IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
 
 static int backlight_read(int *result, const char *fname)
tests/i915/i915_pm_rpm.c +8 -0
index e95875dc..761e76f9 100644
@@ -40,8 +40,10 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef __linux__
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
+#endif
 
 #include <drm.h>
 
@@ -54,6 +56,12 @@
 #include "igt_device.h"
 #include "igt_edid.h"
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#include <dev/iicbus/iic.h>
+#define      addr    slave
+#endif
+
 #define MSR_PC8_RES  0x630
 #define MSR_PC9_RES  0x631
 #define MSR_PC10_RES 0x632
(quoted diff) +0 -0

b/tests/kms_content_protection.c

Review

Quoted 29 lines

index 3041f1cd..e0e5af78 100644

tests/kms_content_protection.c +2 -0
@@ -24,7 +24,9 @@
 
 #include <poll.h>
 #include <fcntl.h>
+#ifdef __linux__
 #include <sys/epoll.h>
+#endif
 #include <sys/stat.h>
 #include <libudev.h>
 #include "igt.h"
tests/kms_flip.c +4 -0
index 0567edea..1127e418 100755
@@ -45,6 +45,10 @@
 #include "i915/gem_create.h"
 #include "igt_stats.h"
 
+#ifdef __FreeBSD__
+#include <sys/consio.h>
+#endif
+
 #define TEST_DPMS            (1 << 0)
 
 #define TEST_PAN             (1 << 3)
(quoted diff) +0 -0

b/tests/kms_sysfs_edid_timing.c

Quoted 49 lines

index 77521108..cd980c6a 100644

tests/kms_sysfs_edid_timing.c +4 -0
@@ -26,6 +26,10 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#ifdef __FreeBSD__
+#include <limits.h>
+#endif
+
 #define THRESHOLD_PER_CONNECTOR              150
 #define THRESHOLD_PER_CONNECTOR_MEAN 140
 #define THRESHOLD_ALL_CONNECTORS_MEAN        100
tests/tools_test.c +6 -2
index 237f0433..d0684d57 100644
@@ -28,7 +28,11 @@
 #include <fcntl.h>
 #include <libgen.h>
 #include <unistd.h>
+#ifdef __linux__
 #include <linux/limits.h>
+#elif defined(__FreeBSD__)
+#include <limits.h>
+#endif
 
 #define TOOLS "../tools/"
 
@@ -65,7 +69,7 @@ static bool chdir_to_tools_dir(void)
      char path[PATH_MAX];
      char *cwd;
 
-     cwd = get_current_dir_name();
+     cwd = getcwd(NULL, 0);
      igt_info("Current working directory: %s\n", cwd);
      free(cwd);
 
@@ -83,7 +87,7 @@ static bool chdir_to_tools_dir(void)
              chdir(dirname(path));
      }
 
-     cwd = get_current_dir_name();
+     cwd = getcwd(NULL, 0);
      igt_info("Current working directory: %s\n", cwd);
      free(cwd);
 

tests/tools_test.c igt_main · line 105

Quoted 3 lines
tests/tools_test.c +0 -0
@@ -99,7 +103,7 @@ igt_main
 
              igt_require_f(chdir_to_tools_dir(),
                            "Unable to determine the tools directory,

expecting them in $cwd/" TOOLS " or $path/" TOOLS "\n");

Review

Quoted 6 lines
tests/tools_test.c +1 -1
-             path = get_current_dir_name();
+             path = getcwd(NULL, 0);
              igt_info("Using tools from %s\n", path);
              free(path);
      }
(quoted diff) +0 -0

b/tools/i915-perf/i915_perf_control.c

tools/i915-perf/i915_perf_control.c main(int argc, char *argv[]) · line 106

Quoted 10 lines

index be5996c0..f7db2f5c 100644

tools/i915-perf/i915_perf_control.c +1 -1
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
 
                      fwrite(data, total_len, 1, command_fifo_file);
              } else {
-                     char *cwd = get_current_dir_name();
+                     char *cwd = getcwd(NULL, 0);
                      uint32_t path_len = strlen(cwd) + 1 +

strlen(dump_file) + 1;

tools/i915-perf/i915_perf_control.c main(int argc, char *argv[]) · line 107

Quoted 1 line
tools/i915-perf/i915_perf_control.c +0 -0
                      uint32_t total_len = sizeof(struct

recorder_command_base) + path_len;

Quoted 19 lines
tools/i915-perf/i915_perf_control.c +0 -0
                      struct {
tools/intel_gvtg_test.c +4 -1
index ad5ee6a6..3e53c6d9 100644
@@ -55,6 +55,10 @@
 #include <limits.h>
 #include <dirent.h>
 
+#ifdef __FreeBSD__
+#include <sys/wait.h>
+#endif
+
 #define RANDOM(x) (rand() % x)
 
 
--

2.37.3