All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support
@ 2019-12-11  0:52 D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 01/29] Remove unused includes D Scott Phillips
                   ` (30 more replies)
  0 siblings, 31 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

FreeBSD maintains a port of drm and a few drivers: amdgpu, i915,
radeon, vboxvideo, vmwgfx:

https://github.com/FreeBSDDesktop/kms-drm/

Recently I backported some drm & i915 security patches into our
tree and was lacking a way to verify the backports. Here is my
attempt at adding FreeBSD support to igt.

I've tried to order the series so that what I believe will be less
controversial comes nearer the start. I've also tried to err on
the side of too many small patches, so I'm happy to squash things
where that seems more appropriate to people.

The "null" implementations toward the end are probably more like
RFC ideas. I'm willing to take other approaches there if anyone
has a better idea for how to handle large sections of code that
are more linux specific. Cheers,

Scott


D Scott Phillips (30):
  Remove unused includes
  lib/igt_chipset: Add missing libdrm dependency
  lib/igt_core: update longjmp buffers to type sigjmp_buf
  Include <sys/wait.h>, <limits.h>, and <signal.h> where appropriate
  Use /bin/sh for shell scripts
  tools/intel_gpu_top: Use POSIX signal handler type definition
  kms_atomic: change `PAGE_SIZE` to `page_size`
  lib: remove open-coded card index fetching
  igt: replace mmap64() with mmap()
  drm-uapi: patch sync_file.h to depend on drm.h
  i915/pm_backlight: use POSIX basename
  Include linux specific headers only on linux
  lib/igt_core: skip oom_adjustments on non-linux platforms
  i915/gem: Omit linux-specific madvise, mmap, and sched flags on
    non-linux
  lib/igt_aux: add null implementation
  lib/igt_kmod: add null implementation
  lib/igt_perf: add null implementation
  runner: Add support for non-linux operating systems
  Use ETIMEDOUT in place of ETIME on FreeBSD
  ilog2: Use libc provided fls() on FreeBSD
  lib: undefine FreeBSD libc's ALIGN macro
  lib: Add FreeBSD-specific pthread logic
  lib/igt_kms: Add FreeBSD support
  lib/ioctl_wrappers: Support FreeBSD in igt_require_gem
  lib/intel_os: Implement get_avail_ram and get_total_swap for FreeBSD
  lib/igt_device: Implement get_card_index for FreeBSD
  lib/igt_debugfs: Implement mount() for FreeBSD
  build: Add support for building on non-linux
  fixup! igt: replace mmap64() with mmap()
  lib/igt_device_scan: add null implementation

 benchmarks/gem_syslatency.c          |   2 -
 benchmarks/ilog2.h                   |   2 +
 benchmarks/meson.build               |   7 +-
 include/drm-uapi/sync_file.h         |   3 +-
 lib/drmtest.h                        |   4 +
 lib/i915/gem_mman.c                  |   2 +-
 lib/igt.h                            |   4 +
 lib/igt_aux.h                        |   7 ++
 lib/igt_aux_null.c                   | 139 +++++++++++++++++++++++++++
 lib/igt_core.c                       |   7 +-
 lib/igt_core.h                       |   4 +-
 lib/igt_debugfs.c                    |  31 +++---
 lib/igt_device.c                     |  22 +++++
 lib/igt_device_scan_null.c           |  67 +++++++++++++
 lib/igt_eld.c                        |   1 +
 lib/igt_kmod.h                       |   2 +
 lib/igt_kmod_null.c                  |  84 ++++++++++++++++
 lib/igt_kms.c                        |   9 ++
 lib/igt_perf.h                       |  23 +++++
 lib/igt_perf_null.c                  |  45 +++++++++
 lib/igt_sysfs.c                      |  12 ++-
 lib/igt_vgem.c                       |   2 +-
 lib/intel_os.c                       |  16 +++
 lib/ioctl_wrappers.c                 |   6 +-
 lib/meson.build                      |  31 +++++-
 lib/sw_sync.c                        |   1 +
 lib/tests/igt_describe.c             |   1 +
 lib/tests/igt_dynamic_subtests.c     |   1 +
 lib/tests/igt_exit_handler.c         |   1 +
 lib/tests/igt_fork.c                 |   1 +
 lib/tests/igt_invalid_subtest_name.c |   1 +
 lib/tests/igt_no_exit.c              |   1 +
 lib/tests/igt_tests_common.h         |   1 +
 man/rst2man.sh                       |   2 +-
 meson.build                          |  10 +-
 runner/executor.c                    |  28 +++++-
 runner/job_list.c                    |   3 +
 tests/generate_testlist.sh           |   6 +-
 tests/i915/gem_close_race.c          |   2 +
 tests/i915/gem_concurrent_all.c      |   7 +-
 tests/i915/gem_ctx_persistence.c     |   2 +-
 tests/i915/gem_exec_fence.c          |   1 +
 tests/i915/gem_exec_latency.c        |   5 +-
 tests/i915/gem_mmap_gtt.c            |  22 ++---
 tests/i915/gem_mmap_offset.c         |  18 ++--
 tests/i915/gem_reloc_overflow.c      |   1 -
 tests/i915/gem_shrink.c              |   5 +-
 tests/i915/i915_pm_backlight.c       |   1 +
 tests/kms_atomic.c                   |  14 +--
 tests/meson.build                    |  30 ++++--
 tests/perf.c                         |   1 +
 tools/aubdump.c                      |   2 +
 tools/intel_gpu_top.c                |   2 +-
 tools/intel_gvtg_test.c              |   1 +
 tools/meson.build                    |  12 ++-
 55 files changed, 624 insertions(+), 91 deletions(-)
 create mode 100644 lib/igt_aux_null.c
 create mode 100644 lib/igt_device_scan_null.c
 create mode 100644 lib/igt_kmod_null.c
 create mode 100644 lib/igt_perf_null.c

-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 01/29] Remove unused includes
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 02/29] lib/igt_chipset: Add missing libdrm dependency D Scott Phillips
                   ` (29 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

<linux/unistd.h> and <malloc.h> are not needed and are not
available on other platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 benchmarks/gem_syslatency.c     | 2 --
 tests/i915/gem_reloc_overflow.c | 1 -
 2 files changed, 3 deletions(-)

diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 40230630..30722d85 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -42,8 +42,6 @@
 #include <limits.h>
 #include "drm.h"
 
-#include <linux/unistd.h>
-
 #define sigev_notify_thread_id _sigev_un._tid
 
 static volatile int done;
diff --git a/tests/i915/gem_reloc_overflow.c b/tests/i915/gem_reloc_overflow.c
index c9d1f207..75af2659 100644
--- a/tests/i915/gem_reloc_overflow.c
+++ b/tests/i915/gem_reloc_overflow.c
@@ -37,7 +37,6 @@
 #include <inttypes.h>
 #include <errno.h>
 #include <unistd.h>
-#include <malloc.h>
 #include <limits.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 02/29] lib/igt_chipset: Add missing libdrm dependency
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 01/29] Remove unused includes D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 03/29] lib/igt_core: update longjmp buffers to type sigjmp_buf D Scott Phillips
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

Without this the build fails because it can not find xf86drm.h.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/meson.build b/lib/meson.build
index 57eb7d93..25ea62d5 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -154,6 +154,7 @@ igt_deps = [ lib_igt ] + lib_deps
 lin_igt_chipset_build = static_library('igt_chipset',
                                        ['intel_chipset.c',
                                         'intel_device_info.c'],
+                                       dependencies : libdrm,
                                        include_directories : inc)
 
 lib_igt_chipset = declare_dependency(link_with : lin_igt_chipset_build,
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 03/29] lib/igt_core: update longjmp buffers to type sigjmp_buf
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 01/29] Remove unused includes D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 02/29] lib/igt_chipset: Add missing libdrm dependency D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 04/29] Include <sys/wait.h>, <limits.h>, and <signal.h> where appropriate D Scott Phillips
                   ` (27 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

sigsetjmp/siglongjmp operate on a different type from
setjmp/longjmp, sigjmp_buf vs jmp_buf. On glibc these happen to be
the same type, but on other platforms they may be different.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_core.c | 2 +-
 lib/igt_core.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index c705be1e..09d8c159 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1328,7 +1328,7 @@ static void exit_subtest(const char *result)
 	const char *subtest_text = in_dynamic_subtest ? "Dynamic subtest" : "Subtest";
 	const char **subtest_name = in_dynamic_subtest ? &in_dynamic_subtest : &in_subtest;
 	struct timespec *thentime = in_dynamic_subtest ? &dynamic_subtest_time : &subtest_time;
-	jmp_buf *jmptarget = in_dynamic_subtest ? &igt_dynamic_jmpbuf : &igt_subtest_jmpbuf;
+	sigjmp_buf *jmptarget = in_dynamic_subtest ? &igt_dynamic_jmpbuf : &igt_subtest_jmpbuf;
 
 	igt_gettime(&now);
 
diff --git a/lib/igt_core.h b/lib/igt_core.h
index c17a7ba8..e99b782f 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -145,8 +145,8 @@ void __igt_fixture_end(void) __attribute__((noreturn));
 			 __igt_fixture_complete())
 
 /* subtest infrastructure */
-jmp_buf igt_subtest_jmpbuf;
-jmp_buf igt_dynamic_jmpbuf;
+sigjmp_buf igt_subtest_jmpbuf;
+sigjmp_buf igt_dynamic_jmpbuf;
 typedef int (*igt_opt_handler_t)(int opt, int opt_index, void *data);
 #define IGT_OPT_HANDLER_SUCCESS 0
 #define IGT_OPT_HANDLER_ERROR -2
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 04/29] Include <sys/wait.h>, <limits.h>, and <signal.h> where appropriate
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (2 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 03/29] lib/igt_core: update longjmp buffers to type sigjmp_buf D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 05/29] Use /bin/sh for shell scripts D Scott Phillips
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

On FreeBSD, sys/wait.h is needed for WIFEXITED and friends,
limits.h is needed for PATH_MAX, and signal.h is needed for
SIGTERM and friends.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_eld.c                        | 1 +
 lib/tests/igt_describe.c             | 1 +
 lib/tests/igt_dynamic_subtests.c     | 1 +
 lib/tests/igt_exit_handler.c         | 1 +
 lib/tests/igt_fork.c                 | 1 +
 lib/tests/igt_invalid_subtest_name.c | 1 +
 lib/tests/igt_no_exit.c              | 1 +
 lib/tests/igt_tests_common.h         | 1 +
 runner/job_list.c                    | 1 +
 tests/i915/gem_exec_fence.c          | 1 +
 tests/perf.c                         | 1 +
 tools/intel_gvtg_test.c              | 1 +
 12 files changed, 12 insertions(+)

diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index ef6625df..d3144851 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -28,6 +28,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <glob.h>
+#include <limits.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/lib/tests/igt_describe.c b/lib/tests/igt_describe.c
index 6f3a4319..d1103954 100644
--- a/lib/tests/igt_describe.c
+++ b/lib/tests/igt_describe.c
@@ -22,6 +22,7 @@
  */
 
 #include <sys/wait.h>
+#include <signal.h>
 #include <string.h>
 #include <stdlib.h>
 
diff --git a/lib/tests/igt_dynamic_subtests.c b/lib/tests/igt_dynamic_subtests.c
index 606104c5..8740827e 100644
--- a/lib/tests/igt_dynamic_subtests.c
+++ b/lib/tests/igt_dynamic_subtests.c
@@ -23,6 +23,7 @@
 
 #include <errno.h>
 #include <sys/wait.h>
+#include <signal.h>
 
 #include "igt_core.h"
 #include "drmtest.h"
diff --git a/lib/tests/igt_exit_handler.c b/lib/tests/igt_exit_handler.c
index 892a7f14..c1219e6b 100644
--- a/lib/tests/igt_exit_handler.c
+++ b/lib/tests/igt_exit_handler.c
@@ -25,6 +25,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <signal.h>
 #include "igt_core.h"
 #include "drmtest.h"
 
diff --git a/lib/tests/igt_fork.c b/lib/tests/igt_fork.c
index 7e8b4f9b..a25f2edc 100644
--- a/lib/tests/igt_fork.c
+++ b/lib/tests/igt_fork.c
@@ -23,6 +23,7 @@
  */
 
 #include <errno.h>
+#include <signal.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/lib/tests/igt_invalid_subtest_name.c b/lib/tests/igt_invalid_subtest_name.c
index 92e767ab..ed78a90c 100644
--- a/lib/tests/igt_invalid_subtest_name.c
+++ b/lib/tests/igt_invalid_subtest_name.c
@@ -23,6 +23,7 @@
 
 #include <errno.h>
 #include <sys/wait.h>
+#include <signal.h>
 
 #include "igt_core.h"
 #include "drmtest.h"
diff --git a/lib/tests/igt_no_exit.c b/lib/tests/igt_no_exit.c
index 82f00b52..58131828 100644
--- a/lib/tests/igt_no_exit.c
+++ b/lib/tests/igt_no_exit.c
@@ -26,6 +26,7 @@
  */
 
 #include <sys/wait.h>
+#include <signal.h>
 
 #include "drmtest.h"
 
diff --git a/lib/tests/igt_tests_common.h b/lib/tests/igt_tests_common.h
index e66ee37c..9b98e256 100644
--- a/lib/tests/igt_tests_common.h
+++ b/lib/tests/igt_tests_common.h
@@ -25,6 +25,7 @@
 #ifndef IGT_LIB_TESTS_COMMON_H
 #define IGT_LIB_TESTS_COMMON_H
 
+#include <sys/wait.h>
 #include <assert.h>
 
 /*
diff --git a/runner/job_list.c b/runner/job_list.c
index 93cede75..bc10a1bf 100644
--- a/runner/job_list.c
+++ b/runner/job_list.c
@@ -7,6 +7,7 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <unistd.h>
 
 #include "job_list.h"
diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c
index 0fc7301a..dc32967f 100644
--- a/tests/i915/gem_exec_fence.c
+++ b/tests/i915/gem_exec_fence.c
@@ -31,6 +31,7 @@
 #include <sys/ioctl.h>
 #include <sys/poll.h>
 #include <sys/signal.h>
+#include <signal.h>
 
 IGT_TEST_DESCRIPTION("Check that execbuf waits for explicit fences");
 
diff --git a/tests/perf.c b/tests/perf.c
index f5dd6051..e6b77b0d 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -33,6 +33,7 @@
 #include <sys/time.h>
 #include <sys/times.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <dirent.h>
 #include <time.h>
 #include <poll.h>
diff --git a/tools/intel_gvtg_test.c b/tools/intel_gvtg_test.c
index ad5ee6a6..ec185885 100644
--- a/tools/intel_gvtg_test.c
+++ b/tools/intel_gvtg_test.c
@@ -44,6 +44,7 @@
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/wait.h>
 #include <string.h>
 #include <stdlib.h>
 #include <signal.h>
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 05/29] Use /bin/sh for shell scripts
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (3 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 04/29] Include <sys/wait.h>, <limits.h>, and <signal.h> where appropriate D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 06/29] tools/intel_gpu_top: Use POSIX signal handler type definition D Scott Phillips
                   ` (25 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

These scripts don't use an bash-specific functionality, and bsd is
not available by default on FreeBSD.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 man/rst2man.sh             | 2 +-
 tests/generate_testlist.sh | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/man/rst2man.sh b/man/rst2man.sh
index 49a98fc5..b7f28991 100755
--- a/man/rst2man.sh
+++ b/man/rst2man.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 rst2man=$1
 input=$2
diff --git a/tests/generate_testlist.sh b/tests/generate_testlist.sh
index 87637fc8..d506b149 100755
--- a/tests/generate_testlist.sh
+++ b/tests/generate_testlist.sh
@@ -1,16 +1,16 @@
-#!/bin/bash
+#!/bin/sh
 
 OUTPUT=$1
 shift
 
 echo TESTLIST > $OUTPUT
 
-if [[ $# -gt 0 ]] ; then
+if [ $# -gt 0 ] ; then
 	echo -n $1 >> $OUTPUT
 	shift
 fi
 
-while [[ $# -gt 0 ]] ; do
+while [ $# -gt 0 ] ; do
 	echo -n " $1" >> $OUTPUT
 	shift
 done
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 06/29] tools/intel_gpu_top: Use POSIX signal handler type definition
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (4 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 05/29] Use /bin/sh for shell scripts D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 07/29] kms_atomic: change `PAGE_SIZE` to `page_size` D Scott Phillips
                   ` (24 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

The type sighandler_t is a GNU extension which isn't available on
FreeBSD, where it instead follows the POSIX specification of a raw
function pointer type.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 tools/intel_gpu_top.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index cc8db7c5..2ea484cf 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -1299,7 +1299,7 @@ int main(int argc, char **argv)
 	}
 
 	if (output_mode != INTERACTIVE) {
-		sighandler_t sig = signal(SIGINT, sigint_handler);
+		void (* sig)(int) = signal(SIGINT, sigint_handler);
 
 		if (sig == SIG_ERR)
 			fprintf(stderr, "Failed to install signal handler!\n");
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 07/29] kms_atomic: change `PAGE_SIZE` to `page_size`
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (5 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 06/29] tools/intel_gpu_top: Use POSIX signal handler type definition D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 08/29] lib: remove open-coded card index fetching D Scott Phillips
                   ` (23 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

POSIX limit.h provides a PAGE_SIZE constant, so change the
variable name here to not collide with it.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 tests/kms_atomic.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 8462d128..ade777e3 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -683,7 +683,7 @@ static void crtc_invalid_params_fence(igt_pipe_t *pipe,
 {
 	int timeline, fence_fd;
 	void *map;
-	const ptrdiff_t PAGE_SIZE = sysconf(_SC_PAGE_SIZE);
+	const ptrdiff_t page_size = sysconf(_SC_PAGE_SIZE);
 	uint64_t old_mode_id = pipe->values[IGT_CRTC_MODE_ID];
 
 	igt_require_sw_sync();
@@ -691,28 +691,28 @@ static void crtc_invalid_params_fence(igt_pipe_t *pipe,
 	timeline = sw_sync_timeline_create();
 
 	/* invalid out_fence_ptr */
-	map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+	map = mmap(NULL, page_size, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	igt_assert(map != MAP_FAILED);
 
 	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
 	crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT);
-	munmap(map, PAGE_SIZE);
+	munmap(map, page_size);
 
 	/* invalid out_fence_ptr */
-	map = mmap(NULL, PAGE_SIZE, PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+	map = mmap(NULL, page_size, PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	igt_assert(map != MAP_FAILED);
 
 	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
 	crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT);
-	munmap(map, PAGE_SIZE);
+	munmap(map, page_size);
 
 	/* invalid out_fence_ptr */
-	map = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+	map = mmap(NULL, page_size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	igt_assert(map != MAP_FAILED);
 
 	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
 	crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT);
-	munmap(map, PAGE_SIZE);
+	munmap(map, page_size);
 
 	/* valid in fence but not allowed prop on crtc */
 	fence_fd = sw_sync_timeline_create_fence(timeline, 1);
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 08/29] lib: remove open-coded card index fetching
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (6 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 07/29] kms_atomic: change `PAGE_SIZE` to `page_size` D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 09/29] igt: replace mmap64() with mmap() D Scott Phillips
                   ` (22 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

Replace open-coded card index fetching via stat with
igt_device_get_card_index() calls.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_debugfs.c | 17 ++++-------------
 lib/igt_sysfs.c   | 10 +++++-----
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 676884c8..34b2e4ee 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -41,6 +41,7 @@
 #include "igt_aux.h"
 #include "igt_kms.h"
 #include "igt_debugfs.h"
+#include "igt_device.h"
 #include "igt_sysfs.h"
 
 /**
@@ -164,20 +165,10 @@ char *igt_debugfs_path(int device, char *path, int pathlen)
 	debugfs_root = igt_debugfs_mount();
 	igt_assert(debugfs_root);
 
-	memset(&st, 0, sizeof(st));
-	if (device != -1) { /* if no fd, we presume we want dri/0 */
-		if (fstat(device, &st)) {
-			igt_debug("Couldn't stat FD for DRM device: %m\n");
-			return NULL;
-		}
-
-		if (!S_ISCHR(st.st_mode)) {
-			igt_debug("FD for DRM device not a char device!\n");
-			return NULL;
-		}
-	}
+	idx = 0;
+	if (device >= 0)
+		idx = igt_device_get_card_index(device);
 
-	idx = minor(st.st_rdev);
 	snprintf(path, pathlen, "%s/dri/%d/name", debugfs_root, idx);
 	if (stat(path, &st))
 		return NULL;
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 7528c3bd..61293a4e 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -43,6 +43,8 @@
 #include "igt_sysfs.h"
 #include "igt_device.h"
 
+#define DRM_MAJOR 226
+
 /**
  * SECTION:igt_sysfs
  * @short_description: Support code for sysfs features
@@ -98,16 +100,14 @@ static int writeN(int fd, const char *buf, int len)
  */
 char *igt_sysfs_path(int device, char *path, int pathlen)
 {
-	struct stat st;
+	int idx;
 
 	if (device < 0)
 		return NULL;
 
-	if (fstat(device, &st) || !S_ISCHR(st.st_mode))
-		return NULL;
+	idx = igt_device_get_card_index(device);
 
-	snprintf(path, pathlen, "/sys/dev/char/%d:%d",
-		 major(st.st_rdev), minor(st.st_rdev));
+	snprintf(path, pathlen, "/sys/dev/char/%d:%d", DRM_MAJOR, idx);
 
 	if (access(path, F_OK))
 		return NULL;
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 09/29] igt: replace mmap64() with mmap()
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (7 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 08/29] lib: remove open-coded card index fetching D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h D Scott Phillips
                   ` (21 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

mmap64 is the variant syscall with 64-bit off_t. On 64-bit
platforms mmap == mmap64. On 32-bit platforms mmap == mmap64 when
_FILE_OFFSET_BITS=64, which we get with AC_SYS_LARGEFILE in
autoconf and by default with meson. Other platforms don't
necessarily have an mmap64 syscall or function.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/i915/gem_mman.c          |  2 +-
 lib/igt_vgem.c               |  2 +-
 tests/i915/gem_mmap_gtt.c    | 22 +++++++++++-----------
 tests/i915/gem_mmap_offset.c | 18 +++++++++---------
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
index 6256627b..056f9382 100644
--- a/lib/i915/gem_mman.c
+++ b/lib/i915/gem_mman.c
@@ -62,7 +62,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
diff --git a/lib/igt_vgem.c b/lib/igt_vgem.c
index 7f933b23..468383c7 100644
--- a/lib/igt_vgem.c
+++ b/lib/igt_vgem.c
@@ -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;
 
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index af87ebc3..cd6ab489 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -103,11 +103,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);
 
@@ -118,7 +118,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));
 }
 
@@ -149,11 +149,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);
 
@@ -371,13 +371,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);
 }
 
@@ -387,7 +387,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) {
@@ -405,7 +405,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) {
@@ -431,7 +431,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) {
@@ -456,7 +456,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) {
diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
index 95e1e3e6..277ffd83 100644
--- a/tests/i915/gem_mmap_offset.c
+++ b/tests/i915/gem_mmap_offset.c
@@ -76,7 +76,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
@@ -224,34 +224,34 @@ 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);
 
 		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, B, offset_a);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, B, offset_a);
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
 		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_b);
+		ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_b);
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
 		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);
 	}
 }
@@ -286,7 +286,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) {
@@ -305,7 +305,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) {
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (8 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 09/29] igt: replace mmap64() with mmap() D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-12 11:01   ` Jani Nikula
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename D Scott Phillips
                   ` (20 subsequent siblings)
  30 siblings, 1 reply; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

linux/sync_file.h isn't strictly part of the drm uapi and so
doesn't include drm.h. drm.h contains some compatibility #defines
for non-Linux platforms for things like __u32 which synf_file
needs.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 include/drm-uapi/sync_file.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/drm-uapi/sync_file.h b/include/drm-uapi/sync_file.h
index b4f2db00..4713b5b9 100644
--- a/include/drm-uapi/sync_file.h
+++ b/include/drm-uapi/sync_file.h
@@ -12,8 +12,7 @@
 #ifndef _LINUX_SYNC_H
 #define _LINUX_SYNC_H
 
-#include <linux/ioctl.h>
-#include <linux/types.h>
+#include "drm.h"
 
 /**
  * struct sync_merge_data - data passed to merge ioctl
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (9 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-16 13:31   ` Petri Latvala
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 12/29] Include Linux specific headers only on Linux D Scott Phillips
                   ` (19 subsequent siblings)
  30 siblings, 1 reply; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

We can get POSIX basename by including libgen.h. It behaves
slightly differently from GNU basename, like possibly modifying
the passed in string. This is OK in this usage, and POSIX basename
is available on other platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 tests/i915/i915_pm_backlight.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
index 83b1ed68..2f65156f 100644
--- a/tests/i915/i915_pm_backlight.c
+++ b/tests/i915/i915_pm_backlight.c
@@ -30,6 +30,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <libgen.h>
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 12/29] Include Linux specific headers only on Linux
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (10 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 13/29] lib/igt_core: skip oom_adjustments on non-Linux platforms D Scott Phillips
                   ` (18 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

Include Linux specific headers like sys/sysmacros.h or
linux/limits.h with a defined(__linux__) guard, for compatibility
with other platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_debugfs.c | 2 ++
 lib/igt_device.c  | 2 ++
 lib/igt_sysfs.c   | 2 ++
 runner/job_list.c | 2 ++
 tools/aubdump.c   | 2 ++
 5 files changed, 10 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 34b2e4ee..5a9c8c3c 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -25,7 +25,9 @@
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
+#if defined(__linux__)
 #include <sys/sysmacros.h>
+#endif
 #include <dirent.h>
 #include <errno.h>
 #include <stdio.h>
diff --git a/lib/igt_device.c b/lib/igt_device.c
index 07bb0a0d..01a9eff4 100644
--- a/lib/igt_device.c
+++ b/lib/igt_device.c
@@ -25,7 +25,9 @@
 #include <fcntl.h>
 
 #include <sys/stat.h>
+#if defined(__linux__)
 #include <sys/sysmacros.h>
+#endif
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 61293a4e..5b3f817c 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -24,7 +24,9 @@
 
 #include <inttypes.h>
 #include <sys/stat.h>
+#if defined(__linux__)
 #include <sys/sysmacros.h>
+#endif
 #include <sys/mount.h>
 #include <errno.h>
 #include <stdarg.h>
diff --git a/runner/job_list.c b/runner/job_list.c
index bc10a1bf..8014a58c 100644
--- a/runner/job_list.c
+++ b/runner/job_list.c
@@ -1,7 +1,9 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#if defined(__linux__)
 #include <linux/limits.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 00e19712..25c28e62 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -30,7 +30,9 @@
 #include <stdarg.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#if defined(__linux__)
 #include <sys/sysmacros.h>
+#endif
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 13/29] lib/igt_core: skip oom_adjustments on non-Linux platforms
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (11 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 12/29] Include Linux specific headers only on Linux D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 14/29] i915/gem: Omit Linux-specific madvise, mmap, and sched flags on non-Linux D Scott Phillips
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

oom_adjustments are available only on Linux. Omit the body of
oom_adjust_for_doom on other platforms and just accept whatever
default out-of-memory handling we get.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 09d8c159..8df89905 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -672,6 +672,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 
 static void oom_adjust_for_doom(void)
 {
+#if defined(__linux__)
 	int fd;
 	const char always_kill[] = "1000";
 
@@ -679,7 +680,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
 }
 
 /**
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 14/29] i915/gem: Omit Linux-specific madvise, mmap, and sched flags on non-Linux
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (12 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 13/29] lib/igt_core: skip oom_adjustments on non-Linux platforms D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 15/29] lib/igt_aux: add null implementation D Scott Phillips
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

These various flags are Linux specific and don't have cross
platform equivalents. Accept the different behavior differences on
other platforms for now.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 tests/i915/gem_concurrent_all.c | 7 +++++--
 tests/i915/gem_exec_latency.c   | 5 ++++-
 tests/i915/gem_shrink.c         | 5 ++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/tests/i915/gem_concurrent_all.c b/tests/i915/gem_concurrent_all.c
index 6486bebf..bee18637 100644
--- a/tests/i915/gem_concurrent_all.c
+++ b/tests/i915/gem_concurrent_all.c
@@ -1876,8 +1876,11 @@ igt_main
 						pin_sz *= 1024 * 1024;
 
 						if (posix_memalign(&pinned, 4096, pin_sz) ||
-						    mlock(pinned, pin_sz) ||
-						    madvise(pinned, pin_sz, MADV_DONTFORK)) {
+						    mlock(pinned, pin_sz)
+#if defined(__linux__)
+						    || madvise(pinned, pin_sz, MADV_DONTFORK)
+#endif
+						) {
 							free(pinned);
 							pinned = NULL;
 						}
diff --git a/tests/i915/gem_exec_latency.c b/tests/i915/gem_exec_latency.c
index 3d99182a..111d71bc 100644
--- a/tests/i915/gem_exec_latency.c
+++ b/tests/i915/gem_exec_latency.c
@@ -509,7 +509,10 @@ rthog_latency_on_ring(int fd, unsigned int engine, const char *name, unsigned in
 				{ .sched_priority = 99 };
 
 				ret = sched_setscheduler(0,
-							 SCHED_FIFO | SCHED_RESET_ON_FORK,
+#if defined(__linux__)
+							 SCHED_RESET_ON_FORK |
+#endif
+							 SCHED_FIFO,
 							 &rt);
 				if (ret) {
 					igt_warn("Failed to set scheduling policy!\n");
diff --git a/tests/i915/gem_shrink.c b/tests/i915/gem_shrink.c
index 11aa9efc..ff4e3f39 100644
--- a/tests/i915/gem_shrink.c
+++ b/tests/i915/gem_shrink.c
@@ -272,7 +272,10 @@ static void leak(int fd, uint64_t alloc)
 	char *ptr;
 
 	ptr = mmap(NULL, alloc, PROT_READ | PROT_WRITE,
-		   MAP_ANON | MAP_PRIVATE | MAP_POPULATE,
+#if defined(__linux__)
+		   MAP_POPULATE |
+#endif
+		   MAP_ANON | MAP_PRIVATE,
 		   -1, 0);
 	if (ptr != (char *)-1)
 		return;
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 15/29] lib/igt_aux: add null implementation
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (13 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 14/29] i915/gem: Omit Linux-specific madvise, mmap, and sched flags on non-Linux D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 16/29] lib/igt_kmod: " D Scott Phillips
                   ` (15 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

igt_aux depends on Linux specific functionality like udev, sysfs,
and others. Add a do-nothing implementation of the same API for
inclusion on other platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_aux_null.c | 139 +++++++++++++++++++++++++++++++++++++++++++++
 lib/meson.build    |  11 +++-
 2 files changed, 149 insertions(+), 1 deletion(-)
 create mode 100644 lib/igt_aux_null.c

diff --git a/lib/igt_aux_null.c b/lib/igt_aux_null.c
new file mode 100644
index 00000000..b83217e4
--- /dev/null
+++ b/lib/igt_aux_null.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright © 2019 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.
+ *
+ */
+
+#include "igt_aux.h"
+
+void igt_fork_signal_helper(void) {
+}
+
+void igt_stop_signal_helper(void) {
+}
+
+void igt_suspend_signal_helper(void) {
+}
+
+void igt_resume_signal_helper(void) {
+}
+
+void igt_fork_shrink_helper(int fd) {
+}
+
+void igt_stop_shrink_helper(void) {
+}
+
+void igt_fork_hang_detector(int fd) {
+}
+
+void igt_stop_hang_detector(void) {
+}
+
+bool __igt_sigiter_continue(struct __igt_sigiter *iter, bool interrupt) {
+	return false;
+}
+
+void igt_exchange_int(void *array, unsigned i, unsigned j) {
+	igt_swap(((int *)array)[i], ((int *)array)[j]);
+}
+
+void igt_exchange_int64(void *array, unsigned i, unsigned j) {
+	igt_swap(((int64_t *)array)[i], ((int64_t *)array)[j]);
+}
+
+void igt_permute_array(void *array, unsigned size,
+			   void (*exchange_func)(void *array,
+						 unsigned i,
+						 unsigned j)) {
+}
+
+void igt_progress(const char *header, uint64_t i, uint64_t total) {
+}
+
+void igt_print_activity(void) {
+}
+
+bool igt_check_boolean_env_var(const char *env_var, bool default_value) {
+	return false;
+}
+
+bool igt_aub_dump_enabled(void) {
+	return false;
+}
+
+void igt_system_suspend_autoresume(enum igt_suspend_state state,
+				   enum igt_suspend_test test) {
+}
+
+void igt_set_autoresume_delay(int delay_secs) {
+}
+
+int igt_get_autoresume_delay(enum igt_suspend_state state) {
+	return 1;
+}
+
+void igt_drop_root(void) {
+}
+
+void igt_debug_wait_for_keypress(const char *var) {
+}
+
+void igt_debug_manual_check(const char *var, const char *expected) {
+}
+
+void igt_lock_mem(size_t size) {
+}
+
+void igt_unlock_mem(void) {
+}
+
+void igt_start_siglatency(int sig) {
+}
+
+double igt_stop_siglatency(struct igt_mean *result) {
+	return 1.0;
+}
+
+bool igt_allow_unlimited_files(void) {
+	return true;
+}
+
+void igt_set_module_param(const char *name, const char *val) {
+}
+
+void igt_set_module_param_int(const char *name, int val) {
+}
+
+int igt_is_process_running(const char *comm) {
+	return 0;
+}
+
+int igt_terminate_process(int sig, const char *comm) {
+	return 0;
+}
+
+void igt_lsof(const char *dpath) {
+}
+
+uint64_t vfs_file_max(void) {
+	return 1;
+}
diff --git a/lib/meson.build b/lib/meson.build
index 25ea62d5..6a56fff0 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -11,7 +11,6 @@ lib_sources = [
 	'igt_debugfs.c',
 	'igt_device.c',
 	'igt_device_scan.c',
-	'igt_aux.c',
 	'igt_gt.c',
 	'igt_halffloat.c',
 	'igt_matrix.c',
@@ -67,6 +66,16 @@ lib_sources = [
 	'veboxcopy_gen12.c',
 ]
 
+if host_machine.system() == 'linux'
+	lib_sources += [
+		'igt_aux.c',
+	]
+else
+	lib_sources += [
+		'igt_aux_null.c',
+	]
+endif
+
 lib_deps = [
 	cairo,
 	glib,
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 16/29] lib/igt_kmod: add null implementation
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (14 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 15/29] lib/igt_aux: add null implementation D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 17/29] lib/igt_perf: " D Scott Phillips
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

igt_kmod depends on libkmod, which is only available on Linux. Add
a do-nothing implementation of the same API for inclusion on other
platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_kmod.h      |  2 ++
 lib/igt_kmod_null.c | 84 +++++++++++++++++++++++++++++++++++++++++++++
 lib/meson.build     |  3 +-
 3 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 lib/igt_kmod_null.c

diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h
index c71ec147..cd374609 100644
--- a/lib/igt_kmod.h
+++ b/lib/igt_kmod.h
@@ -24,7 +24,9 @@
 #ifndef IGT_KMOD_H
 #define IGT_KMOD_H
 
+#if defined(__linux__)
 #include <libkmod.h>
+#endif
 
 #include "igt_list.h"
 
diff --git a/lib/igt_kmod_null.c b/lib/igt_kmod_null.c
new file mode 100644
index 00000000..9df64e8f
--- /dev/null
+++ b/lib/igt_kmod_null.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright © 2019 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.
+ */
+
+#include "igt_kmod.h"
+
+bool igt_kmod_is_loaded(const char *mod_name) {
+	return true;
+}
+
+void igt_kmod_list_loaded(void) {
+}
+
+bool igt_kmod_has_param(const char *mod_name, const char *param) {
+	return true;
+}
+
+int igt_kmod_load(const char *mod_name, const char *opts) {
+	return 0;
+}
+
+int igt_kmod_unload(const char *mod_name, unsigned int flags) {
+	return 0;
+}
+
+int igt_i915_driver_load(const char *opts) {
+	return 0;
+}
+
+int igt_i915_driver_unload(void) {
+	return 0;
+}
+
+void igt_kselftests(const char *module_name,
+		    const char *module_options,
+		    const char *result_option,
+		    const char *filter) {
+}
+
+int igt_kselftest_init(struct igt_kselftest *tst,
+		       const char *module_name) {
+	return 0;
+}
+
+int igt_kselftest_begin(struct igt_kselftest *tst) {
+	return 0;
+}
+
+void igt_kselftest_get_tests(struct kmod_module *kmod,
+			     const char *filter,
+			     struct igt_list_head *tests) {
+}
+
+int igt_kselftest_execute(struct igt_kselftest *tst,
+			  struct igt_kselftest_list *tl,
+			  const char *module_options,
+			  const char *result) {
+	return 0;
+}
+
+void igt_kselftest_end(struct igt_kselftest *tst) {
+}
+
+void igt_kselftest_fini(struct igt_kselftest *tst) {
+}
diff --git a/lib/meson.build b/lib/meson.build
index 6a56fff0..4a58d9cf 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -54,7 +54,6 @@ lib_sources = [
 	'igt_pm.c',
 	'igt_dummyload.c',
 	'uwildmat/uwildmat.c',
-	'igt_kmod.c',
 	'igt_panfrost.c',
 	'igt_v3d.c',
 	'igt_vc4.c',
@@ -69,10 +68,12 @@ lib_sources = [
 if host_machine.system() == 'linux'
 	lib_sources += [
 		'igt_aux.c',
+		'igt_kmod.c',
 	]
 else
 	lib_sources += [
 		'igt_aux_null.c',
+		'igt_kmod_null.c',
 	]
 endif
 
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 17/29] lib/igt_perf: add null implementation
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (15 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 16/29] lib/igt_kmod: " D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 18/29] runner: Add support for non-Linux operating systems D Scott Phillips
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

perf is only availble on Linux. Add a do-nothing implementation of
the same API for inclusion on other platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_perf.h      | 23 +++++++++++++++++++++++
 lib/igt_perf_null.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 lib/meson.build     | 12 ++++++++++--
 3 files changed, 78 insertions(+), 2 deletions(-)
 create mode 100644 lib/igt_perf_null.c

diff --git a/lib/igt_perf.h b/lib/igt_perf.h
index e00718f4..1e27b3cf 100644
--- a/lib/igt_perf.h
+++ b/lib/igt_perf.h
@@ -27,10 +27,13 @@
 
 #include <stdint.h>
 
+#if defined(__linux__)
 #include <linux/perf_event.h>
+#endif
 
 #include "igt_gt.h"
 
+#if defined(__linux__)
 static inline int
 perf_event_open(struct perf_event_attr *attr,
 		pid_t pid,
@@ -50,6 +53,26 @@ perf_event_open(struct perf_event_attr *attr,
     attr->size = sizeof(*attr);
     return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags);
 }
+#else
+#include <errno.h>
+
+struct perf_event_attr {
+	uint64_t config;
+	uint64_t type;
+	uint64_t sample_period;
+};
+
+static inline int
+perf_event_open(struct perf_event_attr *attr,
+		pid_t pid,
+		int cpu,
+		int group_fd,
+		unsigned long flags)
+{
+   errno = ENXIO;
+   return -1;
+}
+#endif
 
 uint64_t i915_type_id(void);
 int perf_i915_open(uint64_t config);
diff --git a/lib/igt_perf_null.c b/lib/igt_perf_null.c
new file mode 100644
index 00000000..6fef33c9
--- /dev/null
+++ b/lib/igt_perf_null.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2019 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.
+ *
+ */
+
+#include "igt_perf.h"
+
+uint64_t i915_type_id(void) {
+	return 0;
+}
+
+int perf_i915_open(uint64_t config) {
+	return 0;
+}
+
+int perf_i915_open_group(uint64_t config, int group) {
+	return 0;
+}
+
+int igt_perf_open(uint64_t type, uint64_t config) {
+	return 0;
+}
+
+int igt_perf_open_group(uint64_t type, uint64_t config, int group) {
+	return 0;
+}
diff --git a/lib/meson.build b/lib/meson.build
index 4a58d9cf..2cb944e2 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -14,7 +14,6 @@ lib_sources = [
 	'igt_gt.c',
 	'igt_halffloat.c',
 	'igt_matrix.c',
-	'igt_perf.c',
 	'igt_primes.c',
 	'igt_rand.c',
 	'igt_rapl.c',
@@ -69,11 +68,13 @@ if host_machine.system() == 'linux'
 	lib_sources += [
 		'igt_aux.c',
 		'igt_kmod.c',
+		'igt_perf.c',
 	]
 else
 	lib_sources += [
 		'igt_aux_null.c',
 		'igt_kmod_null.c',
+		'igt_perf_null.c',
 	]
 endif
 
@@ -170,8 +171,15 @@ lin_igt_chipset_build = static_library('igt_chipset',
 lib_igt_chipset = declare_dependency(link_with : lin_igt_chipset_build,
                                      include_directories : inc)
 
+
+if host_machine.system() == 'linux'
+	igt_perf_sources = ['igt_perf.c']
+else
+	igt_perf_sources = ['igt_perf_null.c']
+endif
+
 lib_igt_perf_build = static_library('igt_perf',
-	['igt_perf.c'],
+	igt_perf_sources,
 	include_directories : inc)
 
 lib_igt_perf = declare_dependency(link_with : lib_igt_perf_build,
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 18/29] runner: Add support for non-Linux operating systems
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (16 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 17/29] lib/igt_perf: " D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 19/29] Use ETIMEDOUT in place of ETIME on FreeBSD D Scott Phillips
                   ` (12 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

The runner depends on Linux specific functionality like signalfd
and the watchdog interface. Provide stub functionality for other
platforms so that the runner can continue with reduced
functionality.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 runner/executor.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/runner/executor.c b/runner/executor.c
index f36bfd3d..095451c4 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -1,7 +1,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <glib.h>
+#if defined(__linux__)
 #include <linux/watchdog.h>
+#endif
 #if HAVE_OPING
 #include <oping.h>
 #endif
@@ -13,7 +15,9 @@
 #include <sys/ioctl.h>
 #include <sys/select.h>
 #include <sys/poll.h>
+#if defined(__linux__)
 #include <sys/signalfd.h>
+#endif
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
@@ -27,6 +31,12 @@
 #include "executor.h"
 #include "output_strings.h"
 
+#if !defined(__linux__)
+#define CLOCK_BOOTTIME CLOCK_REALTIME
+#define WDIOC_SETTIMEOUT 0
+#define WDIOC_KEEPALIVE 0
+#endif
+
 static struct {
 	int *fds;
 	size_t num_dogs;
@@ -674,7 +684,14 @@ static int monitor_output(pid_t child,
 	char *outbuf = NULL;
 	size_t outbufsize = 0;
 	char current_subtest[256] = {};
+#if defined(__linux__)
 	struct signalfd_siginfo siginfo;
+#else
+	struct signalfd_siginfo {
+		pid_t ssi_pid;
+		int ssi_signo;
+	} siginfo;
+#endif
 	ssize_t s;
 	int n, status;
 	int nfds = outfd;
@@ -1455,7 +1472,14 @@ static void oom_immortal(void)
 
 static bool should_die_because_signal(int sigfd)
 {
+#if defined(__linux__)
 	struct signalfd_siginfo siginfo;
+#else
+	struct signalfd_siginfo {
+		pid_t ssi_pid;
+		int ssi_signo;
+	} siginfo;
+#endif
 	int ret;
 	struct pollfd sigpoll = { .fd = sigfd, .events = POLLIN | POLLRDBAND };
 
@@ -1494,7 +1518,7 @@ bool execute(struct execute_state *state,
 	struct utsname unamebuf;
 	int resdirfd, testdirfd, unamefd, timefd;
 	sigset_t sigmask;
-	int sigfd;
+	int sigfd = -1;
 	double time_spent = 0.0;
 	bool status = true;
 
@@ -1543,7 +1567,9 @@ bool execute(struct execute_state *state,
 	sigaddset(&sigmask, SIGTERM);
 	sigaddset(&sigmask, SIGQUIT);
 	sigaddset(&sigmask, SIGHUP);
+#if defined(__linux__)
 	sigfd = signalfd(-1, &sigmask, O_CLOEXEC);
+#endif
 	sigprocmask(SIG_BLOCK, &sigmask, NULL);
 
 	if (sigfd < 0) {
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 19/29] Use ETIMEDOUT in place of ETIME on FreeBSD
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (17 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 18/29] runner: Add support for non-Linux operating systems D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 20/29] ilog2: Use libc provided fls() " D Scott Phillips
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

FreeBSD does not provide ETIME, and the drm interface is uniformly
patched on that platform to use ETIMEDOUT in its place.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt.h                        | 4 ++++
 lib/sw_sync.c                    | 1 +
 tests/i915/gem_ctx_persistence.c | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/igt.h b/lib/igt.h
index a6c4e44d..18f55139 100644
--- a/lib/igt.h
+++ b/lib/igt.h
@@ -56,4 +56,8 @@
 #include "i915/gem_mman.h"
 #include "i915/gem_engine_topology.h"
 
+#if defined(__FreeBSD__)
+#define ETIME ETIMEDOUT
+#endif
+
 #endif /* IGT_H */
diff --git a/lib/sw_sync.c b/lib/sw_sync.c
index d671923c..6edcafcd 100644
--- a/lib/sw_sync.c
+++ b/lib/sw_sync.c
@@ -35,6 +35,7 @@
 
 #include "sync_file.h"
 
+#include "igt.h"
 #include "igt_debugfs.h"
 #include "igt_kmod.h"
 #include "sw_sync.h"
diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index d68431ae..4c957f99 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -28,7 +28,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "drmtest.h" /* gem_quiescent_gpu()! */
+#include "igt.h"
 #include "i915/gem_context.h"
 #include "i915/gem_engine_topology.h"
 #include "i915/gem_ring.h"
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 20/29] ilog2: Use libc provided fls() on FreeBSD
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (18 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 19/29] Use ETIMEDOUT in place of ETIME on FreeBSD D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 21/29] lib: undefine FreeBSD libc's ALIGN macro D Scott Phillips
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

FreeBSD's libc provides an fls() function with the same name and
behavior, so simply omit our version on FreeBSD.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 benchmarks/ilog2.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/benchmarks/ilog2.h b/benchmarks/ilog2.h
index 596d7c23..c7d18094 100644
--- a/benchmarks/ilog2.h
+++ b/benchmarks/ilog2.h
@@ -3,12 +3,14 @@
 
 #include <stdint.h>
 
+#if !defined(__FreeBSD__)
 static inline int fls(int x)
 {
         int r = -1;
         asm("bsrl %1,%0" : "=r" (r) : "rm" (x), "0" (-1));
         return r + 1;
 }
+#endif
 
 static inline int fls64(__u64 x)
 {
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 21/29] lib: undefine FreeBSD libc's ALIGN macro
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (19 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 20/29] ilog2: Use libc provided fls() " D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 22/29] lib: Add FreeBSD-specific pthread logic D Scott Phillips
                   ` (9 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

On FreeBSD, if you include many of the non-POSIX headers, you get
inflicted with a definition of an ALIGN() macro that has something
to do with network protocols. Here we include a header that
provides it and then undefine it so that we can provide our own
definition.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/drmtest.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/drmtest.h b/lib/drmtest.h
index 632c616b..0fc59311 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -33,6 +33,10 @@
 #include <stdint.h>
 #include <sys/mman.h>
 #include <errno.h>
+#if defined(__FreeBSD__)
+# include <sys/param.h>
+# undef ALIGN
+#endif
 
 #include <xf86drm.h>
 
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 22/29] lib: Add FreeBSD-specific pthread logic
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (20 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 21/29] lib: undefine FreeBSD libc's ALIGN macro D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 23/29] lib/igt_kms: Add FreeBSD support D Scott Phillips
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

Add a definition for FreeBSD's platform specific method of
fetching a thread-id and delivering a signal to the current
thread.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_aux.h               | 7 +++++++
 lib/igt_core.c              | 2 ++
 tests/i915/gem_close_race.c | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 04d22904..5cbef592 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -45,8 +45,15 @@
 # ifndef HAVE_GETTID
 #  define gettid() (pid_t)(syscall(__NR_gettid))
 # endif
+#else
+# ifndef HAVE_GETTID
+#  include <pthread_np.h>
+#  define gettid() (pid_t)(pthread_getthreadid_np())
+# endif
 #endif
+#if defined(__linux__)
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 /* auxialiary igt helpers from igt_aux.c */
 /* generally useful helpers */
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 8df89905..c89030ba 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -2398,6 +2398,8 @@ static void fatal_sig_handler(int sig)
 		pid_t tid = gettid();
 
 		syscall(SYS_tgkill, pid, tid, sig);
+#elif defined(__FreeBSD__)
+		pthread_kill(pthread_self(), sig);
 #else
 		pthread_t tid = pthread_self();
 		union sigval value = { .sival_ptr = NULL };
diff --git a/tests/i915/gem_close_race.c b/tests/i915/gem_close_race.c
index 57e00480..cbef33e2 100644
--- a/tests/i915/gem_close_race.c
+++ b/tests/i915/gem_close_race.c
@@ -51,7 +51,9 @@
 static uint32_t devid;
 static bool has_64bit_relocations;
 
+#if defined(__linux__)
 #define sigev_notify_thread_id _sigev_un._tid
+#endif
 
 static void selfcopy(int fd, uint32_t handle, int loops)
 {
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 23/29] lib/igt_kms: Add FreeBSD support
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (21 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 22/29] lib: Add FreeBSD-specific pthread logic D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 24/29] lib/ioctl_wrappers: Support FreeBSD in igt_require_gem D Scott Phillips
                   ` (7 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

Include the FreeBSD header that provides equivalent definitions to
linux/kd.h, and omit igt_hotplug_watch which depends upon udev.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_kms.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d20daaad..790d1fe8 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -41,6 +41,9 @@
 #elif HAVE_SYS_KD_H
 #include <sys/kd.h>
 #endif
+#if defined(__FreeBSD__)
+#include <sys/consio.h>
+#endif
 
 #include <libudev.h>
 #include <poll.h>
@@ -4117,6 +4120,7 @@ void igt_reset_connectors(void)
 		igt_sysfs_set(forced_connectors[i].dir, "status",  "detect");
 }
 
+#if defined(__linux__)
 /**
  * igt_watch_hotplug:
  *
@@ -4155,6 +4159,11 @@ struct udev_monitor *igt_watch_hotplug(void)
 
 	return mon;
 }
+#else
+struct udev_monitor *igt_watch_hotplug(void) {
+	return NULL;
+}
+#endif
 
 static bool event_detected(struct udev_monitor *mon, int timeout_secs,
 			   const char *property)
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 24/29] lib/ioctl_wrappers: Support FreeBSD in igt_require_gem
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (22 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 23/29] lib/igt_kms: Add FreeBSD support D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 25/29] lib/intel_os: Implement get_avail_ram and get_total_swap for FreeBSD D Scott Phillips
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

On FreeBSD, fdescfs is mounted at /dev/fd/ and provides equivalent
functionality to Linux's /proc/self/fd.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/ioctl_wrappers.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 78b92bd2..3b060f56 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1222,7 +1222,7 @@ static void reset_device(int fd)
 
 void igt_require_gem(int fd)
 {
-	char path[256];
+	char path[256] = {0};
 	int err;
 
 	igt_require_intel(fd);
@@ -1232,7 +1232,11 @@ void igt_require_gem(int fd)
 	 * of a wedged device, not for actually waiting on outstanding
 	 * requests! So create a new drm_file for the device that is clean.
 	 */
+#if defined(__linux__)
 	snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
+#elif defined(__FreeBSD__)
+	snprintf(path, sizeof(path), "/dev/fd/%d", fd);
+#endif
 	fd = open(path, O_RDWR);
 	igt_assert_lte(0, fd);
 
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 25/29] lib/intel_os: Implement get_avail_ram and get_total_swap for FreeBSD
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (23 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 24/29] lib/ioctl_wrappers: Support FreeBSD in igt_require_gem D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 26/29] lib/igt_device: Implement get_card_index " D Scott Phillips
                   ` (5 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

FreeBSD provides these values through sysctl.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/intel_os.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lib/intel_os.c b/lib/intel_os.c
index 8458d39a..d476e9bc 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -44,6 +44,8 @@
 #include <sys/sysinfo.h>
 #elif defined(HAVE_SWAPCTL) /* Solaris */
 #include <sys/swap.h>
+#elif defined(__FreeBSD__)
+#include <sys/sysctl.h>
 #endif
 #include <sys/resource.h>
 
@@ -148,6 +150,14 @@ intel_get_avail_ram_mb(void)
         npages = sysconf(_SC_AVPHYS_PAGES);
 
 	retval = (uint64_t) pagesize * npages;
+#elif defined(__FreeBSD__)
+	int hw_physmem[] = {CTL_HW, HW_PHYSMEM};
+	size_t size = sizeof(retval);
+	int ret;
+	ret = sysctl(hw_physmem, ARRAY_SIZE(hw_physmem), &retval, &size, NULL,
+		     0);
+	if (ret != 0 || size != sizeof(retval))
+		retval = 0;
 #else
 #error "Unknown how to get available RAM for this OS"
 #endif
@@ -210,6 +220,12 @@ intel_get_total_swap_mb(void)
 	free(buf);
 
 	retval = (uint64_t) pagesize * totalpages;
+#elif defined(__FreeBSD__)
+	size_t size = sizeof(retval);
+	int ret;
+	ret = sysctlbyname("vm.swap_total", &retval, &size, NULL, 0);
+	if (ret != 0 || size != sizeof(retval))
+		retval = 0;
 #else
 #warning "Unknown how to get swap size for this OS"
 	return 0;
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 26/29] lib/igt_device: Implement get_card_index for FreeBSD
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (24 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 25/29] lib/intel_os: Implement get_avail_ram and get_total_swap for FreeBSD D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 27/29] lib/igt_debugfs: Implement mount() " D Scott Phillips
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

On FreeBSD, the device nodes for drm devices do not have an
st_rdev value that corresponds to the drm card index. Instead we
can use libutil to look up our open file descriptors through the
sysctl interface.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_device.c | 20 ++++++++++++++++++++
 lib/meson.build  |  1 +
 meson.build      |  6 ++++++
 3 files changed, 27 insertions(+)

diff --git a/lib/igt_device.c b/lib/igt_device.c
index 01a9eff4..327c9c63 100644
--- a/lib/igt_device.c
+++ b/lib/igt_device.c
@@ -27,6 +27,10 @@
 #include <sys/stat.h>
 #if defined(__linux__)
 #include <sys/sysmacros.h>
+#elif defined(__FreeBSD__)
+#include <sys/user.h>
+#include <libgen.h>
+#include <libutil.h>
 #endif
 #include "igt.h"
 #include "igt_device.h"
@@ -111,11 +115,27 @@ void igt_device_drop_master(int fd)
  */
 int igt_device_get_card_index(int fd)
 {
+#if defined(__linux__)
 	struct stat st;
 
 	igt_fail_on(fstat(fd, &st) || !S_ISCHR(st.st_mode));
 
 	return minor(st.st_rdev);
+#elif defined(__FreeBSD__)
+	struct kinfo_file *files, *f;
+	int nfiles, idx = 0;
+
+	files = kinfo_getfile(getpid(), &nfiles);
+	for (f = files; f < files + nfiles; f++) {
+		if (f->kf_fd == fd) {
+			idx = atoi(basename(f->kf_path));
+			break;
+		}
+	}
+	free(files);
+
+	return idx;
+#endif
 }
 
 #define IGT_DEV_PATH_LEN 80
diff --git a/lib/meson.build b/lib/meson.build
index 2cb944e2..710b89b5 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -86,6 +86,7 @@ lib_deps = [
 	libkmod,
 	libprocps,
 	libudev,
+	libutil,
 	math,
 	pciaccess,
 	pixman,
diff --git a/meson.build b/meson.build
index 4d5003ba..ffe9ae1f 100644
--- a/meson.build
+++ b/meson.build
@@ -93,6 +93,12 @@ config = configuration_data()
 
 null_dep = dependency('', required : false)
 
+if host_machine.system() == 'freebsd'
+	libutil = cc.find_library('libutil')
+else
+	libutil = null_dep
+endif
+
 libdrm_info = []
 libdrm_intel = null_dep
 libdrm_nouveau = null_dep
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 27/29] lib/igt_debugfs: Implement mount() for FreeBSD
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (25 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 26/29] lib/igt_device: Implement get_card_index " D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 28/29] build: Add support for building on non-Linux D Scott Phillips
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

debugfs is typically mounted at a different path on FreeBSD, and
the mount function prototype is slightly different.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_debugfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 5a9c8c3c..33592df3 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -116,6 +116,7 @@ static bool is_mountpoint(const char *path)
 
 static const char *__igt_debugfs_mount(void)
 {
+#if defined(__linux__)
 	if (is_mountpoint("/sys/kernel/debug"))
 		return "/sys/kernel/debug";
 
@@ -126,6 +127,17 @@ static const char *__igt_debugfs_mount(void)
 		return NULL;
 
 	return "/sys/kernel/debug";
+#elif defined(__FreeBSD__)
+	if (is_mountpoint("/compat/linux/debug"))
+		return "/compat/linux/debug";
+
+	if (mount("lindebugfs", "/compat/linux/debug", 0, NULL))
+		return NULL;
+
+	return "/compat/linux/debug";
+#else
+#error Do not know how to mount debugfs
+#endif
 }
 
 /**
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 28/29] build: Add support for building on non-Linux
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (26 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 27/29] lib/igt_debugfs: Implement mount() " D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 29/29] lib/igt_device_scan: add null implementation D Scott Phillips
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

This makes libkmod and libprocps dependencies option on non-Linux
platforms and skips building tests which depend on Linux-specific
functionality.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 benchmarks/meson.build |  7 ++++++-
 meson.build            |  4 ++--
 tests/meson.build      | 30 ++++++++++++++++++++----------
 tools/meson.build      | 12 +++++++-----
 4 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/benchmarks/meson.build b/benchmarks/meson.build
index 397f3b8d..d6e05697 100644
--- a/benchmarks/meson.build
+++ b/benchmarks/meson.build
@@ -11,12 +11,17 @@ benchmark_progs = [
 	'gem_mmap',
 	'gem_prw',
 	'gem_set_domain',
-	'gem_syslatency',
 	'kms_vblank',
 	'prime_lookup',
 	'vgem_mmap',
 ]
 
+if host_machine.system() == 'linux'
+	benchmark_progs += [
+		'gem_syslatency',
+	]
+endif
+
 if libdrm_intel.found()
 	benchmark_progs += [
 		'intel_upload_blit_large',
diff --git a/meson.build b/meson.build
index ffe9ae1f..409f35f5 100644
--- a/meson.build
+++ b/meson.build
@@ -122,8 +122,8 @@ endif
 build_info += 'With libdrm: ' + ','.join(libdrm_info)
 
 pciaccess = dependency('pciaccess', version : '>=0.10')
-libkmod = dependency('libkmod')
-libprocps = dependency('libprocps', required : true)
+libkmod = dependency('libkmod', required : host_machine.system() == 'linux')
+libprocps = dependency('libprocps', required : host_machine.system() == 'linux')
 
 libunwind = dependency('libunwind', required : get_option('libunwind'))
 build_info += 'With libunwind: @0@'.format(libunwind.found())
diff --git a/tests/meson.build b/tests/meson.build
index d931cc37..35b75484 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -9,7 +9,6 @@ test_progs = [
 	'drm_import_export',
 	'drm_mm',
 	'drm_read',
-	'fbdev',
 	'kms_3d',
 	'kms_addfb_basic',
 	'kms_atomic',
@@ -21,11 +20,9 @@ test_progs = [
 	'kms_ccs',
 	'kms_color',
 	'kms_concurrent',
-	'kms_content_protection',
 	'kms_crtc_background_color',
 	'kms_cursor_crc',
 	'kms_cursor_edge_walk',
-	'kms_cursor_legacy',
 	'kms_dp_aux_dev',
 	'kms_dp_dsc',
 	'kms_dp_tiled_display',
@@ -56,7 +53,6 @@ test_progs = [
 	'kms_prop_blob',
 	'kms_properties',
 	'kms_psr',
-	'kms_psr2_su',
 	'kms_pwrite_crc',
 	'kms_rmfb',
 	'kms_rotation_crc',
@@ -84,7 +80,6 @@ test_progs = [
 	'syncobj_basic',
 	'syncobj_wait',
 	'template',
-	'tools_test',
 	'v3d_get_bo_offset',
 	'v3d_get_param',
 	'v3d_mmap',
@@ -100,6 +95,16 @@ test_progs = [
 	'vgem_slow',
 ]
 
+if host_machine.system() == 'linux'
+	test_progs += [
+		'fbdev',
+		'kms_content_protection',
+		'kms_cursor_legacy',
+		'kms_psr2_su',
+		'tools_test',
+	]
+endif
+
 i915_progs = [
 	'gen3_mixed_blits',
 	'gen3_render_linear_blits',
@@ -151,7 +156,6 @@ i915_progs = [
 	'gem_exec_parse_blt',
 	'gem_exec_reloc',
 	'gem_exec_reuse',
-	'gem_exec_schedule',
 	'gem_exec_store',
 	'gem_exec_suspend',
 	'gem_exec_whisper',
@@ -172,7 +176,6 @@ i915_progs = [
 	'gem_media_fill',
 	'gem_media_vme',
 	'gem_mmap',
-	'gem_mmap_gtt',
 	'gem_mmap_offset_exhaustion',
 	'gem_mmap_wc',
 	'gem_partial_pwrite_pread',
@@ -221,7 +224,6 @@ i915_progs = [
 	'gem_tiling_max_stride',
 	'gem_unfence_active_buffers',
 	'gem_unref_active_buffers',
-	'gem_userptr_blits',
 	'gem_vm_create',
 	'gem_wait',
 	'gem_workarounds',
@@ -229,11 +231,9 @@ i915_progs = [
 	'i915_fb_tiling',
 	'i915_getparams_basic',
 	'i915_hangman',
-	'i915_module_load',
 	'i915_pm_backlight',
 	'i915_pm_lpsp',
 	'i915_pm_rc6_residency',
-	'i915_pm_rpm',
 	'i915_pm_dc',
 	'i915_pm_rps',
 	'i915_pm_sseu',
@@ -242,6 +242,16 @@ i915_progs = [
 	'i915_suspend',
 ]
 
+if host_machine.system() == 'linux'
+	i915_progs += [
+		'gem_exec_schedule',
+		'gem_mmap_gtt',
+		'gem_userptr_blits',
+		'i915_module_load',
+		'i915_pm_rpm',
+	]
+endif
+
 test_deps = [ igt_deps ]
 
 if libdrm_nouveau.found()
diff --git a/tools/meson.build b/tools/meson.build
index 74822a33..25233478 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -90,11 +90,13 @@ install_subdir('registers', install_dir : datadir,
 		 'Makefile', 'Makefile.in', 'Makefile.am',
 	       ])
 
-shared_library('intel_aubdump', 'aubdump.c',
-	       dependencies : [ lib_igt_chipset, dlsym ],
-	       name_prefix : '',
-	       install : true,
-	       soversion : '0')
+if host_machine.system() == 'linux'
+	shared_library('intel_aubdump', 'aubdump.c',
+		       dependencies : [ lib_igt_chipset, dlsym ],
+		       name_prefix : '',
+		       install : true,
+		       soversion : '0')
+endif
 
 executable('intel_gpu_top', 'intel_gpu_top.c',
 	   install : true,
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] [PATCH i-g-t 29/29] lib/igt_device_scan: add null implementation
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (27 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 28/29] build: Add support for building on non-Linux D Scott Phillips
@ 2019-12-11  0:52 ` D Scott Phillips
  2019-12-11  8:11 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add FreeBSD Support Patchwork
  2019-12-12 11:14 ` [igt-dev] [PATCH i-g-t 00/30] " Jani Nikula
  30 siblings, 0 replies; 37+ messages in thread
From: D Scott Phillips @ 2019-12-11  0:52 UTC (permalink / raw)
  To: igt-dev

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 lib/igt_device_scan_null.c | 67 ++++++++++++++++++++++++++++++++++++++
 lib/meson.build            |  3 +-
 2 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 lib/igt_device_scan_null.c

diff --git a/lib/igt_device_scan_null.c b/lib/igt_device_scan_null.c
new file mode 100644
index 00000000..27f2d94b
--- /dev/null
+++ b/lib/igt_device_scan_null.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright © 2019 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.
+ *
+ */
+
+#include <fcntl.h>
+#include "igt_device_scan.h"
+
+void igt_devices_scan(bool force) {
+}
+
+void igt_devices_print(enum igt_devices_print_type printtype) {
+}
+
+void igt_devices_print_vendors(void) {
+}
+
+void igt_device_print_filter_types(void) {
+}
+
+bool igt_device_is_filter_set(void) {
+	return false;
+}
+
+void igt_device_filter_set(const char *filter) {
+}
+
+void igt_device_filter_free(void) {
+}
+
+const char *igt_device_filter_get(void) {
+	return NULL;
+}
+
+bool igt_device_card_match(const char *filter, struct igt_device_card *card) {
+	card->subsystem[0] = '\0';
+	strcpy(card->card, "/dev/dri/card0");
+	strcpy(card->render, "/dev/dri/renderD128");
+	return true;
+}
+
+int igt_open_card(struct igt_device_card *card) {
+	return open(card->card, O_RDWR);
+}
+
+int igt_open_render(struct igt_device_card *card) {
+	return open(card->render, O_RDWR);
+}
diff --git a/lib/meson.build b/lib/meson.build
index 710b89b5..8bf02653 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -10,7 +10,6 @@ lib_sources = [
 	'igt_color_encoding.c',
 	'igt_debugfs.c',
 	'igt_device.c',
-	'igt_device_scan.c',
 	'igt_gt.c',
 	'igt_halffloat.c',
 	'igt_matrix.c',
@@ -67,12 +66,14 @@ lib_sources = [
 if host_machine.system() == 'linux'
 	lib_sources += [
 		'igt_aux.c',
+		'igt_device_scan.c',
 		'igt_kmod.c',
 		'igt_perf.c',
 	]
 else
 	lib_sources += [
 		'igt_aux_null.c',
+		'igt_device_scan_null.c',
 		'igt_kmod_null.c',
 		'igt_perf_null.c',
 	]
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [igt-dev] ✗ GitLab.Pipeline: warning for Add FreeBSD Support
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (28 preceding siblings ...)
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 29/29] lib/igt_device_scan: add null implementation D Scott Phillips
@ 2019-12-11  8:11 ` Patchwork
  2019-12-12 11:14 ` [igt-dev] [PATCH i-g-t 00/30] " Jani Nikula
  30 siblings, 0 replies; 37+ messages in thread
From: Patchwork @ 2019-12-11  8:11 UTC (permalink / raw)
  To: D Scott Phillips; +Cc: igt-dev

== Series Details ==

Series: Add FreeBSD Support
URL   : https://patchwork.freedesktop.org/series/70729/
State : warning

== Summary ==

Did not get list of undocumented tests for this run, something is wrong!

Other than that, pipeline status: FAILED.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/87430 for the overview.

test:ninja-test has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1113838):
  
    5/292 lib: igt_describe                       FAIL     0.07 s (killed by signal 6 SIGABRT)
  
  --- command ---
  /builds/gfx-ci/igt-ci-tags/build/lib/tests/igt_describe
  --- stderr ---
  igt_describe: ../lib/tests/igt_describe.c:248: main: Assertion `0 == strcmp(DESCRIBE_ALL_OUTPUT, out)' failed.
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1576027580:build_script
  ^[[0Ksection_start:1576027580:after_script
  ^[[0Ksection_end:1576027582:after_script
  ^[[0Ksection_start:1576027582:upload_artifacts_on_failure
  ^[[0Ksection_end:1576027583:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1113839):
  
    5/292 lib: igt_describe                       FAIL     0.12 s (killed by signal 6 SIGABRT)
  
  --- command ---
  /builds/gfx-ci/igt-ci-tags/build/lib/tests/igt_describe
  --- stderr ---
  igt_describe: ../lib/tests/igt_describe.c:248: int main(int, char **): Assertion `0 == strcmp(DESCRIBE_ALL_OUTPUT, out)' failed.
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1576027708:build_script
  ^[[0Ksection_start:1576027708:after_script
  ^[[0Ksection_end:1576027712:after_script
  ^[[0Ksection_start:1576027712:upload_artifacts_on_failure
  ^[[0Ksection_end:1576027717:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-minimal has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1113840):
  
   5/20 lib: igt_describe                       FAIL     0.05 s (killed by signal 6 SIGABRT)
  
  --- command ---
  /builds/gfx-ci/igt-ci-tags/build/lib/tests/igt_describe
  --- stderr ---
  igt_describe: ../lib/tests/igt_describe.c:248: main: Assertion `0 == strcmp(DESCRIBE_ALL_OUTPUT, out)' failed.
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1576027591:build_script
  ^[[0Ksection_start:1576027591:after_script
  ^[[0Ksection_end:1576027593:after_script
  ^[[0Ksection_start:1576027593:upload_artifacts_on_failure
  ^[[0Ksection_end:1576027594:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1113841):
  (runner_test:2781) igt_core-INFO:   #3 ../runner/runner_tests.c:207 main()
  (runner_test:2781) igt_core-INFO:   #4 [__libc_start_main+0xe4]
  (runner_test:2781) igt_core-INFO:   #5 [_start+0x34]
  ****  END  ****
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1576027619:build_script
  ^[[0Ksection_start:1576027619:after_script
  ^[[0Ksection_end:1576027622:after_script
  ^[[0Ksection_start:1576027622:upload_artifacts_on_failure
  ^[[0K^[[32;1mUploading artifacts...^[[0;m
  build: found 1367 matching files                  ^[[0;m 
  Uploading artifacts to coordinator... ok          ^[[0;m  id^[[0;m=1113841 responseStatus^[[0;m=201 Created token^[[0;m=yisbfGa-
  section_end:1576027638:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1113842):
  (runner_test:6370) igt_core-INFO:   #3 ../runner/runner_tests.c:207 main()
  (runner_test:6370) igt_core-INFO:   #4 [__libc_start_main+0x98]
  (runner_test:6370) igt_core-INFO:   #5 [_start+0x34]
  ****  END  ****
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1576027636:build_script
  ^[[0Ksection_start:1576027636:after_script
  ^[[0Ksection_end:1576027638:after_script
  ^[[0Ksection_start:1576027638:upload_artifacts_on_failure
  ^[[0K^[[32;1mUploading artifacts...^[[0;m
  build: found 1368 matching files                  ^[[0;m 
  Uploading artifacts to coordinator... ok          ^[[0;m  id^[[0;m=1113842 responseStatus^[[0;m=201 Created token^[[0;m=8JmvzRer
  section_end:1576027648:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1113843):
  skip-two
  exit:77 ('
  (runner_test:3066) igt_core-INFO: Stack trace:
  ****  END  ****
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1576027650:build_script
  ^[[0Ksection_start:1576027650:after_script
  ^[[0Ksection_end:1576027652:after_script
  ^[[0Ksection_start:1576027652:upload_artifacts_on_failure
  ^[[0K^[[32;1mUploading artifacts...^[[0;m
  build: found 1367 matching files                  ^[[0;m 
  Uploading artifacts to coordinator... ok          ^[[0;m  id^[[0;m=1113843 responseStatus^[[0;m=201 Created token^[[0;m=Wzx6Tkmi
  section_end:1576027661:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:test-list-diff has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1113844):
  Downloading artifacts from coordinator... ok      ^[[0;m  id^[[0;m=1113837 responseStatus^[[0;m=200 OK token^[[0;m=fm6a3z1R
  ^[[32;1mDownloading artifacts for build:tests-debian-meson (1113832)...^[[0;m
  Downloading artifacts from coordinator... ok      ^[[0;m  id^[[0;m=1113832 responseStatus^[[0;m=200 OK token^[[0;m=dtUDS1AD
  section_end:1576027637:download_artifacts
  ^[[0Ksection_start:1576027637:build_script
  ^[[0K^[[0KAuthenticating with credentials from job payload (GitLab Registry)
  ^[[0;m^[[32;1m$ diff <(sed "s/ /\n/g" meson-test-list.txt| grep -v 'vc4\|v3d\|panfrost' | sort) <(sed "s/ /\n/g" autotools-test-list.txt | sort)^[[0;m
  1d0
  < 
  10c9
  < amdgpu/amd_prime-e
  ---
  > amdgpu/amd_prime
  section_end:1576027639:build_script
  ^[[0Ksection_start:1576027639:after_script
  ^[[0Ksection_end:1576027640:after_script
  ^[[0Ksection_start:1576027640:upload_artifacts_on_failure
  ^[[0Ksection_end:1576027642:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/87430
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h D Scott Phillips
@ 2019-12-12 11:01   ` Jani Nikula
  0 siblings, 0 replies; 37+ messages in thread
From: Jani Nikula @ 2019-12-12 11:01 UTC (permalink / raw)
  To: D Scott Phillips, igt-dev

On Tue, 10 Dec 2019, D Scott Phillips <d.scott.phillips@intel.com> wrote:
> linux/sync_file.h isn't strictly part of the drm uapi and so
> doesn't include drm.h. drm.h contains some compatibility #defines
> for non-Linux platforms for things like __u32 which synf_file
> needs.

Unfortunately, stuff in drm-uapi are supposed to be verbatim copies from
the kernel.

BR,
Jani.

>
> Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
> ---
>  include/drm-uapi/sync_file.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/include/drm-uapi/sync_file.h b/include/drm-uapi/sync_file.h
> index b4f2db00..4713b5b9 100644
> --- a/include/drm-uapi/sync_file.h
> +++ b/include/drm-uapi/sync_file.h
> @@ -12,8 +12,7 @@
>  #ifndef _LINUX_SYNC_H
>  #define _LINUX_SYNC_H
>  
> -#include <linux/ioctl.h>
> -#include <linux/types.h>
> +#include "drm.h"
>  
>  /**
>   * struct sync_merge_data - data passed to merge ioctl

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support
  2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
                   ` (29 preceding siblings ...)
  2019-12-11  8:11 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add FreeBSD Support Patchwork
@ 2019-12-12 11:14 ` Jani Nikula
  2019-12-12 18:20   ` D Scott Phillips
  30 siblings, 1 reply; 37+ messages in thread
From: Jani Nikula @ 2019-12-12 11:14 UTC (permalink / raw)
  To: D Scott Phillips, igt-dev; +Cc: Petri Latvala

On Tue, 10 Dec 2019, D Scott Phillips <d.scott.phillips@intel.com> wrote:
> FreeBSD maintains a port of drm and a few drivers: amdgpu, i915,
> radeon, vboxvideo, vmwgfx:
>
> https://github.com/FreeBSDDesktop/kms-drm/
>
> Recently I backported some drm & i915 security patches into our
> tree and was lacking a way to verify the backports. Here is my
> attempt at adding FreeBSD support to igt.
>
> I've tried to order the series so that what I believe will be less
> controversial comes nearer the start. I've also tried to err on
> the side of too many small patches, so I'm happy to squash things
> where that seems more appropriate to people.
>
> The "null" implementations toward the end are probably more like
> RFC ideas. I'm willing to take other approaches there if anyone
> has a better idea for how to handle large sections of code that
> are more linux specific. Cheers,

I'll mostly defer to Petri and Arek, the IGT maintainers, on the
details.

I think the bigger questions are, 1) How do we ensure this does not
bitrot in a matter of weeks? Which translates to, 2) Who is going to
automate and maintain continuous build testing? And, 3) Who's going to
take ownership of the port in general?

Personally, I don't think this is going to work long term just by
merging the port upstream. I think without the continuous support from
people who care about FreeBSD, this is going to be a net negative.


BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support
  2019-12-12 11:14 ` [igt-dev] [PATCH i-g-t 00/30] " Jani Nikula
@ 2019-12-12 18:20   ` D Scott Phillips
  2019-12-16 13:55     ` Petri Latvala
  0 siblings, 1 reply; 37+ messages in thread
From: D Scott Phillips @ 2019-12-12 18:20 UTC (permalink / raw)
  To: Jani Nikula, igt-dev; +Cc: Petri Latvala

Jani Nikula <jani.nikula@linux.intel.com> writes:

> I'll mostly defer to Petri and Arek, the IGT maintainers, on the
> details.
>
> I think the bigger questions are, 1) How do we ensure this does not
> bitrot in a matter of weeks? Which translates to, 2) Who is going to
> automate and maintain continuous build testing? And, 3) Who's going to
> take ownership of the port in general?
>
> Personally, I don't think this is going to work long term just by
> merging the port upstream. I think without the continuous support from
> people who care about FreeBSD, this is going to be a net negative.

Right, I think that's a fair point. What level of continuous support do
you think would get us out of the negative here? A continuous build
could be fairly easy to get configured, but might be a side workflow
apart from how normal CI results are presented. I think that could be a
reasonable indication that things aren't rotting. More sophisticated CI
is within the realm of possibility but could be quite a bit harder to
get off the ground with.

Ultimately, I think as long as the kernel driver port exists this is
something that we will want.

As to who owns the port, FreeBSD has a "Graphics Team" that collectively
owns the kernel driver port, so I think the most robust answer going
forward is to have them own this port. I can take this up with them and 
see if they'll affirm that they will take some ownership here.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename
  2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename D Scott Phillips
@ 2019-12-16 13:31   ` Petri Latvala
  0 siblings, 0 replies; 37+ messages in thread
From: Petri Latvala @ 2019-12-16 13:31 UTC (permalink / raw)
  To: D Scott Phillips; +Cc: igt-dev

On Tue, Dec 10, 2019 at 04:52:17PM -0800, D Scott Phillips wrote:
> We can get POSIX basename by including libgen.h. It behaves
> slightly differently from GNU basename, like possibly modifying
> the passed in string. This is OK in this usage, and POSIX basename
> is available on other platforms.
> 
> Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
> ---
>  tests/i915/i915_pm_backlight.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
> index 83b1ed68..2f65156f 100644
> --- a/tests/i915/i915_pm_backlight.c
> +++ b/tests/i915/i915_pm_backlight.c
> @@ -30,6 +30,7 @@
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <fcntl.h>
> +#include <libgen.h>

Needs to be wrapped in #ifdef HAVE_LIBGEN_H though.


-- 
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support
  2019-12-12 18:20   ` D Scott Phillips
@ 2019-12-16 13:55     ` Petri Latvala
  2019-12-27  9:38       ` Arkadiusz Hiler
  0 siblings, 1 reply; 37+ messages in thread
From: Petri Latvala @ 2019-12-16 13:55 UTC (permalink / raw)
  To: D Scott Phillips; +Cc: igt-dev

On Thu, Dec 12, 2019 at 10:20:29AM -0800, D Scott Phillips wrote:
> Jani Nikula <jani.nikula@linux.intel.com> writes:
> 
> > I'll mostly defer to Petri and Arek, the IGT maintainers, on the
> > details.
> >
> > I think the bigger questions are, 1) How do we ensure this does not
> > bitrot in a matter of weeks? Which translates to, 2) Who is going to
> > automate and maintain continuous build testing? And, 3) Who's going to
> > take ownership of the port in general?
> >
> > Personally, I don't think this is going to work long term just by
> > merging the port upstream. I think without the continuous support from
> > people who care about FreeBSD, this is going to be a net negative.
> 
> Right, I think that's a fair point. What level of continuous support do
> you think would get us out of the negative here? A continuous build
> could be fairly easy to get configured, but might be a side workflow
> apart from how normal CI results are presented. I think that could be a
> reasonable indication that things aren't rotting. More sophisticated CI
> is within the realm of possibility but could be quite a bit harder to
> get off the ground with.

I'd say the bar to reach is

* build-testing for each commit
* someone responsible for fixing issues in the above in a timely manner

Build-testing we can reach quite easily in gitlab, for some values of
easily, but the second point is harder.

> Ultimately, I think as long as the kernel driver port exists this is
> something that we will want.

Yep. Ultimately, running the tests on HW on FreeBSD is a change that I
would very much welcome.

> As to who owns the port, FreeBSD has a "Graphics Team" that collectively
> owns the kernel driver port, so I think the most robust answer going
> forward is to have them own this port. I can take this up with them and 
> see if they'll affirm that they will take some ownership here.

Thanks for doing this!

As for the series as such:

There's some trivial cleanups in there that I suspect will help even
Linux users on non-glibc systems that we can merge as is. I'm going to
go through reviewing the series later this week for those parts.

The null-implementation patches are for sure getting a NAK in that
form. They need a function-by-function analysis of whether the correct
"do nothing" approach is actually doing nothing or straight up
igt_skip("Not supported on this platform"); in some form.
For example, tests that use igt_fork_signal_helper will test nothing
if they don't manage to fork a periodical interrupter process.


-- 
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support
  2019-12-16 13:55     ` Petri Latvala
@ 2019-12-27  9:38       ` Arkadiusz Hiler
  0 siblings, 0 replies; 37+ messages in thread
From: Arkadiusz Hiler @ 2019-12-27  9:38 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

On Mon, Dec 16, 2019 at 03:55:19PM +0200, Petri Latvala wrote:
> On Thu, Dec 12, 2019 at 10:20:29AM -0800, D Scott Phillips wrote:
> > Jani Nikula <jani.nikula@linux.intel.com> writes:
> > 
> > > I'll mostly defer to Petri and Arek, the IGT maintainers, on the
> > > details.
> > >
> > > I think the bigger questions are, 1) How do we ensure this does not
> > > bitrot in a matter of weeks? Which translates to, 2) Who is going to
> > > automate and maintain continuous build testing? And, 3) Who's going to
> > > take ownership of the port in general?
> > >
> > > Personally, I don't think this is going to work long term just by
> > > merging the port upstream. I think without the continuous support from
> > > people who care about FreeBSD, this is going to be a net negative.
> > 
> > Right, I think that's a fair point. What level of continuous support do
> > you think would get us out of the negative here? A continuous build
> > could be fairly easy to get configured, but might be a side workflow
> > apart from how normal CI results are presented. I think that could be a
> > reasonable indication that things aren't rotting. More sophisticated CI
> > is within the realm of possibility but could be quite a bit harder to
> > get off the ground with.
> 
> I'd say the bar to reach is
> 
> * build-testing for each commit
> * someone responsible for fixing issues in the above in a timely manner
> 
> Build-testing we can reach quite easily in gitlab, for some values of
> easily, but the second point is harder.

Do we have any FreeBSD runners[0] available on freedesktop's GitLab
already? Or do you have something else (virt) in mind?

[0]: https://docs.gitlab.com/runner/install/freebsd.html

> 
> > Ultimately, I think as long as the kernel driver port exists this is
> > something that we will want.
> 
> Yep. Ultimately, running the tests on HW on FreeBSD is a change that I
> would very much welcome.
> 
> > As to who owns the port, FreeBSD has a "Graphics Team" that collectively
> > owns the kernel driver port, so I think the most robust answer going
> > forward is to have them own this port. I can take this up with them and 
> > see if they'll affirm that they will take some ownership here.
> 
> Thanks for doing this!
> 
> As for the series as such:
> 
> There's some trivial cleanups in there that I suspect will help even
> Linux users on non-glibc systems that we can merge as is. I'm going to
> go through reviewing the series later this week for those parts.

Google is maintaining IGT for Android port and they decided it's easier
to do that out of tree. FreeBSD is closer to what most IGT devs are
using, so it shouldn't be too much pain for both FreeBSD and Linux
folks.

Anyway, since Android is also a non-glibc system I think it's worth
looking at what they have been cooking on their side:

https://android.googlesource.com/platform/external/igt-gpu-tools/+log

-- 
Cheers,
Arek

> The null-implementation patches are for sure getting a NAK in that
> form. They need a function-by-function analysis of whether the correct
> "do nothing" approach is actually doing nothing or straight up
> igt_skip("Not supported on this platform"); in some form.
> For example, tests that use igt_fork_signal_helper will test nothing
> if they don't manage to fork a periodical interrupter process.
> 
> 
> -- 
> Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2019-12-27  9:38 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 01/29] Remove unused includes D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 02/29] lib/igt_chipset: Add missing libdrm dependency D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 03/29] lib/igt_core: update longjmp buffers to type sigjmp_buf D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 04/29] Include <sys/wait.h>, <limits.h>, and <signal.h> where appropriate D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 05/29] Use /bin/sh for shell scripts D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 06/29] tools/intel_gpu_top: Use POSIX signal handler type definition D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 07/29] kms_atomic: change `PAGE_SIZE` to `page_size` D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 08/29] lib: remove open-coded card index fetching D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 09/29] igt: replace mmap64() with mmap() D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h D Scott Phillips
2019-12-12 11:01   ` Jani Nikula
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename D Scott Phillips
2019-12-16 13:31   ` Petri Latvala
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 12/29] Include Linux specific headers only on Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 13/29] lib/igt_core: skip oom_adjustments on non-Linux platforms D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 14/29] i915/gem: Omit Linux-specific madvise, mmap, and sched flags on non-Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 15/29] lib/igt_aux: add null implementation D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 16/29] lib/igt_kmod: " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 17/29] lib/igt_perf: " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 18/29] runner: Add support for non-Linux operating systems D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 19/29] Use ETIMEDOUT in place of ETIME on FreeBSD D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 20/29] ilog2: Use libc provided fls() " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 21/29] lib: undefine FreeBSD libc's ALIGN macro D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 22/29] lib: Add FreeBSD-specific pthread logic D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 23/29] lib/igt_kms: Add FreeBSD support D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 24/29] lib/ioctl_wrappers: Support FreeBSD in igt_require_gem D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 25/29] lib/intel_os: Implement get_avail_ram and get_total_swap for FreeBSD D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 26/29] lib/igt_device: Implement get_card_index " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 27/29] lib/igt_debugfs: Implement mount() " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 28/29] build: Add support for building on non-Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 29/29] lib/igt_device_scan: add null implementation D Scott Phillips
2019-12-11  8:11 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add FreeBSD Support Patchwork
2019-12-12 11:14 ` [igt-dev] [PATCH i-g-t 00/30] " Jani Nikula
2019-12-12 18:20   ` D Scott Phillips
2019-12-16 13:55     ` Petri Latvala
2019-12-27  9:38       ` Arkadiusz Hiler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.