All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am
@ 2017-09-02 17:03 Daniel Vetter
  2017-09-02 17:03 ` [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult Daniel Vetter
                   ` (12 more replies)
  0 siblings, 13 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:03 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

In meson I want to just set this everywhere (no reason not to), and
doing so will allow us to clean up a few things.

But that means autofoo needs to follow suit.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 benchmarks/Makefile.am | 2 +-
 lib/Makefile.am        | 1 +
 lib/tests/Makefile.am  | 1 +
 tests/Makefile.am      | 1 +
 tools/Makefile.am      | 2 +-
 5 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am
index 1232753917af..9d1838db1178 100644
--- a/benchmarks/Makefile.am
+++ b/benchmarks/Makefile.am
@@ -8,7 +8,7 @@ endif
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(CAIRO_CFLAGS) $(LIBUNWIND_CFLAGS) \
-	    $(WERROR_CFLAGS)
+	    $(WERROR_CFLAGS) -D_GNU_SOURCE
 LDADD = $(top_builddir)/lib/libigt.la
 
 benchmarks_LTLIBRARIES = gem_exec_tracer.la
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 40399be12da9..abc61640dda4 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -64,6 +64,7 @@ AM_CFLAGS = \
 	    $(ALSA_CFLAGS) \
 	    -DIGT_SRCDIR=\""$(abs_top_srcdir)/tests"\" \
 	    -DIGT_DATADIR=\""$(pkgdatadir)"\" \
+	    -D_GNU_SOURCE \
 	    -DIGT_LOG_DOMAIN=\""$(subst _,-,$*)"\" \
 	    -pthread
 
diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am
index 91440a27a5e8..661292a16446 100644
--- a/lib/tests/Makefile.am
+++ b/lib/tests/Makefile.am
@@ -12,6 +12,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS) \
 	-I$(srcdir)/.. \
 	-include "$(srcdir)/../../lib/check-ndebug.h" \
 	-DIGT_DATADIR=\""$(abs_srcdir)"\" \
+	-D_GNU_SOURCE
 	$(NULL)
 
 LDADD = ../libigt.la $(PCIACCESS_LIBS) $(DRM_LIBS) $(LIBUNWIND_LIBS) $(TIMER_LIBS)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3d9ea87ef4ee..c7447e1fdafe 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -76,6 +76,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) -Wno-unused-result $(DEBUG_CFLAGS)\
 	-include "$(srcdir)/../lib/check-ndebug.h" \
 	-DIGT_SRCDIR=\""$(abs_srcdir)"\" \
 	-DIGT_DATADIR=\""$(pkgdatadir)"\" \
+	-D_GNU_SOURCE \
 	$(LIBUNWIND_CFLAGS) $(WERROR_CFLAGS) \
 	$(NULL)
 
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 5991b4988865..6307a4bd54d7 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -18,7 +18,7 @@ SUBDIRS = null_state_gen registers
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
 AM_CFLAGS = $(DEBUG_CFLAGS) $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS) \
 	    $(CAIRO_CFLAGS) $(LIBUNWIND_CFLAGS) -DPKGDATADIR=\"$(pkgdatadir)\" \
-	    $(WERROR_CFLAGS)
+	    $(WERROR_CFLAGS) -D_GNU_SOURCE
 LDADD = $(top_builddir)/lib/libigt.la
 AM_LDFLAGS = -Wl,--as-needed
 
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
@ 2017-09-02 17:03 ` Daniel Vetter
  2017-09-03  9:29   ` Chris Wilson
  2017-09-04  8:28   ` Arkadiusz Hiler
  2017-09-02 17:03 ` [PATCH i-g-t 03/12] build: use HAVE_LIBGEN_H consistently Daniel Vetter
                   ` (11 subsequent siblings)
  12 siblings, 2 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:03 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

We have it. Daniel Stone said it comes from the X11 transition to the
modular build.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 lib/igt_alsa.h                  | 2 --
 lib/igt_audio.h                 | 2 --
 lib/igt_chamelium.h             | 2 --
 lib/igt_frame.h                 | 2 --
 lib/igt_x86.c                   | 2 --
 lib/intel_os.c                  | 2 --
 overlay/overlay.h               | 2 --
 overlay/x11/position.c          | 2 --
 tests/amdgpu/amd_basic.c        | 2 --
 tests/debugfs_test.c            | 2 --
 tests/gem_fence_thrash.c        | 2 --
 tests/gem_fence_upload.c        | 2 --
 tests/gem_render_linear_blits.c | 2 --
 tests/kms_flip.c                | 2 --
 tests/kms_render.c              | 2 --
 tests/kms_setmode.c             | 2 --
 tests/testdisplay.c             | 2 --
 tests/testdisplay_hotplug.c     | 2 --
 tests/tools_test.c              | 2 --
 tools/intel_gpu_top.c           | 2 --
 tools/intel_gvtg_test.c         | 2 --
 tools/intel_l3_parity.c         | 2 --
 tools/intel_l3_udev_listener.c  | 2 --
 23 files changed, 46 deletions(-)

diff --git a/lib/igt_alsa.h b/lib/igt_alsa.h
index f3949d262a4f..8f7724ad9727 100644
--- a/lib/igt_alsa.h
+++ b/lib/igt_alsa.h
@@ -27,9 +27,7 @@
 #ifndef IGT_ALSA_H
 #define IGT_ALSA_H
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <stdbool.h>
diff --git a/lib/igt_audio.h b/lib/igt_audio.h
index 507e7ab9c661..21adfee82756 100644
--- a/lib/igt_audio.h
+++ b/lib/igt_audio.h
@@ -27,9 +27,7 @@
 #ifndef IGT_AUDIO_H
 #define IGT_AUDIO_H
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <stdbool.h>
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index 2a0fa234ec60..a2d626eca957 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -26,9 +26,7 @@
 #ifndef IGT_CHAMELIUM_H
 #define IGT_CHAMELIUM_H
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <stdbool.h>
diff --git a/lib/igt_frame.h b/lib/igt_frame.h
index 1d9bbf6a7010..680ad5bbd293 100644
--- a/lib/igt_frame.h
+++ b/lib/igt_frame.h
@@ -27,9 +27,7 @@
 #ifndef IGT_FRAME_H
 #define IGT_FRAME_H
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <stdbool.h>
diff --git a/lib/igt_x86.c b/lib/igt_x86.c
index 6f03849f6ff2..0f0963ced044 100644
--- a/lib/igt_x86.c
+++ b/lib/igt_x86.c
@@ -25,9 +25,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #ifdef HAVE_CPUID_H
 #include <cpuid.h>
diff --git a/lib/intel_os.c b/lib/intel_os.c
index e5dea6e5a619..6e0a46b3c35c 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -26,9 +26,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/overlay/overlay.h b/overlay/overlay.h
index 793816d2e044..7bc7ada7eafa 100644
--- a/overlay/overlay.h
+++ b/overlay/overlay.h
@@ -25,9 +25,7 @@
 #ifndef OVERLAY_H
 #define OVERLAY_H
 
-#ifdef HAVE_CONFIG_H
 #include"config.h"
-#endif
 
 #include <cairo.h>
 
diff --git a/overlay/x11/position.c b/overlay/x11/position.c
index cd0035394086..9e3db3709ef7 100644
--- a/overlay/x11/position.c
+++ b/overlay/x11/position.c
@@ -22,9 +22,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <X11/Xlib.h>
 #ifdef HAVE_XRANDR
diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
index 5e44b123fcaf..9f21de65bf10 100644
--- a/tests/amdgpu/amd_basic.c
+++ b/tests/amdgpu/amd_basic.c
@@ -22,9 +22,7 @@
  * Based on libdrm/tests/amdgpu/basic_tests.c
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/debugfs_test.c b/tests/debugfs_test.c
index 1663fd41eab8..5e7805e1559e 100644
--- a/tests/debugfs_test.c
+++ b/tests/debugfs_test.c
@@ -20,9 +20,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 #include "igt.h"
 #include "igt_sysfs.h"
 #include <fcntl.h>
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 52095f26fdca..14d026a99f71 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -26,9 +26,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <unistd.h>
diff --git a/tests/gem_fence_upload.c b/tests/gem_fence_upload.c
index 7d9acdc0fcb3..f3b0e62fa7a7 100644
--- a/tests/gem_fence_upload.c
+++ b/tests/gem_fence_upload.c
@@ -25,9 +25,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <unistd.h>
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index 5fc8cc5e3abe..db34d427385a 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -33,9 +33,7 @@
  * The goal is to simply ensure the basics work.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <stdlib.h>
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 837ebecda733..06cb3ff29351 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -21,9 +21,7 @@
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 
diff --git a/tests/kms_render.c b/tests/kms_render.c
index fd33dfb7cafe..d2208e38f84e 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -20,9 +20,7 @@
  * Authors:
  *    Imre Deak <imre.deak@intel.com>
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <cairo.h>
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index a7a48de44b0e..206d360607bb 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -20,9 +20,7 @@
  * Authors:
  *    Imre Deak <imre.deak@intel.com>
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <cairo.h>
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index f2a41fa0e53b..b0156c5cf0e1 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -45,9 +45,7 @@
  *  - DP commands (e.g. poweroff)
  * - verify outputs against VBT/physical connectors
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <cairo.h>
diff --git a/tests/testdisplay_hotplug.c b/tests/testdisplay_hotplug.c
index cf1551183c56..ca1d849d978d 100644
--- a/tests/testdisplay_hotplug.c
+++ b/tests/testdisplay_hotplug.c
@@ -29,9 +29,7 @@
 #include <sys/stat.h>
 
 #include "testdisplay.h"
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 
 #ifdef HAVE_UDEV
diff --git a/tests/tools_test.c b/tests/tools_test.c
index ccd165de6ca8..3122bb4f7da2 100644
--- a/tests/tools_test.c
+++ b/tests/tools_test.c
@@ -20,9 +20,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 #include "igt.h"
 #include <stdio.h>
 #include <sys/types.h>
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 3fe77f707705..7454de878dd1 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -27,9 +27,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/tools/intel_gvtg_test.c b/tools/intel_gvtg_test.c
index 3db2c89bdac4..7a29fbdde7cd 100644
--- a/tools/intel_gvtg_test.c
+++ b/tools/intel_gvtg_test.c
@@ -28,9 +28,7 @@
  * TODO:
  * Enable more GVT-g related test cases.
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <errno.h>
diff --git a/tools/intel_l3_parity.c b/tools/intel_l3_parity.c
index eb00c50d33e4..26b7caaa1576 100644
--- a/tools/intel_l3_parity.c
+++ b/tools/intel_l3_parity.c
@@ -39,9 +39,7 @@
 #include "intel_io.h"
 #include "igt_sysfs.h"
 #include "drmtest.h"
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 #ifdef HAVE_UDEV
 #include <libudev.h>
 #include <syslog.h>
diff --git a/tools/intel_l3_udev_listener.c b/tools/intel_l3_udev_listener.c
index 270bfff44f0f..57a0f0bf713b 100644
--- a/tools/intel_l3_udev_listener.c
+++ b/tools/intel_l3_udev_listener.c
@@ -21,9 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #ifdef HAVE_UDEV
 #include <libudev.h>
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 03/12] build: use HAVE_LIBGEN_H consistently
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
  2017-09-02 17:03 ` [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult Daniel Vetter
@ 2017-09-02 17:03 ` Daniel Vetter
  2017-09-02 17:03 ` [PATCH i-g-t 04/12] build: remove _GNU_SOURCE from source files Daniel Vetter
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:03 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Also, we are _GNU_SOURCE, so simplify the conditions accordingly.

The next patch will remove _GNU_SOURCE everywhere else.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 lib/drmtest.c        | 4 +---
 lib/igt_aux.c        | 4 +---
 lib/igt_core.c       | 4 +---
 lib/ioctl_wrappers.c | 4 +---
 lib/sw_sync.c        | 4 +---
 5 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 158af68283b8..8a07152c701a 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -26,9 +26,7 @@
  *
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <stdio.h>
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index d808fe3ed27a..0c83a1f48ed2 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -26,9 +26,7 @@
  *
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <stdio.h>
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 99a82d5ae0e1..cf15db69c661 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -26,9 +26,7 @@
  *
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <stdio.h>
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 51000bac0513..b4d6210d5942 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -26,9 +26,7 @@
  *
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <stdio.h>
diff --git a/lib/sw_sync.c b/lib/sw_sync.c
index 7bd76702c8d1..9b36dd85c192 100644
--- a/lib/sw_sync.c
+++ b/lib/sw_sync.c
@@ -24,9 +24,7 @@
  *    Robert Foss <robert.foss@collabora.com>
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <fcntl.h>
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 04/12] build: remove _GNU_SOURCE from source files
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
  2017-09-02 17:03 ` [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult Daniel Vetter
  2017-09-02 17:03 ` [PATCH i-g-t 03/12] build: use HAVE_LIBGEN_H consistently Daniel Vetter
@ 2017-09-02 17:03 ` Daniel Vetter
  2017-09-02 17:03 ` [PATCH i-g-t 05/12] tests/gem_spin_batch: Fix warning Daniel Vetter
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:03 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

We are, the build system takes care of that.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 benchmarks/gem_exec_tracer.c   | 2 --
 benchmarks/gem_latency.c       | 1 -
 benchmarks/gem_syslatency.c    | 2 --
 lib/igt_fb.c                   | 1 -
 lib/igt_vgem.c                 | 2 --
 lib/tests/igt_exit_handler.c   | 1 -
 tests/core_get_client_auth.c   | 1 -
 tests/core_setmaster_vs_auth.c | 1 -
 tests/drm_import_export.c      | 1 -
 tests/drv_missed_irq.c         | 1 -
 tests/gem_fenced_exec_thrash.c | 2 --
 tests/gem_flink_race.c         | 1 -
 tests/gem_mmap_gtt.c           | 1 -
 tests/gem_mmap_wc.c            | 1 -
 tests/gem_persistent_relocs.c  | 1 -
 tests/gem_reloc_vs_gpu.c       | 1 -
 tests/gem_reset_stats.c        | 1 -
 tests/gem_streaming_writes.c   | 1 -
 tests/gem_workarounds.c        | 1 -
 tests/kms_cursor_legacy.c      | 1 -
 tests/pm_rc6_residency.c       | 1 -
 tests/pm_rps.c                 | 1 -
 tests/prime_mmap.c             | 1 -
 tests/prime_self_import.c      | 1 -
 tools/aubdump.c                | 2 --
 tools/intel_audio_dump.c       | 1 -
 tools/intel_dump_decode.c      | 1 -
 tools/intel_error_decode.c     | 1 -
 tools/intel_framebuffer_dump.c | 1 -
 tools/intel_gpu_frequency.c    | 1 -
 tools/intel_guc_logger.c       | 1 -
 tools/intel_l3_parity.c        | 1 -
 tools/intel_l3_udev_listener.c | 3 ---
 33 files changed, 40 deletions(-)

diff --git a/benchmarks/gem_exec_tracer.c b/benchmarks/gem_exec_tracer.c
index a49c11a967f0..8ee29b5d8916 100644
--- a/benchmarks/gem_exec_tracer.c
+++ b/benchmarks/gem_exec_tracer.c
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _GNU_SOURCE /* for RTLD_NEXT */
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/benchmarks/gem_latency.c b/benchmarks/gem_latency.c
index 6cb16ba4f051..c3fc4bf0f74c 100644
--- a/benchmarks/gem_latency.c
+++ b/benchmarks/gem_latency.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <pthread.h>
 
 #include "igt.h"
diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 83bfac78d02b..4ed23638e717 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -22,8 +22,6 @@
  *
  */
 
-#define _GNU_SOURCE
-
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index fbdfca8ad278..95434a699dcf 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -25,7 +25,6 @@
  * 	Damien Lespiau <damien.lespiau@intel.com>
  */
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <math.h>
 
diff --git a/lib/igt_vgem.c b/lib/igt_vgem.c
index 21cccb375c51..3dd9621d0459 100644
--- a/lib/igt_vgem.c
+++ b/lib/igt_vgem.c
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _GNU_SOURCE
-
 #include "igt.h"
 #include "igt_vgem.h"
 
diff --git a/lib/tests/igt_exit_handler.c b/lib/tests/igt_exit_handler.c
index d1b5a8891739..f2997bd13633 100644
--- a/lib/tests/igt_exit_handler.c
+++ b/lib/tests/igt_exit_handler.c
@@ -21,7 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _GNU_SOURCE
 #include <assert.h>
 #include <unistd.h>
 #include <fcntl.h>
diff --git a/tests/core_get_client_auth.c b/tests/core_get_client_auth.c
index 50e87fac76d6..676083d5e322 100644
--- a/tests/core_get_client_auth.c
+++ b/tests/core_get_client_auth.c
@@ -32,7 +32,6 @@
  * Oh dear, libva, why do you do such funny things?
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/tests/core_setmaster_vs_auth.c b/tests/core_setmaster_vs_auth.c
index 783033397939..f1ae0c6338fa 100644
--- a/tests/core_setmaster_vs_auth.c
+++ b/tests/core_setmaster_vs_auth.c
@@ -33,7 +33,6 @@
  * trying to authenticate a client against the wrong master.
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/tests/drm_import_export.c b/tests/drm_import_export.c
index f1234bdcc411..e3ce2480c7f1 100644
--- a/tests/drm_import_export.c
+++ b/tests/drm_import_export.c
@@ -24,7 +24,6 @@
  *    Daniel Vetter <daniel.vetter@ffwll.ch>
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <stdio.h>
 #include <sys/types.h>
diff --git a/tests/drv_missed_irq.c b/tests/drv_missed_irq.c
index fb81f277f5fc..469be882d39c 100644
--- a/tests/drv_missed_irq.c
+++ b/tests/drv_missed_irq.c
@@ -22,7 +22,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <sched.h>
 
 #include "igt.h"
diff --git a/tests/gem_fenced_exec_thrash.c b/tests/gem_fenced_exec_thrash.c
index e403a49155b6..9a43c845e671 100644
--- a/tests/gem_fenced_exec_thrash.c
+++ b/tests/gem_fenced_exec_thrash.c
@@ -25,8 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
-
 #include "igt.h"
 #include <stdlib.h>
 #include <sys/ioctl.h>
diff --git a/tests/gem_flink_race.c b/tests/gem_flink_race.c
index 30e33f65a7dc..9e3d3a622297 100644
--- a/tests/gem_flink_race.c
+++ b/tests/gem_flink_race.c
@@ -24,7 +24,6 @@
  *    Daniel Vetter <daniel.vetter@ffwll.ch>
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <sys/ioctl.h>
 #include <stdlib.h>
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index 4ff5e7f15f81..0f5981257a01 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/tests/gem_mmap_wc.c b/tests/gem_mmap_wc.c
index fd7988073075..110883eb9a61 100644
--- a/tests/gem_mmap_wc.c
+++ b/tests/gem_mmap_wc.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/tests/gem_persistent_relocs.c b/tests/gem_persistent_relocs.c
index bc831ee49920..452fe686e9a5 100644
--- a/tests/gem_persistent_relocs.c
+++ b/tests/gem_persistent_relocs.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c
index afc31328fdc2..d421e4340d62 100644
--- a/tests/gem_reloc_vs_gpu.c
+++ b/tests/gem_reloc_vs_gpu.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 9ac08aabf3a5..edc407676393 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include "igt_sysfs.h"
 #include <limits.h>
diff --git a/tests/gem_streaming_writes.c b/tests/gem_streaming_writes.c
index c27e7fa75dc7..e83d69debc5e 100644
--- a/tests/gem_streaming_writes.c
+++ b/tests/gem_streaming_writes.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/tests/gem_workarounds.c b/tests/gem_workarounds.c
index c7286d86b7a0..d6641bd5578f 100644
--- a/tests/gem_workarounds.c
+++ b/tests/gem_workarounds.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 
 #include <fcntl.h>
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index bdb66f3b51b7..2d32d3a91570 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -22,7 +22,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <sched.h>
 #include <sys/poll.h>
 
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index bdb9747a7ad9..7c87302dcab3 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include "igt_sysfs.h"
 #include <stdio.h>
diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index f0455e78752e..8b543bb8506c 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -26,7 +26,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/prime_mmap.c b/tests/prime_mmap.c
index 1ea61c2fda0d..0da0aa681158 100644
--- a/tests/prime_mmap.c
+++ b/tests/prime_mmap.c
@@ -29,7 +29,6 @@
 /*
  * Testcase: Check whether mmap()ing dma-buf works
  */
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c
index 992334d4bf7d..8c4f53218454 100644
--- a/tests/prime_self_import.c
+++ b/tests/prime_self_import.c
@@ -31,7 +31,6 @@
  * ... but with different fds, i.e. the wayland usecase.
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 4387ea8399a2..4392e589193b 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _GNU_SOURCE /* for RTLD_NEXT */
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/tools/intel_audio_dump.c b/tools/intel_audio_dump.c
index c8d369b548cb..90260a2fe007 100644
--- a/tools/intel_audio_dump.c
+++ b/tools/intel_audio_dump.c
@@ -26,7 +26,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/tools/intel_dump_decode.c b/tools/intel_dump_decode.c
index 0341aada4016..4bb774406f96 100644
--- a/tools/intel_dump_decode.c
+++ b/tools/intel_dump_decode.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c
index 2cbdd8873edd..cdef3b18ad0e 100644
--- a/tools/intel_error_decode.c
+++ b/tools/intel_error_decode.c
@@ -38,7 +38,6 @@
  * decode, but never crash in the process.
  */
 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/intel_framebuffer_dump.c b/tools/intel_framebuffer_dump.c
index 624a96136137..79c0688b1e70 100644
--- a/tools/intel_framebuffer_dump.c
+++ b/tools/intel_framebuffer_dump.c
@@ -26,7 +26,6 @@
  * Read back all the KMS framebuffers attached to the CRTC and record as PNG.
  */
 
-#define _GNU_SOURCE
 #include <stdint.h>
 #include <sys/types.h>
 #include <sys/mman.h>
diff --git a/tools/intel_gpu_frequency.c b/tools/intel_gpu_frequency.c
index cb758b0a6481..5c439b036a16 100644
--- a/tools/intel_gpu_frequency.c
+++ b/tools/intel_gpu_frequency.c
@@ -46,7 +46,6 @@
  * intel_gpu_frequency -d
  */
 
-#define _GNU_SOURCE
 #include <assert.h>
 #include <getopt.h>
 #include <stdio.h>
diff --git a/tools/intel_guc_logger.c b/tools/intel_guc_logger.c
index 3079878e1191..7c6115a669f6 100644
--- a/tools/intel_guc_logger.c
+++ b/tools/intel_guc_logger.c
@@ -1,5 +1,4 @@
 
-#define _GNU_SOURCE  /* For using O_DIRECT */
 #include <inttypes.h>
 #include <stdio.h>
 #include <fcntl.h>
diff --git a/tools/intel_l3_parity.c b/tools/intel_l3_parity.c
index 26b7caaa1576..9df4fc2477f2 100644
--- a/tools/intel_l3_parity.c
+++ b/tools/intel_l3_parity.c
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <assert.h>
diff --git a/tools/intel_l3_udev_listener.c b/tools/intel_l3_udev_listener.c
index 57a0f0bf713b..94d931e507bb 100644
--- a/tools/intel_l3_udev_listener.c
+++ b/tools/intel_l3_udev_listener.c
@@ -25,9 +25,6 @@
 
 #ifdef HAVE_UDEV
 #include <libudev.h>
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 05/12] tests/gem_spin_batch: Fix warning
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (2 preceding siblings ...)
  2017-09-02 17:03 ` [PATCH i-g-t 04/12] build: remove _GNU_SOURCE from source files Daniel Vetter
@ 2017-09-02 17:03 ` Daniel Vetter
  2017-09-03  4:39   ` Eric Anholt
  2017-09-02 17:04 ` [PATCH i-g-t 06/12] lib: prefix frame_dump_path Daniel Vetter
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:03 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/gem_spin_batch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/gem_spin_batch.c b/tests/gem_spin_batch.c
index 941aa1399ae1..09bb3cb37108 100644
--- a/tests/gem_spin_batch.c
+++ b/tests/gem_spin_batch.c
@@ -48,7 +48,7 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
 		igt_spin_batch_set_timeout(spin,
 					   timeout_100ms - igt_nsec_elapsed(&itv));
 		gem_sync(fd, spin->handle);
-		igt_debug("loop %d: interval=%fms (target 100ms), elapsed %fms\n",
+		igt_debug("loop %lu: interval=%fms (target 100ms), elapsed %fms\n",
 			  loops,
 			  igt_nsec_elapsed(&itv) * 1e-6,
 			  igt_nsec_elapsed(&tv) * 1e-6);
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 06/12] lib: prefix frame_dump_path
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (3 preceding siblings ...)
  2017-09-02 17:03 ` [PATCH i-g-t 05/12] tests/gem_spin_batch: Fix warning Daniel Vetter
@ 2017-09-02 17:04 ` Daniel Vetter
  2017-09-02 17:04 ` [PATCH i-g-t 07/12] lib: clean up header includes Daniel Vetter
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Just a bit of ocd for anything non-static.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 lib/igt_core.c  | 12 ++++++------
 lib/igt_core.h  |  2 +-
 lib/igt_frame.c | 10 +++++-----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index cf15db69c661..017c63048f1e 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -295,7 +295,7 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
 GKeyFile *igt_key_file;
 #endif
 
-char *frame_dump_path;
+char *igt_frame_dump_path;
 
 const char *igt_test_name(void)
 {
@@ -650,10 +650,10 @@ static void common_init_config(void)
 
 	g_clear_error(&error);
 
-	if (!frame_dump_path)
-		frame_dump_path = g_key_file_get_string(igt_key_file, "Common",
-							"FrameDumpPath",
-							&error);
+	if (!igt_frame_dump_path)
+		igt_frame_dump_path =
+			g_key_file_get_string(igt_key_file, "Common",
+					      "FrameDumpPath", &error);
 
 	g_clear_error(&error);
 
@@ -694,7 +694,7 @@ static void common_init_env(void)
 			igt_log_level = IGT_LOG_NONE;
 	}
 
-	frame_dump_path = getenv("IGT_FRAME_DUMP_PATH");
+	igt_frame_dump_path = getenv("IGT_FRAME_DUMP_PATH");
 }
 
 static int common_init(int *argc, char **argv,
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 619c45c6df90..516980e84740 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -50,7 +50,7 @@
 extern const char* __igt_test_description __attribute__((weak));
 extern bool __igt_plain_output;
 extern GKeyFile *igt_key_file;
-extern char *frame_dump_path;
+extern char *igt_frame_dump_path;
 
 /**
  * IGT_TEST_DESCRIPTION:
diff --git a/lib/igt_frame.c b/lib/igt_frame.c
index 222a45f801f3..0f6bca243e39 100644
--- a/lib/igt_frame.c
+++ b/lib/igt_frame.c
@@ -53,7 +53,7 @@
  */
 bool igt_frame_dump_is_enabled(void)
 {
-	return frame_dump_path != NULL;
+	return igt_frame_dump_path != NULL;
 }
 
 static void igt_write_frame_to_png(cairo_surface_t *surface, int fd,
@@ -70,11 +70,11 @@ static void igt_write_frame_to_png(cairo_surface_t *surface, int fd,
 
 	if (suffix)
 		snprintf(path, PATH_MAX, "%s/frame-%s-%s-%s-%s.png",
-			 frame_dump_path, test_name, subtest_name, qualifier,
+			 igt_frame_dump_path, test_name, subtest_name, qualifier,
 			 suffix);
 	else
 		snprintf(path, PATH_MAX, "%s/frame-%s-%s-%s.png",
-			 frame_dump_path, test_name, subtest_name, qualifier);
+			 igt_frame_dump_path, test_name, subtest_name, qualifier);
 
 	igt_debug("Dumping %s frame to %s...\n", qualifier, path);
 
@@ -122,10 +122,10 @@ void igt_write_compared_frames_to_png(cairo_surface_t *reference,
 
 	if (id)
 		snprintf(path, PATH_MAX, "%s/frame-%s-%s-%s.txt",
-			 frame_dump_path, test_name, subtest_name, id);
+			 igt_frame_dump_path, test_name, subtest_name, id);
 	else
 		snprintf(path, PATH_MAX, "%s/frame-%s-%s.txt",
-			 frame_dump_path, test_name, subtest_name);
+			 igt_frame_dump_path, test_name, subtest_name);
 
 	fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
 	igt_assert(fd >= 0);
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 07/12] lib: clean up header includes
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (4 preceding siblings ...)
  2017-09-02 17:04 ` [PATCH i-g-t 06/12] lib: prefix frame_dump_path Daniel Vetter
@ 2017-09-02 17:04 ` Daniel Vetter
  2017-09-02 17:04 ` [PATCH i-g-t 08/12] tests/igt_command_line.sh: Allow testing individual tests Daniel Vetter
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Just a bit of OCD, I like it when connections within library modules
are a bit more obvious. igt.h is ok for tests, but let's use individual
include lines for libraries consistently.

Also order standard includes before igt ones.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 lib/igt_alsa.c      |  3 ++-
 lib/igt_alsa.h      |  1 -
 lib/igt_audio.c     |  3 ++-
 lib/igt_audio.h     |  1 -
 lib/igt_chamelium.c |  6 +++++-
 lib/igt_chamelium.h |  6 +++++-
 lib/igt_dummyload.c | 11 +++++++++--
 lib/igt_frame.c     |  3 ++-
 lib/igt_frame.h     |  1 -
 lib/igt_gvt.c       | 10 +++++-----
 lib/igt_kmod.c      |  6 +++---
 lib/igt_sysfs.h     |  1 +
 lib/igt_vgem.c      | 10 +++++++---
 lib/igt_vgem.h      |  1 +
 14 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/lib/igt_alsa.c b/lib/igt_alsa.c
index b5574c7622a1..3ad0521aa6ee 100644
--- a/lib/igt_alsa.c
+++ b/lib/igt_alsa.c
@@ -28,7 +28,8 @@
 
 #include <alsa/asoundlib.h>
 
-#include "igt.h"
+#include "igt_alsa.h"
+#include "igt_core.h"
 
 #define HANDLES_MAX	8
 
diff --git a/lib/igt_alsa.h b/lib/igt_alsa.h
index 8f7724ad9727..50795130a4f8 100644
--- a/lib/igt_alsa.h
+++ b/lib/igt_alsa.h
@@ -29,7 +29,6 @@
 
 #include "config.h"
 
-#include "igt.h"
 #include <stdbool.h>
 
 struct alsa;
diff --git a/lib/igt_audio.c b/lib/igt_audio.c
index 6b35529aa224..2321d1c6e3f1 100644
--- a/lib/igt_audio.c
+++ b/lib/igt_audio.c
@@ -29,7 +29,8 @@
 #include <math.h>
 #include <gsl/gsl_fft_real.h>
 
-#include "igt.h"
+#include "igt_audio.h"
+#include "igt_core.h"
 
 #define FREQS_MAX	8
 
diff --git a/lib/igt_audio.h b/lib/igt_audio.h
index 21adfee82756..b3b658a4017f 100644
--- a/lib/igt_audio.h
+++ b/lib/igt_audio.h
@@ -29,7 +29,6 @@
 
 #include "config.h"
 
-#include "igt.h"
 #include <stdbool.h>
 
 struct audio_signal;
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index dcd8855f3d1b..fb250366ca2c 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -35,7 +35,11 @@
 #include <pixman.h>
 #include <cairo.h>
 
-#include "igt.h"
+#include "igt_chamelium.h"
+#include "igt_core.h"
+#include "igt_aux.h"
+#include "igt_kms.h"
+#include "igt_frame.h"
 
 /**
  * SECTION:igt_chamelium
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index a2d626eca957..af9655a0b1cf 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -28,8 +28,12 @@
 
 #include "config.h"
 
-#include "igt.h"
 #include <stdbool.h>
+#include <xf86drmMode.h>
+
+#include "igt_debugfs.h"
+
+struct igt_fb;
 
 struct chamelium;
 struct chamelium_port;
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index f2a94b5572ea..a2061ff6138e 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -22,11 +22,18 @@
  *
  */
 
-#include "igt.h"
-#include "igt_dummyload.h"
 #include <time.h>
 #include <signal.h>
 #include <sys/syscall.h>
+#include <sys/mman.h>
+
+#include <i915_drm.h>
+
+#include "igt_dummyload.h"
+#include "igt_gt.h"
+#include "intel_batchbuffer.h"
+#include "intel_chipset.h"
+#include "ioctl_wrappers.h"
 
 /**
  * SECTION:igt_dummyload
diff --git a/lib/igt_frame.c b/lib/igt_frame.c
index 0f6bca243e39..6984c02e9912 100644
--- a/lib/igt_frame.c
+++ b/lib/igt_frame.c
@@ -32,7 +32,8 @@
 #include <gsl/gsl_statistics_double.h>
 #include <gsl/gsl_fit.h>
 
-#include "igt.h"
+#include "igt_frame.h"
+#include "igt_core.h"
 
 /**
  * SECTION:igt_frame
diff --git a/lib/igt_frame.h b/lib/igt_frame.h
index 680ad5bbd293..11f96cbea203 100644
--- a/lib/igt_frame.h
+++ b/lib/igt_frame.h
@@ -29,7 +29,6 @@
 
 #include "config.h"
 
-#include "igt.h"
 #include <stdbool.h>
 
 bool igt_frame_dump_is_enabled(void);
diff --git a/lib/igt_gvt.c b/lib/igt_gvt.c
index a78e98e9f233..acbc349145ce 100644
--- a/lib/igt_gvt.c
+++ b/lib/igt_gvt.c
@@ -21,16 +21,16 @@
  * IN THE SOFTWARE.
  */
 
-#include "igt.h"
-#include "igt_gvt.h"
-#include "igt_sysfs.h"
-#include "igt_kmod.h"
-
 #include <signal.h>
 #include <dirent.h>
 #include <unistd.h>
 #include <fcntl.h>
 
+#include "igt_gvt.h"
+#include "igt_sysfs.h"
+#include "igt_kmod.h"
+#include "drmtest.h"
+
 /**
  * SECTION:igt_gvt
  * @short_description: Graphics virtualization technology library
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 26691e308cbd..58624cd12f32 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -21,13 +21,13 @@
  * IN THE SOFTWARE.
  */
 
-#include "igt.h"
+#include <signal.h>
+#include <errno.h>
+
 #include "igt_core.h"
 #include "igt_sysfs.h"
 #include "igt_kmod.h"
 
-#include <signal.h>
-
 /**
  * SECTION:igt_kmod
  * @short_description: Wrappers around libkmod for module loading/unloading
diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h
index d666438a667a..07e75042307a 100644
--- a/lib/igt_sysfs.h
+++ b/lib/igt_sysfs.h
@@ -26,6 +26,7 @@
 #define __IGT_SYSFS_H__
 
 #include <stdbool.h>
+#include <stdarg.h>
 
 int igt_sysfs_open(int device, int *idx);
 int igt_sysfs_open_parameters(int device);
diff --git a/lib/igt_vgem.c b/lib/igt_vgem.c
index 3dd9621d0459..7f933b23bd4f 100644
--- a/lib/igt_vgem.c
+++ b/lib/igt_vgem.c
@@ -21,10 +21,14 @@
  * IN THE SOFTWARE.
  */
 
-#include "igt.h"
-#include "igt_vgem.h"
-
 #include <sys/mman.h>
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+#include <errno.h>
+
+#include "igt_vgem.h"
+#include "igt_core.h"
+#include "ioctl_wrappers.h"
 
 /**
  * SECTION:igt_vgem
diff --git a/lib/igt_vgem.h b/lib/igt_vgem.h
index 002ad7f09ceb..92045f0e7a81 100644
--- a/lib/igt_vgem.h
+++ b/lib/igt_vgem.h
@@ -25,6 +25,7 @@
 #define IGT_VGEM_H
 
 #include <stdint.h>
+#include <stdbool.h>
 
 struct vgem_bo {
 	uint32_t handle;
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 08/12] tests/igt_command_line.sh: Allow testing individual tests
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (5 preceding siblings ...)
  2017-09-02 17:04 ` [PATCH i-g-t 07/12] lib: clean up header includes Daniel Vetter
@ 2017-09-02 17:04 ` Daniel Vetter
  2017-09-02 17:04 ` [PATCH i-g-t 09/12] lib/uwildmat: Use include paths Daniel Vetter
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

meso will use this to run the tests for all testcases in parallel, for
great speedup!

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/igt_command_line.sh | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index 7f80fc805d37..f98a584a8ea3 100755
--- a/tests/igt_command_line.sh
+++ b/tests/igt_command_line.sh
@@ -37,24 +37,16 @@ fi
 # Manually running this script is possible in the source root or the
 # tests directory.
 
-TESTLISTFILE="$tests_dir/test-list.txt"
-if [ ! -r "$TESTLISTFILE" ]; then
-	tests_dir="tests"
-	TESTLISTFILE="$tests_dir/test-list.txt"
-fi
-
-TESTLIST=`cat $TESTLISTFILE`
-if [ $? -ne 0 ]; then
-	echo "Error: Could not read test lists"
-	exit 99
-fi
-
 fail () {
 	echo "FAIL: $1"
 	exit 1
 }
 
-for test in $TESTLIST; do
+function check_test () {
+	local test
+
+	test=$1
+
 	if [ "$test" = "TESTLIST" -o "$test" = "END" ]; then
 		continue
 	fi
@@ -105,4 +97,25 @@ for test in $TESTLIST; do
 	# check invalid subtest handling
 	echo "  Checking invalid subtest handling..."
 	./$test --run-subtest invalid-subtest > /dev/null 2>&1 && fail $test
+}
+
+TESTLISTFILE="$tests_dir/test-list.txt"
+if [ ! -r "$TESTLISTFILE" ]; then
+	tests_dir="tests"
+	TESTLISTFILE="$tests_dir/test-list.txt"
+fi
+
+TESTLIST=`cat $TESTLISTFILE`
+if [ $? -ne 0 ]; then
+	echo "Error: Could not read test lists"
+	exit 99
+fi
+
+if [[ "$1" != "" ]] ; then
+	check_test $1
+	exit 0
+fi
+
+for test in $TESTLIST; do
+	check_test $test
 done
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 09/12] lib/uwildmat: Use include paths
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (6 preceding siblings ...)
  2017-09-02 17:04 ` [PATCH i-g-t 08/12] tests/igt_command_line.sh: Allow testing individual tests Daniel Vetter
@ 2017-09-02 17:04 ` Daniel Vetter
  2017-09-02 17:04 ` [PATCH i-g-t 10/12] demos: remove Daniel Vetter
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

meson runs gcc from where meson.build that includes those files is,
which means we need to add the directory ourselves.

For automake it doesn't matter, so let's just do it for simplicity.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 lib/uwildmat/uwildmat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/uwildmat/uwildmat.c b/lib/uwildmat/uwildmat.c
index fac2319e1a8c..09155865de7b 100644
--- a/lib/uwildmat/uwildmat.c
+++ b/lib/uwildmat/uwildmat.c
@@ -95,7 +95,7 @@
 
 #include <string.h>
 #include <stdint.h>
-#include "uwildmat.h"
+#include "uwildmat/uwildmat.h"
 
 #define ABORT -1
 
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 10/12] demos: remove
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (7 preceding siblings ...)
  2017-09-02 17:04 ` [PATCH i-g-t 09/12] lib/uwildmat: Use include paths Daniel Vetter
@ 2017-09-02 17:04 ` Daniel Vetter
  2017-09-02 17:04 ` [PATCH i-g-t 11/12] assembler/test: Prep work for meson Daniel Vetter
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

The igt testcase themselves contain plenty of demos, libdrm
also contains a bunch of demos, this here just bitrots.

So let's remove it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 Makefile.am             |   2 +-
 demos/.gitignore        |   1 -
 demos/Android.mk        |  32 --
 demos/Makefile.am       |  12 -
 demos/Makefile.sources  |   7 -
 demos/intel_sprite_on.c | 960 ------------------------------------------------
 6 files changed, 1 insertion(+), 1013 deletions(-)
 delete mode 100644 demos/.gitignore
 delete mode 100644 demos/Android.mk
 delete mode 100644 demos/Makefile.am
 delete mode 100644 demos/Makefile.sources
 delete mode 100644 demos/intel_sprite_on.c

diff --git a/Makefile.am b/Makefile.am
index 601686282c64..8c25402789f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,7 +36,7 @@ if BUILD_SHADER_DEBUGGER
 SUBDIRS += debugger
 endif
 
-SUBDIRS += overlay demos benchmarks
+SUBDIRS += overlay benchmarks
 endif
 
 SUBDIRS += docs
diff --git a/demos/.gitignore b/demos/.gitignore
deleted file mode 100644
index cd80b0b5f259..000000000000
--- a/demos/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-intel_sprite_on
diff --git a/demos/Android.mk b/demos/Android.mk
deleted file mode 100644
index 1f50fdcb7e82..000000000000
--- a/demos/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-#================#
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(demos_prog_lists)
-
-ifeq ($(HAVE_LIBDRM_INTEL),true)
-    LOCAL_SRC_FILES += $(LIBDRM_INTEL_BIN)
-endif
-
-LOCAL_CFLAGS += -DHAVE_TERMIOS_H
-LOCAL_CFLAGS += -DANDROID -UNDEBUG
-LOCAL_CFLAGS += -std=gnu99
-# Excessive complaining for established cases. Rely on the Linux version warnings.
-LOCAL_CFLAGS += -Wno-sign-compare
-
-LOCAL_C_INCLUDES = $(LOCAL_PATH)/../lib \
-                   $(LOCAL_PATH)/../lib/stubs/drm/
-
-LOCAL_MODULE := intel_sprite_on
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_STATIC_LIBRARIES := libintel_gpu_tools
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-include $(BUILD_EXECUTABLE)
-
-#================#
diff --git a/demos/Makefile.am b/demos/Makefile.am
deleted file mode 100644
index 031595c1f52f..000000000000
--- a/demos/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-include Makefile.sources
-
-bin_PROGRAMS = $(demos_prog_list)
-
-if HAVE_LIBDRM_INTEL
-	bin_PROGRAMS += $(LIBDRM_INTEL_BIN)
-endif
-
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
-AM_CFLAGS = $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS) \
-	    $(CAIRO_CFLAGS) $(LIBUNWIND_CFLAGS) $(WERROR_CFLAGS)
-LDADD = $(top_builddir)/lib/libigt.la
diff --git a/demos/Makefile.sources b/demos/Makefile.sources
deleted file mode 100644
index aea363f9ba17..000000000000
--- a/demos/Makefile.sources
+++ /dev/null
@@ -1,7 +0,0 @@
-demos_prog_list =		\
-	$(NULL)
-
-LIBDRM_INTEL_BIN =		\
-	intel_sprite_on		\
-	$(NULL)
-
diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c
deleted file mode 100644
index a3ece09955aa..000000000000
--- a/demos/intel_sprite_on.c
+++ /dev/null
@@ -1,960 +0,0 @@
-/*
- * Copyright © 2012 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.
- *
- *
- * Author:
- *   Armin Reese <armin.c.reese@intel.com>
- */
-
-/*
- * This program is intended for testing sprite functionality.
- */
-#include <assert.h>
-#include <errno.h>
-#include <math.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-
-#include "i915_drm.h"
-#include "drmtest.h"
-#include "igt_kms.h"
-
-#include "ioctl_wrappers.h"
-
-/*
- * Mode setting with the kernel interfaces is a bit of a chore.
- * First you have to find the connector in question and make sure the
- * requested mode is available.
- * Then you need to find the encoder attached to that connector so you
- * can bind it with a free crtc.
- */
-struct connector {
-	uint32_t            id;
-	int                 mode_valid;
-	drmModeModeInfo     mode;
-	drmModeEncoder      *encoder;
-	drmModeConnector    *connector;
-	int                 crtc;
-	int                 pipe;
-};
-
-static void dump_mode(drmModeModeInfo *mode)
-{
-	printf("  %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d\n",
-		mode->name,
-		mode->vrefresh,
-		mode->hdisplay,
-		mode->hsync_start,
-		mode->hsync_end,
-		mode->htotal,
-		mode->vdisplay,
-		mode->vsync_start,
-		mode->vsync_end,
-		mode->vtotal,
-		mode->flags,
-		mode->type,
-		mode->clock);
-}
-
-static void dump_connectors(int gfx_fd, drmModeRes *resources)
-{
-	int i, j;
-
-	printf("Connectors:\n");
-	printf("id\tencoder\tstatus\t\ttype\tsize (mm)\tmodes\n");
-	for (i = 0; i < resources->count_connectors; i++) {
-		drmModeConnector *connector;
-
-		connector = drmModeGetConnector(gfx_fd, resources->connectors[i]);
-		if (!connector) {
-			printf("could not get connector %i: %s\n",
-					resources->connectors[i], strerror(errno));
-			continue;
-		}
-
-		printf("%d\t%d\t%s\t%s\t%dx%d\t\t%d\n",
-			connector->connector_id,
-			connector->encoder_id,
-			kmstest_connector_status_str(connector->connection),
-			kmstest_connector_type_str(connector->connector_type),
-			connector->mmWidth, connector->mmHeight,
-			connector->count_modes);
-
-		if (!connector->count_modes)
-			continue;
-
-		printf("  modes:\n");
-		printf("  name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot flags type clock\n");
-		for (j = 0; j < connector->count_modes; j++)
-			dump_mode(&connector->modes[j]);
-
-		drmModeFreeConnector(connector);
-	}
-	printf("\n");
-}
-
-static void dump_crtcs(int gfx_fd, drmModeRes *resources)
-{
-	int i;
-
-	printf("CRTCs:\n");
-	printf("id\tfb\tpos\tsize\n");
-	for (i = 0; i < resources->count_crtcs; i++) {
-		drmModeCrtc *crtc;
-
-		crtc = drmModeGetCrtc(gfx_fd, resources->crtcs[i]);
-		if (!crtc) {
-			printf("could not get crtc %i: %s\n",
-				resources->crtcs[i],
-				strerror(errno));
-			continue;
-		}
-		printf("%d\t%d\t(%d,%d)\t(%dx%d)\n",
-			crtc->crtc_id,
-			crtc->buffer_id,
-			crtc->x, crtc->y,
-			crtc->width, crtc->height);
-		dump_mode(&crtc->mode);
-
-		drmModeFreeCrtc(crtc);
-	}
-	printf("\n");
-}
-
-static void dump_planes(int gfx_fd, drmModeRes *resources)
-{
-	drmModePlaneRes             *plane_resources;
-	drmModePlane                *ovr;
-	int i;
-
-	plane_resources = drmModeGetPlaneResources(gfx_fd);
-	if (!plane_resources) {
-		printf("drmModeGetPlaneResources failed: %s\n",
-			strerror(errno));
-		return;
-	}
-
-	printf("Planes:\n");
-	printf("id\tcrtc\tfb\tCRTC x,y\tx,y\tgamma size\n");
-	for (i = 0; i < plane_resources->count_planes; i++) {
-		ovr = drmModeGetPlane(gfx_fd, plane_resources->planes[i]);
-		if (!ovr) {
-			printf("drmModeGetPlane failed: %s\n",
-				strerror(errno));
-			continue;
-		}
-
-		printf("%d\t%d\t%d\t%d,%d\t\t%d,%d\t%d\n",
-			ovr->plane_id, ovr->crtc_id, ovr->fb_id,
-			ovr->crtc_x, ovr->crtc_y, ovr->x, ovr->y,
-			ovr->gamma_size);
-
-		drmModeFreePlane(ovr);
-	}
-	printf("\n");
-
-	return;
-}
-
-static void connector_find_preferred_mode(int gfx_fd,
-					  drmModeRes *gfx_resources,
-					  struct connector *c)
-{
-	drmModeConnector *connector;
-	drmModeEncoder *encoder = NULL;
-	int i, j;
-
-	/* First, find the connector & mode */
-	c->mode_valid = 0;
-	connector = drmModeGetConnector(gfx_fd, c->id);
-	if (!connector) {
-		printf("could not get connector %d: %s\n",
-			c->id,
-			strerror(errno));
-		drmModeFreeConnector(connector);
-		return;
-	}
-
-	if (connector->connection != DRM_MODE_CONNECTED) {
-		drmModeFreeConnector(connector);
-		return;
-	}
-
-	if (!connector->count_modes) {
-		printf("connector %d has no modes\n",
-			c->id);
-		drmModeFreeConnector(connector);
-		return;
-	}
-
-	if (connector->connector_id != c->id) {
-		printf("connector id doesn't match (%d != %d)\n",
-			connector->connector_id,
-			c->id);
-		drmModeFreeConnector(connector);
-		return;
-	}
-
-	for (j = 0; j < connector->count_modes; j++) {
-		c->mode = connector->modes[j];
-		if (c->mode.type & DRM_MODE_TYPE_PREFERRED) {
-			c->mode_valid = 1;
-			break;
-		}
-	}
-
-	if (!c->mode_valid) {
-		if (connector->count_modes > 0) {
-			/* use the first mode as test mode */
-			c->mode = connector->modes[0];
-			c->mode_valid = 1;
-		} else {
-			printf("failed to find any modes on connector %d\n",
-				c->id);
-			return;
-		}
-	}
-
-	/* Now get the encoder */
-	for (i = 0; i < connector->count_encoders; i++) {
-		encoder = drmModeGetEncoder(gfx_fd, connector->encoders[i]);
-
-		if (!encoder) {
-			printf("could not get encoder %i: %s\n",
-				gfx_resources->encoders[i],
-				strerror(errno));
-			drmModeFreeEncoder(encoder);
-			continue;
-		}
-
-		break;
-	}
-
-	c->encoder = encoder;
-
-	if (i == gfx_resources->count_encoders) {
-		printf("failed to find encoder\n");
-		c->mode_valid = 0;
-		return;
-	}
-
-	/* Find first CRTC not in use */
-	for (i = 0; i < gfx_resources->count_crtcs; i++) {
-		if (gfx_resources->crtcs[i] && (c->encoder->possible_crtcs & (1<<i)))
-			break;
-	}
-	c->crtc = gfx_resources->crtcs[i];
-	c->pipe = i;
-
-	gfx_resources->crtcs[i] = 0;
-
-	c->connector = connector;
-}
-
-static int connector_find_plane(int gfx_fd, struct connector *c,
-				unsigned int **sprite_plane_id)
-{
-	drmModePlaneRes *plane_resources;
-	drmModePlane *ovr;
-	int i, sprite_plane_count = 0;
-
-	plane_resources = drmModeGetPlaneResources(gfx_fd);
-	if (!plane_resources) {
-		printf("drmModeGetPlaneResources failed: %s\n",
-			strerror(errno));
-		return 0;
-	}
-
-	/* Allocating buffer to hold sprite plane ids of the
-         * current connector.
-         */
-	*sprite_plane_id = (unsigned int *) malloc(plane_resources->count_planes *
-						   sizeof(unsigned int));
-
-	for (i = 0; i < plane_resources->count_planes; i++) {
-		ovr = drmModeGetPlane(gfx_fd, plane_resources->planes[i]);
-		if (!ovr) {
-			printf("drmModeGetPlane failed: %s\n",
-				strerror(errno));
-			continue;
-		}
-		/* Add the available sprite id to the buffer sprite_plane_id.
-                 */
-		if (ovr->possible_crtcs & (1 << c->pipe)) {
-			(*sprite_plane_id)[sprite_plane_count++] = ovr->plane_id;
-		}
-		drmModeFreePlane(ovr);
-	}
-
-	return sprite_plane_count;
-}
-
-static int prepare_primary_surface(int fd, int prim_width, int prim_height,
-				   uint32_t *prim_handle, uint32_t *prim_stride,
-				   uint32_t *prim_size, int tiled)
-{
-	uint32_t                        bytes_per_pixel = sizeof(uint32_t);
-	uint32_t                        *prim_fb_ptr;
-
-	if (bytes_per_pixel != sizeof(uint32_t)) {
-		printf("Bad bytes_per_pixel for primary surface: %d\n",
-			bytes_per_pixel);
-		return -EINVAL;
-	}
-
-	if (tiled) {
-		int                         v;
-
-		/* Round the tiling up to the next power-of-two and the
-		 * region up to the next pot fence size so that this works
-		 * on all generations.
-		 *
-		 * This can still fail if the framebuffer is too large to
-		 * be tiled. But then that failure is expected.
-		 */
-
-		v = prim_width * bytes_per_pixel;
-		for (*prim_stride = 512; *prim_stride < v; *prim_stride *= 2)
-			;
-
-		v = *prim_stride * prim_height;
-		for (*prim_size = 1024*1024; *prim_size < v; *prim_size *= 2)
-			;
-	} else {
-		/* Scan-out has a 64 byte alignment restriction */
-		*prim_stride = (prim_width * bytes_per_pixel + 63) & ~63;
-		*prim_size = *prim_stride * prim_height;
-	}
-
-	*prim_handle = gem_create(fd, *prim_size);
-
-	if (tiled)
-		gem_set_tiling(fd, *prim_handle, I915_TILING_X, *prim_stride);
-
-	prim_fb_ptr = __gem_mmap__gtt(fd, *prim_handle, *prim_size, PROT_READ | PROT_WRITE);
-
-	if (prim_fb_ptr != NULL) {
-		// Write primary surface with gray background
-		memset(prim_fb_ptr, 0x3f, *prim_size);
-		munmap(prim_fb_ptr, *prim_size);
-	}
-
-	return 0;
-}
-
-static void fill_sprite(int sprite_width, int sprite_height, int sprite_stride,
-			int sprite_index, void *sprite_fb_ptr)
-{
-	__u32                           *pLinePat0,
-					*pLinePat1,
-					*pLinePtr;
-	int                             i,
-					line;
-	int                             stripe_width;
-
-	stripe_width = ((sprite_width > 64) &&
-			(sprite_height > 64)) ? (sprite_index + 1) * 8 :
-		(sprite_index + 1) * 2;
-
-	// Note:  sprite_stride is in bytes.  pLinePat0 and pLinePat1
-	//        are both __u32 pointers
-	pLinePat0 = sprite_fb_ptr;
-	pLinePat1 = pLinePat0 + (stripe_width * (sprite_stride / sizeof(*pLinePat0)));
-
-	for (i = 0; i < sprite_width; i++) {
-		*(pLinePat0 + i) = ((i / stripe_width) & 0x1) ? 0 : ~0;
-		*(pLinePat1 + i) = ~(*(pLinePat0 + i));
-	}
-
-	for (line = 1; line < sprite_height; line++) {
-		if (line == stripe_width) {
-			continue;
-		}
-
-		pLinePtr = ((line / stripe_width) & 0x1) ? pLinePat1 : pLinePat0;
-		memcpy( pLinePat0 + ((sprite_stride / sizeof(*pLinePat0)) * line),
-				pLinePtr,
-				sprite_width * sizeof(*pLinePat0));
-	}
-
-	return;
-}
-
-static int prepare_sprite_surfaces(int fd, int sprite_width, int sprite_height,
-				   uint32_t num_surfaces, uint32_t *sprite_handles,
-				   uint32_t *sprite_stride, uint32_t *sprite_size,
-				   int tiled)
-{
-	uint32_t                        bytes_per_pixel = sizeof(uint32_t);
-	uint32_t                        *sprite_fb_ptr;
-	int                             i;
-
-	if (bytes_per_pixel != sizeof(uint32_t)) {
-		printf("Bad bytes_per_pixel for sprite: %d\n", bytes_per_pixel);
-		return -EINVAL;
-	}
-
-	if (tiled) {
-		int                         v;
-
-		/* Round the tiling up to the next power-of-two and the
-		 * region up to the next pot fence size so that this works
-		 * on all generations.
-		 *
-		 * This can still fail if the framebuffer is too large to
-		 * be tiled. But then that failure is expected.
-		 */
-
-		v = sprite_width * bytes_per_pixel;
-		for (*sprite_stride = 512; *sprite_stride < v; *sprite_stride *= 2)
-			;
-
-		v = *sprite_stride * sprite_height;
-		for (*sprite_size = 1024*1024; *sprite_size < v; *sprite_size *= 2)
-			;
-	} else {
-		/* Scan-out has a 64 byte alignment restriction */
-		*sprite_stride = (sprite_width * bytes_per_pixel + 63) & ~63;
-		*sprite_size = *sprite_stride * sprite_height;
-	}
-
-	for (i = 0; i < num_surfaces;  i++) {
-		// Create the sprite surface
-		sprite_handles[i] = gem_create(fd, *sprite_size);
-
-		if (tiled)
-			gem_set_tiling(fd, sprite_handles[i], I915_TILING_X, *sprite_stride);
-
-		// Get pointer to the surface
-		sprite_fb_ptr = __gem_mmap__gtt(fd,
-				sprite_handles[i], *sprite_size,
-				PROT_READ | PROT_WRITE);
-
-		if (sprite_fb_ptr != NULL) {
-			// Fill with checkerboard pattern
-			fill_sprite(sprite_width, sprite_height, *sprite_stride, i, sprite_fb_ptr);
-
-			munmap(sprite_fb_ptr, *sprite_size);
-		} else {
-			i--;
-			while (i >= 0) {
-				gem_close(fd, sprite_handles[i]);
-				i--;
-			}
-		}
-	}
-
-	return 0;
-}
-
-static void ricochet(int tiled, int sprite_w, int sprite_h,
-		     int out_w, int out_h, int dump_info)
-{
-	int                                 ret;
-	int                                 gfx_fd;
-	int                                 keep_moving;
-	const int                           num_surfaces = 3;
-	uint32_t                            sprite_handles[num_surfaces];
-	uint32_t                            sprite_fb_id[num_surfaces];
-	int                                 *sprite_x = NULL;
-	int                                 *sprite_y = NULL;
-	uint32_t                            sprite_stride;
-	uint32_t                            sprite_size;
-	uint32_t                            handles[4],
-					    pitches[4],
-					    offsets[4]; /* we only use [0] */
-	uint32_t                            prim_width,
-					    prim_height,
-					    prim_handle,
-					    prim_stride,
-					    prim_size,
-					    prim_fb_id;
-	struct drm_intel_sprite_colorkey    set;
-	struct connector                    curr_connector;
-	drmModeRes                          *gfx_resources;
-	struct termios                      orig_term,
-					    curr_term;
-	int                                 c_index;
-	int                                 sprite_index;
-	unsigned int                        *sprite_plane_id = NULL;
-	uint32_t                            plane_flags = 0;
-	int                                 *delta_x = NULL,
-					    *delta_y = NULL;
-	struct timeval                      stTimeVal;
-	long long                           currTime,
-	     prevFlipTime,
-	     prevMoveTime,
-	     deltaFlipTime,
-	     deltaMoveTime,
-	     SleepTime;
-	char                                key;
-	int				    sprite_plane_count = 0;
-	int 				    i;
-	int 				    found_count = 0;
-
-	// Open up I915 graphics device
-	gfx_fd = drmOpen("i915", NULL);
-	if (gfx_fd < 0) {
-		printf("Failed to load i915 driver: %s\n", strerror(errno));
-		return;
-	}
-
-	// Obtain pointer to struct containing graphics resources
-	gfx_resources = drmModeGetResources(gfx_fd);
-	if (!gfx_resources) {
-		printf("drmModeGetResources failed: %s\n", strerror(errno));
-		return;
-	}
-
-	if (dump_info != 0) {
-		dump_connectors(gfx_fd, gfx_resources);
-		dump_crtcs(gfx_fd, gfx_resources);
-		dump_planes(gfx_fd, gfx_resources);
-	}
-
-	// Save previous terminal settings
-	if (tcgetattr( 0, &orig_term) != 0) {
-		printf("tcgetattr failure: %s\n",
-				strerror(errno));
-		return;
-	}
-
-	// Set up input to return characters immediately
-	curr_term = orig_term;
-	curr_term.c_lflag &= ~(ICANON | ECHO | ECHONL);
-	curr_term.c_cc[VMIN] = 0;       // No minimum number of characters
-	curr_term.c_cc[VTIME] = 0 ;     // Return immediately, even if
-	// nothing has been entered.
-	if (tcsetattr( 0, TCSANOW, &curr_term) != 0) {
-		printf("tcgetattr failure: %s\n", strerror(errno));
-		return;
-	}
-
-	// Cycle through all connectors and display the flying sprite
-	// where there are displays attached and the hardware will support it.
-	for (c_index = 0; c_index < gfx_resources->count_connectors; c_index++)  {
-		curr_connector.id = gfx_resources->connectors[c_index];
-
-		// Find the native (preferred) display mode
-		connector_find_preferred_mode(gfx_fd, gfx_resources, &curr_connector);
-		if (curr_connector.mode_valid == 0) {
-
-			if (((c_index + 1) == gfx_resources->count_connectors) &&
-			    (found_count == 0))
-				printf("Failed to find any valid connections.\n");
-			continue;
-		}
-
-		found_count++;
-
-		// Determine if sprite hardware is available on pipe
-		// associated with this connector.
-		sprite_plane_count = connector_find_plane(gfx_fd, &curr_connector,
-							  &sprite_plane_id);
-		if (!sprite_plane_count) {
-			printf("Failed to find sprite plane on crtc\n");
-			goto out;
-		}
-
-		// Width and height of preferred mode
-		prim_width = curr_connector.mode.hdisplay;
-		prim_height = curr_connector.mode.vdisplay;
-
-		// Allocate and fill memory for primary surface
-		ret = prepare_primary_surface(
-				gfx_fd,
-				prim_width,
-				prim_height,
-				&prim_handle,
-				&prim_stride,
-				&prim_size,
-				tiled);
-		if (ret != 0) {
-			printf("Failed to add primary fb (%dx%d): %s\n",
-				prim_width, prim_height, strerror(errno));
-			goto out;
-		}
-
-		// Add the primary surface framebuffer
-		ret = drmModeAddFB(gfx_fd, prim_width, prim_height, 24, 32,
-				   prim_stride, prim_handle, &prim_fb_id);
-		gem_close(gfx_fd, prim_handle);
-
-		if (ret != 0) {
-			printf("Failed to add primary fb (%dx%d): %s\n",
-					prim_width, prim_height, strerror(errno));
-			goto out;
-		}
-
-		// Allocate and fill sprite surfaces
-		ret = prepare_sprite_surfaces(gfx_fd, sprite_w, sprite_h, num_surfaces,
-					      &sprite_handles[0],
-					      &sprite_stride, &sprite_size,
-					      tiled);
-		if (ret != 0) {
-			printf("Preparation of sprite surfaces failed %dx%d\n",
-				sprite_w, sprite_h);
-			goto out;
-		}
-
-		// Add the sprite framebuffers
-		for (sprite_index = 0; sprite_index < num_surfaces; sprite_index++) {
-			handles[0] = sprite_handles[sprite_index];
-			handles[1] = handles[0];
-			handles[2] = handles[0];
-			handles[3] = handles[0];
-			pitches[0] = sprite_stride;
-			pitches[1] = sprite_stride;
-			pitches[2] = sprite_stride;
-			pitches[3] = sprite_stride;
-			memset(offsets, 0, sizeof(offsets));
-
-			ret = drmModeAddFB2(gfx_fd, sprite_w, sprite_h,
-					    DRM_FORMAT_XRGB8888,
-					    handles, pitches, offsets,
-					    &sprite_fb_id[sprite_index], plane_flags);
-			gem_close(gfx_fd, sprite_handles[sprite_index]);
-
-			if (ret) {
-				printf("Failed to add sprite fb (%dx%d): %s\n",
-				       sprite_w, sprite_h, strerror(errno));
-
-				sprite_index--;
-				while (sprite_index >= 0) {
-					drmModeRmFB(gfx_fd, sprite_fb_id[sprite_index]);
-					sprite_index--;
-				}
-				goto out;
-			}
-		}
-
-		if (dump_info != 0) {
-			printf("Displayed Mode Connector struct:\n"
-				"    .id = %d\n"
-				"    .mode_valid = %d\n"
-				"    .crtc = %d\n"
-				"    .pipe = %d\n"
-				"    drmModeModeInfo ...\n"
-				"        .name = %s\n"
-				"        .type = %d\n"
-				"        .flags = %08x\n"
-				"    drmModeEncoder ...\n"
-				"        .encoder_id = %d\n"
-				"        .encoder_type = %d (%s)\n"
-				"        .crtc_id = %d\n"
-				"        .possible_crtcs = %d\n"
-				"        .possible_clones = %d\n"
-				"    drmModeConnector ...\n"
-				"        .connector_id = %d\n"
-				"        .encoder_id = %d\n"
-				"        .connector_type = %d (%s)\n"
-				"        .connector_type_id = %d\n\n",
-				curr_connector.id,
-				curr_connector.mode_valid,
-				curr_connector.crtc,
-				curr_connector.pipe,
-				curr_connector.mode.name,
-				curr_connector.mode.type,
-				curr_connector.mode.flags,
-				curr_connector.encoder->encoder_id,
-				curr_connector.encoder->encoder_type,
-				kmstest_encoder_type_str(curr_connector.encoder->encoder_type),
-				curr_connector.encoder->crtc_id,
-				curr_connector.encoder->possible_crtcs,
-				curr_connector.encoder->possible_clones,
-				curr_connector.connector->connector_id,
-				curr_connector.connector->encoder_id,
-				curr_connector.connector->connector_type,
-				kmstest_connector_type_str(curr_connector.connector->connector_type),
-				curr_connector.connector->connector_type_id);
-
-			printf("Sprite surface dimensions = %dx%d\n"
-				"Sprite output dimensions = %dx%d\n"
-				"Press any key to continue >\n",
-				sprite_w, sprite_h, out_w, out_h);
-
-			// Wait for a key-press
-			while( read(0, &key, 1) == 0);
-			// Purge unread characters
-			tcflush(0, TCIFLUSH);
-		}
-
-		// Set up the primary display mode
-		ret = drmModeSetCrtc(gfx_fd, curr_connector.crtc, prim_fb_id,
-				     0, 0, &curr_connector.id, 1, &curr_connector.mode);
-		if (ret != 0) {
-			printf("Failed to set mode (%dx%d@%dHz): %s\n",
-				prim_width, prim_height, curr_connector.mode.vrefresh,
-				strerror(errno));
-			continue;
-		}
-
-		// Set the sprite colorkey state
-		for(i = 0; i < sprite_plane_count; i++) {
-			set.plane_id = sprite_plane_id[i];
-			set.min_value = 0;
-			set.max_value = 0;
-			set.flags = I915_SET_COLORKEY_NONE;
-			ret = drmCommandWrite(gfx_fd, DRM_I915_SET_SPRITE_COLORKEY, &set,
-					      sizeof(set));
-			assert(ret == 0);
-		}
-
-		// Set up sprite output dimensions, initial position, etc.
-		if (out_w > prim_width / 2)
-			out_w = prim_width / 2;
-		if (out_h > prim_height / 2)
-			out_h = prim_height / 2;
-
-		delta_x = (int *) malloc(sprite_plane_count * sizeof(int));
-		delta_y = (int *) malloc(sprite_plane_count * sizeof(int));
-		sprite_x = (int *) malloc(sprite_plane_count * sizeof(int));
-		sprite_y = (int *) malloc(sprite_plane_count * sizeof(int));
-
-		/* Initializing the coordinates (x,y) of the available sprites on the
-		 * connector, equally spaced along the diagonal of the rectangle
-		 * {(0,0),(prim_width/2, prim_height/2)}.
-		 */
-		for(i = 0; i < sprite_plane_count; i++) {
-			delta_x[i] = 3;
-			delta_y[i] = 4;
-			sprite_x[i] = i * (prim_width / (2 * sprite_plane_count));
-			sprite_y[i] = i * (prim_height / (2 * sprite_plane_count));
-		}
-
-		currTime = 0;
-		prevFlipTime = 0;       // Will force immediate sprite flip
-		prevMoveTime = 0;       // Will force immediate sprite move
-		deltaFlipTime = 500000; // Flip sprite surface every 1/2 second
-		deltaMoveTime = 100000; // Move sprite every 100 ms
-		sprite_index = num_surfaces - 1;
-		keep_moving = 1;
-
-		// Bounce sprite off the walls
-		while (keep_moving) {
-			// Obtain system time in usec.
-			if (gettimeofday( &stTimeVal, NULL ) != 0)
-				printf("gettimeofday error: %s\n", strerror(errno));
-			else
-				currTime = ((long long)stTimeVal.tv_sec * 1000000) + stTimeVal.tv_usec;
-
-			// Check if it's time to flip the sprite surface
-			if (currTime - prevFlipTime > deltaFlipTime) {
-				sprite_index = (sprite_index + 1) % num_surfaces;
-
-				prevFlipTime = currTime;
-			}
-
-			// Move the sprite on the screen and flip
-			// the surface if the index has changed
-			// NB: sprite_w and sprite_h must be 16.16 fixed point, herego << 16
-			for(i = 0; i < sprite_plane_count; i++) {
-				if (drmModeSetPlane(gfx_fd, sprite_plane_id[i],
-						    curr_connector.crtc,
-						    sprite_fb_id[sprite_index],
-						    plane_flags,
-						    sprite_x[i], sprite_y[i],
-						    out_w, out_h,
-						    0, 0,
-						    sprite_w << 16, sprite_h << 16))
-					printf("Failed to enable sprite plane: %s\n",
-						strerror(errno));
-			}
-
-			// Check if it's time to move the sprite surface
-			if (currTime - prevMoveTime > deltaMoveTime)  {
-
-				// Compute the next position for sprite
-				for(i = 0; i < sprite_plane_count; i++) {
-					sprite_x[i] += delta_x[i];
-					sprite_y[i] += delta_y[i];
-					if (sprite_x[i] < 0) {
-						sprite_x[i] = 0;
-						delta_x[i] = -delta_x[i];
-					}
-					else if (sprite_x[i] > prim_width - out_w) {
-						sprite_x[i] = prim_width - out_w;
-						delta_x[i] = -delta_x[i];
-					}
-
-					if (sprite_y[i] < 0) {
-						sprite_y[i] = 0;
-						delta_y[i] = -delta_y[i];
-					}
-					else if (sprite_y[i] > prim_height - out_h) {
-						sprite_y[i] = prim_height - out_h;
-						delta_y[i] = -delta_y[i];
-					}
-				}
-				prevMoveTime = currTime;
-			}
-
-			// Fetch a key from input (non-blocking)
-			if (read(0, &key, 1) == 1) {
-				switch (key) {
-				case 'q':       // Kill the program
-				case 'Q':
-					goto out;
-					break;
-				case 's':       // Slow down sprite movement;
-					deltaMoveTime = (deltaMoveTime * 100) / 90;
-					if (deltaMoveTime > 800000) {
-						deltaMoveTime = 800000;
-					}
-					break;
-				case 'S':       // Speed up sprite movement;
-					deltaMoveTime = (deltaMoveTime * 100) / 110;
-					if (deltaMoveTime < 2000) {
-						deltaMoveTime = 2000;
-					}
-					break;
-				case 'f':       // Slow down sprite flipping;
-					deltaFlipTime = (deltaFlipTime * 100) / 90;
-					if (deltaFlipTime > 1000000)
-						deltaFlipTime = 1000000;
-					break;
-				case 'F':       // Speed up sprite flipping;
-					deltaFlipTime = (deltaFlipTime * 100) / 110;
-					if (deltaFlipTime < 20000)
-						deltaFlipTime = 20000;
-					break;
-				case 'n':       // Next connector
-				case 'N':
-					keep_moving = 0;
-					break;
-				default:
-					break;
-				}
-
-				// Purge unread characters
-				tcflush(0, TCIFLUSH);
-			}
-
-			// Wait for min of flip or move deltas
-			SleepTime = (deltaFlipTime < deltaMoveTime) ?
-				deltaFlipTime : deltaMoveTime;
-			usleep(SleepTime);
-		}
-
-		free(sprite_plane_id);
-		free(sprite_x);
-		free(sprite_y);
-		free(delta_x);
-		free(delta_y);
-		sprite_plane_id = NULL;
-		sprite_plane_count = 0;
-		sprite_x = sprite_y = delta_x = delta_y = NULL;
-	}
-
-out:
-	// Purge unread characters
-	tcflush(0, TCIFLUSH);
-	// Restore previous terminal settings
-	if (tcsetattr( 0, TCSANOW, &orig_term) != 0) {
-		printf("tcgetattr failure: %s\n", strerror(errno));
-		return;
-	}
-
-	drmModeFreeResources(gfx_resources);
-}
-
-static void usage(char *name)
-{
-	printf("usage: %s -s <plane width>x<plane height> [-dhto]\n"
-		"\t-d\t[optional] dump mode information\n"
-		"\t-h\t[optional] output help message\n"
-		"\t-t\t[optional] enable tiling\n"
-		"\t-o\t[optional] <output rect width>x<output rect height>\n\n"
-		"Keyboard control for sprite movement and flip rate ...\n"
-		"\t'q' or 'Q' - Quit the program\n"
-		"\t'n' or 'N' - Switch to next display\n"
-		"\t's'        - Slow sprite movement\n"
-		"\t'S'        - Speed up sprite movement\n"
-		"\t'f'        - Slow sprite surface flipping\n"
-		"\t'F'        - Speed up sprite surface flipping\n",
-		name);
-}
-
-int main(int argc, char **argv)
-{
-	int                 c;
-	int                 test_overlay = 0,
-			    enable_tiling = 0,
-			    dump_info = 0;
-	int                 plane_width = 0,
-			    plane_height = 0,
-			    out_width = 0,
-			    out_height = 0;
-	static char         optstr[] = "ds:o:th";
-
-	opterr = 0;
-	while ((c = getopt(argc, argv, optstr)) != -1) {
-		switch (c) {
-		case 'd':               // Dump information
-			dump_info = 1;
-			break;
-		case 't':               // Tiling enable
-			enable_tiling = 1;
-			break;
-		case 's':               // Surface dimensions
-			if (sscanf(optarg, "%dx%d", &plane_width, &plane_height) != 2)
-				usage(argv[0]);
-			test_overlay = 1;
-			break;
-		case 'o':               // Output dimensions
-			if (sscanf(optarg, "%dx%d", &out_width, &out_height) != 2)
-				usage(argv[0]);
-			break;
-		default:
-			printf("unknown option %c\n", c);
-			/* fall through */
-		case 'h':               // Help!
-			usage(argv[0]);
-			goto out;
-		}
-	}
-
-	if (test_overlay) {
-		if (out_width < (plane_width / 2))
-			out_width = plane_width;
-
-		if (out_height < (plane_height / 2))
-			out_height = plane_height;
-
-		ricochet(enable_tiling, plane_width, plane_height, out_width, out_height, dump_info);
-	} else {
-		printf("Sprite dimensions are required:\n");
-		usage(argv[0]);
-	}
-
-out:
-	exit(0);
-}
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 11/12] assembler/test: Prep work for meson
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (8 preceding siblings ...)
  2017-09-02 17:04 ` [PATCH i-g-t 10/12] demos: remove Daniel Vetter
@ 2017-09-02 17:04 ` Daniel Vetter
  2017-09-02 17:04 ` [PATCH i-g-t 12/12] RFC: meson build system support Daniel Vetter
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Again we want to be able to run each testcase individually.

Also, we need to make sure the target directory for the temp files
exists - meson always builds with a build-dir outside of the source
tree.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 assembler/test/run-test.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/assembler/test/run-test.sh b/assembler/test/run-test.sh
index 20a408c61b2d..0a5252a89dc7 100644
--- a/assembler/test/run-test.sh
+++ b/assembler/test/run-test.sh
@@ -3,9 +3,17 @@
 SRCDIR=${srcdir-`pwd`}
 BUILDDIR=${top_builddir-`pwd`}
 
-${BUILDDIR}/intel-gen4asm -o TEST.out $SRCDIR/TEST.g4a
-if cmp TEST.out ${SRCDIR}/TEST.expected 2> /dev/null; then : ; else
-  echo "Output comparison for TEST"
-  diff -u ${SRCDIR}/TEST.expected TEST.out
+test="TEST"
+
+if [[ "$1" != "" ]] ; then
+	test="$1"
+fi
+
+test -d ${BUILDDIR}/test || mkdir ${BUILDDIR}/test/
+
+${BUILDDIR}/intel-gen4asm -o ${BUILDDIR}/${test}.out $SRCDIR/${test}.g4a
+if cmp ${BUILDDIR}/${test}.out ${SRCDIR}/${test}.expected 2> /dev/null; then : ; else
+  echo "Output comparison for ${test}"
+  diff -u ${SRCDIR}/${test}.expected ${test}.out
   exit 1;
 fi
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 12/12] RFC: meson build system support
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (9 preceding siblings ...)
  2017-09-02 17:04 ` [PATCH i-g-t 11/12] assembler/test: Prep work for meson Daniel Vetter
@ 2017-09-02 17:04 ` Daniel Vetter
  2017-09-04  9:11   ` Daniel Vetter
  2017-09-04 13:11   ` Jani Nikula
  2017-09-03  9:27 ` [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Chris Wilson
  2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
  12 siblings, 2 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-02 17:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

Why?

Because it's fast.

Like really, really fast.

Some data (from a snb laptop, so rather lower-powered):

- Incremental build after $ touch lib/igt_core.c with meson: 0.6s
  It notices that the symbol list of the libigt.so hasn't changed and
  doesn't bother re-linking the almost 300 binaries we have. make -j 6
  for the same scenario takes 44s.

- Incremental build with nothing changed: make: 0.7s, meson: 0.2s This
  means stuff like --disable-git-hash is entirely pointless with
  meson, it's faster than a make ever can be (with 0.6s).

- Reconfigure stage: ninja reconfigure 0.8s vs. ./configure 8.6s)

- Running tests, after a full build: ninja test 6s vs. make check 24s

- Full build (i.e. including ./autogen.sh respectively meson build),
  including tests, from a pristine git checkout. automake 2m49s vs.
  meson 44s.

TODO:
- cmdline options
- gcc warnings, debug build, how does that work?
- man pages
- gtkdoc

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 .gitignore                       |   1 +
 assembler/meson.build            |  73 ++++++++++
 benchmarks/meson.build           |  36 +++++
 lib/meson.build                  | 166 ++++++++++++++++++++++
 lib/prepend_log_domain.sh        |   8 ++
 lib/tests/meson.build            |  34 +++++
 lib/version.h.in                 |   1 +
 meson.build                      | 105 ++++++++++++++
 overlay/meson.build              |  59 ++++++++
 tests/generate_testlist.sh       |  10 ++
 tests/meson.build                | 290 +++++++++++++++++++++++++++++++++++++++
 tools/meson.build                |  59 ++++++++
 tools/null_state_gen/meson.build |  15 ++
 13 files changed, 857 insertions(+)
 create mode 100644 assembler/meson.build
 create mode 100644 benchmarks/meson.build
 create mode 100644 lib/meson.build
 create mode 100755 lib/prepend_log_domain.sh
 create mode 100644 lib/tests/meson.build
 create mode 100644 lib/version.h.in
 create mode 100644 meson.build
 create mode 100644 overlay/meson.build
 create mode 100755 tests/generate_testlist.sh
 create mode 100644 tests/meson.build
 create mode 100644 tools/meson.build
 create mode 100644 tools/null_state_gen/meson.build

diff --git a/.gitignore b/.gitignore
index 6204965a0e32..e6919272d8b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -93,3 +93,4 @@ intel-gpu-tools-*/
 
 piglit
 results
+build
diff --git a/assembler/meson.build b/assembler/meson.build
new file mode 100644
index 000000000000..bdddd0e2db25
--- /dev/null
+++ b/assembler/meson.build
@@ -0,0 +1,73 @@
+lib_brw_src = [
+	'brw_context.c',
+	'brw_disasm.c',
+	'brw_eu.c',
+	'brw_eu_compact.c',
+	'brw_eu_debug.c',
+	'brw_eu_emit.c',
+	'brw_eu_util.c',
+	'gen8_disasm.c',
+	'gen8_instruction.c',
+	'ralloc.c',
+]
+
+lib_brw = shared_library('brw', lib_brw_src,
+		dependencies : igt_deps)
+
+flex = find_program('flex')
+bison = find_program('bison')
+
+lgen = generator(flex,
+		output : '@BASENAME@.c',
+		arguments : ['-o', '@OUTPUT@', '@INPUT@'])
+
+lfiles = lgen.process('lex.l')
+
+pgen = generator(bison,
+		output : ['@BASENAME@.c', '@BASENAME@.h'],
+		arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
+
+pfiles = pgen.process('gram.y')
+
+executable('intel-gen4asm', 'main.c', lfiles, pfiles, link_with : lib_brw)
+
+executable('intel-gen4disasm', 'disasm-main.c', link_with : lib_brw)
+
+gen4asm_testcases = [
+	'test/mov',
+	'test/frc',
+	'test/rndd',
+	'test/rndu',
+	'test/rnde',
+	'test/rnde-intsrc',
+	'test/rndz',
+	'test/lzd',
+	'test/not',
+	'test/immediate',
+]
+
+# Those tests were already failing when the assembler was imported from
+# the intel-gen4asm git repository:
+#   http://cgit.freedesktop.org/xorg/app/intel-gen4asm/
+# We disable them "for now" as a workaround to be able to release i-g-t
+gen4asm_testcases_broken = [
+	'test/declare',
+	'test/jmpi',
+	'test/if',
+	'test/iff',
+	'test/while',
+	'test/else',
+	'test/break',
+	'test/cont',
+	'test/halt',
+	'test/wait',
+	'test/endif',
+]
+
+test_runner = find_program('test/run-test.sh')
+foreach testcase : gen4asm_testcases
+	test('assembler: ' + testcase, test_runner,
+			args : testcase,
+			env : [ 'srcdir=' + meson.current_source_dir(),
+				'top_builddir=' + meson.current_build_dir()])
+endforeach
diff --git a/benchmarks/meson.build b/benchmarks/meson.build
new file mode 100644
index 000000000000..9ab738f76588
--- /dev/null
+++ b/benchmarks/meson.build
@@ -0,0 +1,36 @@
+benchmark_progs = [
+	'gem_blt',
+	'gem_busy',
+	'gem_create',
+	'gem_exec_ctx',
+	'gem_exec_fault',
+	'gem_exec_nop',
+	'gem_exec_reloc',
+	'gem_exec_trace',
+	'gem_latency',
+	'gem_mmap',
+	'gem_prw',
+	'gem_set_domain',
+	'gem_syslatency',
+	'gem_wsim',
+	'kms_vblank',
+	'prime_lookup',
+	'vgem_mmap',
+]
+
+if libdrm_intel.found()
+	benchmark_progs += [
+		'intel_upload_blit_large',
+		'intel_upload_blit_large_gtt',
+		'intel_upload_blit_large_map',
+		'intel_upload_blit_small',
+		'gem_userptr_benchmark',
+	]
+endif
+
+foreach prog : benchmark_progs
+	# FIXME meson doesn't like binaries with the same name
+	# meanwhile just suffix with _bench
+	executable(prog + '_bench', prog + '.c',
+			dependencies : test_deps)
+endforeach
diff --git a/lib/meson.build b/lib/meson.build
new file mode 100644
index 000000000000..51d3f9e278da
--- /dev/null
+++ b/lib/meson.build
@@ -0,0 +1,166 @@
+lib_headers = [
+	'debug.h',
+	'drmtest.h',
+	'i830_reg.h',
+	'i915_3d.h',
+	'i915_reg.h',
+	'i915_pciids.h',
+	'igt.h',
+	'igt_debugfs.h',
+	'igt_aux.h',
+	'igt_edid_template.h',
+	'igt_gt.h',
+	'igt_gvt.h',
+	'igt_primes.h',
+	'igt_rand.h',
+	'igt_stats.h',
+	'igt_sysfs.h',
+	'igt_x86.h',
+	'igt_vgem.h',
+	'instdone.h',
+	'intel_batchbuffer.h',
+	'intel_chipset.h',
+	'intel_io.h',
+	'intel_reg.h',
+	'ioctl_wrappers.h',
+	'media_fill.h',
+	'media_spin.h',
+	'gpgpu_fill.h',
+	'gen7_media.h',
+	'gen8_media.h',
+	'gen6_render.h',
+	'gen7_render.h',
+	'gen8_render.h',
+	'gen9_render.h',
+	'rendercopy.h',
+	'sw_sync.h',
+	'igt_kms.h',
+	'igt_fb.h',
+	'igt_core.h',
+	'igt_draw.h',
+	'igt_pm.h',
+	'igt_dummyload.h',
+	'uwildmat/uwildmat.h',
+	'igt_kmod.h',
+]
+
+lib_sources = [
+	'drmtest.c',
+	'igt_debugfs.c',
+	'igt_aux.c',
+	'igt_gt.c',
+	'igt_gvt.c',
+	'igt_primes.c',
+	'igt_rand.c',
+	'igt_stats.c',
+	'igt_sysfs.c',
+	'igt_x86.c',
+	'igt_vgem.c',
+	'instdone.c',
+	'intel_batchbuffer.c',
+	'intel_chipset.c',
+	'intel_device_info.c',
+	'intel_os.c',
+	'intel_mmio.c',
+	'ioctl_wrappers.c',
+	'media_fill_gen7.c',
+	'media_fill_gen8.c',
+	'media_fill_gen8lp.c',
+	'media_fill_gen9.c',
+	'media_spin.c',
+	'gpgpu_fill.c',
+	'rendercopy_i915.c',
+	'rendercopy_i830.c',
+	'rendercopy_gen6.c',
+	'rendercopy_gen7.c',
+	'rendercopy_gen8.c',
+	'rendercopy_gen9.c',
+	'sw_sync.c',
+	'intel_reg_map.c',
+	'intel_iosf.c',
+	'igt_kms.c',
+	'igt_fb.c',
+	'igt_core.c',
+	'igt_draw.c',
+	'igt_pm.c',
+	'igt_dummyload.c',
+	'uwildmat/uwildmat.c',
+	'igt_kmod.c',
+]
+
+lib_deps = [
+	cairo,
+	glib,
+	libdrm,
+	libkmod,
+	libprocps,
+	libudev,
+	libunwind,
+	pciaccess,
+	pthreads,
+	math,
+	realtime,
+]
+
+if libdrm_intel.found()
+	lib_deps += libdrm_intel
+else
+	lib_headers += 'stubs/drm/intel_bufmgr.h'
+	lib_sources += 'stubs/drm/intel_bufmgr.c'
+endif
+
+if libdrm_vc4.found()
+	lib_headers += 'igt_vc4.h'
+	lib_sources += 'igt_vc4.c'
+endif
+if valgrind.found()
+	lib_deps += valgrind
+endif
+
+if gsl.found()
+	lib_deps += gsl
+	lib_headers += [ 'igt_frame.h', 'igt_audio.h' ]
+	lib_sources += [ 'igt_frame.c', 'igt_audio.c' ]
+endif
+
+if alsa.found()
+	lib_deps += alsa
+	lib_headers += 'igt_alsa.h'
+	lib_sources += 'igt_alsa.c'
+endif
+
+if chamelium.found()
+	lib_deps += chamelium
+	lib_headers += 'igt_chamelium.h'
+	lib_sources += 'igt_chamelium.c'
+endif
+
+install_headers(lib_headers)
+
+pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'intel-gpu-tools')
+srcdir = join_paths(meson.source_root(), 'tests')
+
+vcs_tag(input : 'version.h.in', output : 'version.h',
+	fallback : 'NO-GIT',
+	command : [ 'git', 'log', '-n1', '--pretty=format:g%h' ] )
+
+# FIXME we don't regenerate when the script changes
+prepend_log_domain = generator(find_program('prepend_log_domain.sh'),
+		arguments : [ '@INPUT@', '@OUTPUT@' ],
+		output : '@PLAINNAME@' + '.pre.c')
+
+processed_src_dep = prepend_log_domain.process(lib_sources)
+
+lib_igt_build = shared_library('igt',
+			 processed_src_dep,
+			 include_directories : inc,
+			 dependencies : lib_deps,
+			 c_args : [ '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
+				'-DIGT_SRCDIR="@0@"'.format(srcdir), ])
+
+lib_igt = declare_dependency(link_with : lib_igt_build,
+			    include_directories : inc)
+
+igt_deps = [ lib_igt ] + lib_deps
+
+subdir('tests')
diff --git a/lib/prepend_log_domain.sh b/lib/prepend_log_domain.sh
new file mode 100755
index 000000000000..93a911508b7f
--- /dev/null
+++ b/lib/prepend_log_domain.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+input=$1
+output=$2
+basename=$(basename $1 .c)
+
+echo "#define IGT_LOG_DOMAIN \"$basename\"" > $output
+cat $input >> $output
diff --git a/lib/tests/meson.build b/lib/tests/meson.build
new file mode 100644
index 000000000000..29bdb2c4222c
--- /dev/null
+++ b/lib/tests/meson.build
@@ -0,0 +1,34 @@
+lib_tests = [
+	'igt_fork_helper',
+	'igt_list_only',
+	'igt_simulation',
+	'igt_stats',
+	'igt_segfault',
+	'igt_subtest_group',
+	'igt_assert',
+	'igt_exit_handler',
+	'igt_hdmi_inject',
+	'igt_can_fail',
+	'igt_can_fail_simple',
+]
+
+lib_fail_tests = [
+	'igt_no_exit',
+	'igt_no_exit_list_only',
+	'igt_no_subtest',
+	'igt_simple_test_subtests',
+	'igt_timeout',
+	'igt_invalid_subtest_name',
+]
+
+foreach lib_test : lib_tests
+	exec = executable(lib_test, lib_test + '.c', install : true,
+			dependencies : igt_deps)
+	test('lib: ' + lib_test, exec)
+endforeach
+
+foreach lib_test : lib_fail_tests
+	exec = executable(lib_test, lib_test + '.c', install : true,
+			dependencies : igt_deps)
+	test('lib: ' + lib_test, exec, should_fail : true)
+endforeach
diff --git a/lib/version.h.in b/lib/version.h.in
new file mode 100644
index 000000000000..72fc6978cf32
--- /dev/null
+++ b/lib/version.h.in
@@ -0,0 +1 @@
+#define IGT_GIT_SHA1 "@VCS_TAG@"
diff --git a/meson.build b/meson.build
new file mode 100644
index 000000000000..fee64fcdf36e
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,105 @@
+project('IGT gpu tests', 'c',
+	version : '1.19',
+        default_options: [
+          'warning_level=2',
+          'c_std=gnu99',
+        ],
+	license : 'MIT')
+
+cc = meson.get_compiler('c')
+
+inc = include_directories('lib', '.')
+
+config_h = configuration_data()
+
+libdrm = dependency('libdrm', version : '>=2.4.82')
+libdrm_intel = dependency('libdrm_intel', required : false)
+libdrm_vc4 = dependency('libdrm_vc4', required : false)
+libdrm_nouveau = dependency('libdrm_nouveau', required : false)
+libdrm_amdgpu = dependency('libdrm_amdgpu', required : false)
+
+pciaccess = dependency('pciaccess', version : '>=0.10')
+libkmod = dependency('libkmod')
+libprocps = dependency('libprocps', required : false)
+if libprocps.found()
+	config_h.set('HAVE_PROCPS', 1)
+endif
+
+valgrind = dependency('valgrind', required : false)
+if valgrind.found()
+	config_h.set('HAVE_VALGRIND', 1)
+endif
+
+cairo = dependency('cairo', version : '>1.12.0', required : false)
+
+libudev = dependency('libudev', required : false)
+if libudev.found()
+	config_h.set('HAVE_UDEV', 1)
+endif
+
+glib = dependency('glib-2.0', required : false)
+if glib.found()
+	config_h.set('HAVE_GLIB', 1)
+endif
+
+libunwind = dependency('libunwind')
+gsl = dependency('gsl', required : false)
+alsa = dependency('alsa', required : false)
+
+pixman = dependency('pixman-1', required : false)
+xmlrpc = dependency('xmlrpc', required : false)
+xmlrpc_util = dependency('xmlrpc_util', required : false)
+xmlrpc_client = dependency('xmlrpc_client', required : false)
+
+if pixman.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()
+	chamelium = declare_dependency(dependencies : [ pixman, xmlrpc,
+	  xmlrpc_util, xmlrpc_client])
+else
+	chamelium = dependency('', required: false)
+endif
+
+pthreads = dependency('threads')
+math = cc.find_library('m')
+realtime = cc.find_library('rt')
+dlsym = cc.find_library('dl')
+zlib = cc.find_library('z')
+
+if cc.has_header('linux/kd.h')
+	config_h.set('HAVE_LINUX_KD_H', 1)
+endif
+if cc.has_header('sys/kd.h')
+	config_h.set('HAVE_SYS_KD_H', 1)
+endif
+if cc.has_header('libgen.h')
+	config_h.set('HAVE_LIBGEN_H', 1)
+endif
+if cc.has_header('sys/io.h')
+	config_h.set('HAVE_SYS_IO_H', 1)
+endif
+if cc.has_header('cpuid.h')
+	# FIXME: Do we need the example link test from configure.ac?
+	config_h.set('HAVE_CPUID_H', 1)
+endif
+
+if cc.has_member('struct sysinfo', 'totalram',
+		prefix : '#include <sys/sysinfo.h>')
+	config_h.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
+endif
+
+add_project_arguments('-D_GNU_SOURCE', language : 'c')
+add_project_arguments('-include', 'config.h', language : 'c')
+
+config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
+config_h.set_quoted('PACKAGE', meson.project_name())
+config_h.set_quoted('TARGET_CPU_PLATFORM', host_machine.cpu_family())
+
+configure_file(output: 'config.h', install: false, configuration: config_h)
+
+subdir('lib')
+subdir('tests')
+subdir('benchmarks')
+subdir('tools')
+if libdrm_intel.found()
+	subdir('assembler')
+	subdir('overlay')
+endif
diff --git a/overlay/meson.build b/overlay/meson.build
new file mode 100644
index 000000000000..a4b778ca5a86
--- /dev/null
+++ b/overlay/meson.build
@@ -0,0 +1,59 @@
+gpu_overlay_src = [
+	'chart.c',
+	'config.c',
+	'cpu-top.c',
+	'debugfs.c',
+	'gem-interrupts.c',
+	'gem-objects.c',
+	'gpu-top.c',
+	'gpu-perf.c',
+	'gpu-freq.c',
+	'igfx.c',
+	'overlay.c',
+	'perf.c',
+	'power.c',
+	'rc6.c',
+]
+
+xv = dependency('xv', required : false)
+x11 = dependency('x11', required : false)
+xext = dependency('xext', required : false)
+dri2proto = dependency('dri2proto', version : '>= 2.6', required : false)
+cairo_xlib = dependency('cairo-xlib', required : false)
+xrandr = dependency('xrandr', version : '>=1.3', required : false)
+
+gpu_overlay_deps = [ realtime, cairo, pciaccess, libdrm, libdrm_intel ]
+
+both_x11_src = ''
+
+gpu_overlay_cflags = []
+if xv.found() and x11.found() and xext.found() and dri2proto.found()
+	both_x11_src = 'x11/position.c'
+	gpu_overlay_src += [
+		'x11/dri2.c',
+		'x11/dri2.h',
+		'x11/rgb2yuv.c',
+		'x11/rgb2yuv.h',
+		'x11/x11-overlay.c',
+	]
+	gpu_overlay_deps += [ xv, x11, xext, dri2proto ]
+	gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XVLIB' ]
+endif
+
+if cairo_xlib.found() and xrandr.found() and dri2proto.found()
+	both_x11_src = 'x11/position.c'
+	gpu_overlay_src += 'x11/x11-window.c'
+	gpu_overlay_deps += [ cairo_xlib, dri2proto ]
+	gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XLIB' ]
+endif
+
+gpu_overlay_src += both_x11_src
+
+gpu_overlay_src += 'kms/kms-overlay.c'
+
+if xrandr.found() and cairo.found()
+	executable('intel_gpu_overlay', gpu_overlay_src,
+			include_directories : inc,
+			c_args : gpu_overlay_cflags,
+			dependencies : gpu_overlay_deps)
+endif
diff --git a/tests/generate_testlist.sh b/tests/generate_testlist.sh
new file mode 100755
index 000000000000..6ea78655daca
--- /dev/null
+++ b/tests/generate_testlist.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+echo TESTLIST > $MESON_BUILD_ROOT/tests/test-list.txt
+
+while [[ $# -gt 0 ]] ; do
+	echo $1 >> $MESON_BUILD_ROOT/tests/test-list.txt
+	shift
+done
+
+echo END TESTLIST >> $MESON_BUILD_ROOT/tests/test-list.txt
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 000000000000..73833758be0e
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,290 @@
+test_progs = [
+	'core_auth',
+	'core_get_client_auth',
+	'core_getclient',
+	'core_getstats',
+	'core_getversion',
+	'core_prop_blob',
+	'core_setmaster_vs_auth',
+	'debugfs_test',
+	'drm_import_export',
+	'drm_mm',
+	'drm_read',
+	'drm_vma_limiter',
+	'drm_vma_limiter_cached',
+	'drm_vma_limiter_cpu',
+	'drm_vma_limiter_gtt',
+	'drv_getparams_basic',
+	'drv_hangman',
+	'drv_missed_irq',
+	'drv_module_reload',
+	'drv_selftest',
+	'drv_suspend',
+	'gem_bad_length',
+	'gem_bad_reloc',
+	'gem_basic',
+	'gem_busy',
+	'gem_caching',
+	'gem_close',
+	'gem_close_race',
+	'gem_concurrent_blit',
+	'gem_cpu_reloc',
+	'gem_create',
+	'gem_cs_prefetch',
+	'gem_cs_tlb',
+	'gem_ctx_bad_destroy',
+	'gem_ctx_bad_exec',
+	'gem_ctx_basic',
+	'gem_ctx_create',
+	'gem_ctx_exec',
+	'gem_ctx_param',
+	'gem_ctx_switch',
+	'gem_ctx_thrash',
+	'gem_double_irq_loop',
+	'gem_eio',
+	'gem_evict_alignment',
+	'gem_evict_everything',
+	'gem_exec_alignment',
+	'gem_exec_async',
+	'gem_exec_await',
+	'gem_exec_bad_domains',
+	'gem_exec_basic',
+	'gem_exec_big',
+	'gem_exec_blt',
+	'gem_exec_capture',
+	'gem_exec_create',
+	'gem_exec_faulting_reloc',
+	'gem_exec_fence',
+	'gem_exec_flush',
+	'gem_exec_gttfill',
+	'gem_exec_latency',
+	'gem_exec_lut_handle',
+	'gem_exec_nop',
+	'gem_exec_parallel',
+	'gem_exec_params',
+	'gem_exec_parse',
+	'gem_exec_reloc',
+	'gem_exec_reuse',
+	'gem_exec_schedule',
+	'gem_exec_store',
+	'gem_exec_suspend',
+	'gem_exec_whisper',
+	'gem_fd_exhaustion',
+	'gem_fence_thrash',
+	'gem_fence_upload',
+	'gem_fenced_exec_thrash',
+	'gem_flink_basic',
+	'gem_flink_race',
+	'gem_gpgpu_fill',
+	'gem_gtt_cpu_tlb',
+	'gem_gtt_hog',
+	'gem_gtt_speed',
+	'gem_hangcheck_forcewake',
+	'gem_largeobject',
+	'gem_linear_blits',
+	'gem_lut_handle',
+	'gem_madvise',
+	'gem_media_fill',
+	'gem_mmap',
+	'gem_mmap_gtt',
+	'gem_mmap_offset_exhaustion',
+	'gem_mmap_wc',
+	'gem_mocs_settings',
+	'gem_partial_pwrite_pread',
+	'gem_persistent_relocs',
+	'gem_pin',
+	'gem_pipe_control_store_loop',
+	'gem_ppgtt',
+	'gem_pread',
+	'gem_pread_after_blit',
+	'gem_pwrite',
+	'gem_pwrite_pread',
+	'gem_pwrite_snooped',
+	'gem_read_read_speed',
+	'gem_readwrite',
+	'gem_reg_read',
+	'gem_reloc_overflow',
+	'gem_reloc_vs_gpu',
+	'gem_render_copy',
+	'gem_render_copy_redux',
+	'gem_render_linear_blits',
+	'gem_render_tiled_blits',
+	'gem_request_retire',
+	'gem_reset_stats',
+	'gem_ring_sync_copy',
+	'gem_ring_sync_loop',
+	'gem_ringfill',
+	'gem_seqno_wrap',
+	'gem_set_tiling_vs_blt',
+	'gem_set_tiling_vs_gtt',
+	'gem_set_tiling_vs_pwrite',
+	'gem_shrink',
+	'gem_softpin',
+	'gem_spin_batch',
+	'gem_stolen',
+	'gem_storedw_batches_loop',
+	'gem_storedw_loop',
+	'gem_streaming_writes',
+	'gem_sync',
+	'gem_threaded_access_tiled',
+	'gem_tiled_blits',
+	'gem_tiled_fence_blits',
+	'gem_tiled_partial_pwrite_pread',
+	'gem_tiled_pread_basic',
+	'gem_tiled_pread_pwrite',
+	'gem_tiled_swapping',
+	'gem_tiled_wb',
+	'gem_tiled_wc',
+	'gem_tiling_max_stride',
+	'gem_unfence_active_buffers',
+	'gem_unref_active_buffers',
+	'gem_userptr_blits',
+	'gem_wait',
+	'gem_workarounds',
+	'gem_write_read_ring_switch',
+	'gen3_mixed_blits',
+	'gen3_render_linear_blits',
+	'gen3_render_mixed_blits',
+	'gen3_render_tiledx_blits',
+	'gen3_render_tiledy_blits',
+	'gen7_forcewake_mt',
+	'gvt_basic',
+	'kms_3d',
+	'kms_addfb_basic',
+	'kms_atomic',
+	'kms_atomic_transition',
+	'kms_busy',
+	'kms_ccs',
+	'kms_chv_cursor_fail',
+	'kms_concurrent',
+	'kms_crtc_background_color',
+	'kms_cursor_crc',
+	'kms_cursor_legacy',
+	'kms_draw_crc',
+	'kms_fbc_crc',
+	'kms_fbcon_fbt',
+	'kms_fence_pin_leak',
+	'kms_flip',
+	'kms_flip_event_leak',
+	'kms_flip_tiling',
+	'kms_force_connector_basic',
+	'kms_frontbuffer_tracking',
+	'kms_hdmi_inject',
+	'kms_invalid_dotclock',
+	'kms_legacy_colorkey',
+	'kms_mmap_write_crc',
+	'kms_mmio_vs_cs_flip',
+	'kms_panel_fitting',
+	'kms_pipe_b_c_ivb',
+	'kms_pipe_color',
+	'kms_pipe_crc_basic',
+	'kms_plane',
+	'kms_plane_lowres',
+	'kms_plane_multiple',
+	'kms_plane_scaling',
+	'kms_properties',
+	'kms_psr_sink_crc',
+	'kms_pwrite_crc',
+	'kms_render',
+	'kms_rmfb',
+	'kms_rotation_crc',
+	'kms_setmode',
+	'kms_sink_crc_basic',
+	'kms_sysfs_edid_timing',
+	'kms_tv_load_detect',
+	'kms_universal_plane',
+	'kms_vblank',
+	'meta_test',
+	'perf',
+	'pm_backlight',
+	'pm_lpsp',
+	'pm_rc6_residency',
+	'pm_rpm',
+	'pm_rps',
+	'pm_sseu',
+	'prime_busy',
+	'prime_mmap',
+	'prime_mmap_coherency',
+	'prime_mmap_kms',
+	'prime_self_import',
+	'prime_udl',
+	'prime_vgem',
+	'sw_sync',
+	'syncobj_basic',
+	'template',
+	'tools_test',
+	'vgem_basic',
+	'vgem_slow',
+]
+
+test_deps = [ igt_deps ]
+if libdrm_nouveau.found()
+	test_progs += [
+		'prime_nv_api',
+		'prime_nv_pcopy',
+		'prime_nv_test',
+	]
+	test_deps += libdrm_nouveau
+endif
+
+if libdrm_vc4.found()
+	test_progs += [
+		'vc4_create_bo',
+		'vc4_dmabuf_poll',
+		'vc4_lookup_fail',
+		'vc4_wait_bo',
+		'vc4_wait_seqno',
+	]
+	test_deps += libdrm_vc4
+endif
+
+if libdrm_amdgpu.found()
+	# FIXME meson/ninja really doesn't like build targets with paths in them
+	test_progs += [
+		'amdgpu/amd_basic',
+		'amdgpu/amd_cs_nop',
+		'amdgpu/amd_prime',
+	]
+	test_deps += libdrm_amdgpu
+endif
+
+if alsa.found()
+	test_progs += [
+		'audio',
+	]
+	test_deps += alsa
+endif
+
+foreach prog : test_progs
+	executable(prog, prog + '.c',
+			dependencies : test_deps)
+endforeach
+
+executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
+		dependencies : test_deps)
+test_progs += 'testdisplay'
+
+run_command('generate_testlist.sh', test_progs)
+
+test_script = find_program('igt_command_line.sh')
+foreach prog : test_progs
+	test('testcase check: ' + prog, test_script,
+			args : prog)
+endforeach
+
+executable('gem_stress', 'gem_stress.c', dependencies : igt_deps)
+
+# IMPORTANT: These tests here are all disabled because the result in sometime
+# unrecoverable gpu hangs. Don't put real testcases here.
+hang_progs = [
+	'gem_bad_batch',
+	'gem_hang',
+	'gem_bad_blit',
+	'gem_bad_address',
+	'gem_non_secure_batch',
+]
+foreach prog : hang_progs
+	executable(prog, prog + '.c',
+			dependencies : igt_deps,
+			install : false)
+endforeach
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 000000000000..d2d4410e2130
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,59 @@
+tools_progs_noisnt = [
+	'hsw_compute_wrpll',
+	'skl_compute_wrpll',
+	'skl_ddb_allocation',
+]
+
+foreach prog : tools_progs_noisnt
+	executable(prog, prog + '.c',
+			dependencies : igt_deps,
+			install : false)
+endforeach
+
+tools_progs = [
+	# FIXME we already have a libtestcase with this name as target
+	#'igt_stats',
+	'intel_audio_dump',
+	'intel_backlight',
+	'intel_bios_dumper',
+	'intel_display_crc',
+	'intel_display_poller',
+	'intel_forcewaked',
+	'intel_gpu_frequency',
+	'intel_firmware_decode',
+	'intel_gpu_time',
+	'intel_gpu_top',
+	'intel_gtt',
+	'intel_guc_logger',
+	'intel_infoframes',
+	'intel_lid',
+	'intel_opregion_decode',
+	'intel_panel_fitter',
+	'intel_reg_checker',
+	'intel_residency',
+	'intel_stepping',
+	'intel_vbt_decode',
+	'intel_watermark',
+	'intel_gem_info',
+	'intel_gvtg_test',
+]
+tool_deps = igt_deps
+
+if libdrm_intel.found()
+	tools_progs += [
+		'intel_dump_decode',
+		'intel_error_decode',
+		'intel_framebuffer_dump',
+		'intel_perf_counters',
+	]
+	tool_deps += zlib
+endif
+
+foreach prog : tools_progs
+	executable(prog, prog + '.c',
+			dependencies : tool_deps)
+endforeach
+
+shared_library('intel_aubdump', 'aubdump.c', dependencies : [ igt_deps, dlsym ])
+
+subdir('null_state_gen')
diff --git a/tools/null_state_gen/meson.build b/tools/null_state_gen/meson.build
new file mode 100644
index 000000000000..96697dbf64f1
--- /dev/null
+++ b/tools/null_state_gen/meson.build
@@ -0,0 +1,15 @@
+intel_null_state_gen_src = [
+	'intel_batchbuffer.c',
+	'intel_renderstate_gen6.c',
+	'intel_renderstate_gen7.c',
+	'intel_renderstate_gen8.c',
+	'intel_renderstate_gen9.c',
+	'intel_null_state_gen.c',
+]
+
+intel_null_state_gen = executable('intel_null_state_gen',
+		intel_null_state_gen_src, dependencies : igt_deps,
+		install : false)
+
+# FIXME actual null_state generation. We probably want to push the the copyright
+# header generation into intel_null_state_gen for simplicity
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 05/12] tests/gem_spin_batch: Fix warning
  2017-09-02 17:03 ` [PATCH i-g-t 05/12] tests/gem_spin_batch: Fix warning Daniel Vetter
@ 2017-09-03  4:39   ` Eric Anholt
  0 siblings, 0 replies; 32+ messages in thread
From: Eric Anholt @ 2017-09-03  4:39 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter


[-- Attachment #1.1: Type: text/plain, Size: 255 bytes --]

Daniel Vetter <daniel.vetter@ffwll.ch> writes:

> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

1-5 are:

Reviewed-by: Eric Anholt <eric@anholt.net>

My meson branch has some stuff you probably want to squash into your
meson build system commit.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (10 preceding siblings ...)
  2017-09-02 17:04 ` [PATCH i-g-t 12/12] RFC: meson build system support Daniel Vetter
@ 2017-09-03  9:27 ` Chris Wilson
  2017-09-04  8:48   ` Daniel Vetter
  2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
  12 siblings, 1 reply; 32+ messages in thread
From: Chris Wilson @ 2017-09-03  9:27 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

Quoting Daniel Vetter (2017-09-02 18:03:55)
> In meson I want to just set this everywhere (no reason not to), and
> doing so will allow us to clean up a few things.

GNU_SOURCE is defined in config.h, which should be included from all
files (at least those that depend on system library foibles). I presume
you intend to move all of config.h onto the command line?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult
  2017-09-02 17:03 ` [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult Daniel Vetter
@ 2017-09-03  9:29   ` Chris Wilson
  2017-09-04  8:41     ` Daniel Vetter
  2017-09-04  8:28   ` Arkadiusz Hiler
  1 sibling, 1 reply; 32+ messages in thread
From: Chris Wilson @ 2017-09-03  9:29 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Quoting Daniel Vetter (2017-09-02 18:03:56)
> We have it. Daniel Stone said it comes from the X11 transition to the
> modular build.

What? It's from AC_CONFIG_HEADERS([config.h])

We tell autoconf to build it so it doesn't have to put all the build
flags on the command line.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult
  2017-09-02 17:03 ` [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult Daniel Vetter
  2017-09-03  9:29   ` Chris Wilson
@ 2017-09-04  8:28   ` Arkadiusz Hiler
  2017-09-04  8:45     ` Daniel Vetter
  1 sibling, 1 reply; 32+ messages in thread
From: Arkadiusz Hiler @ 2017-09-04  8:28 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development

On Sat, Sep 02, 2017 at 07:03:56PM +0200, Daniel Vetter wrote:
> We have it. Daniel Stone said it comes from the X11 transition to the
> modular build.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

It's also used for Android builds, which lack the generated config.h.

But is this even used nowadays by anyone?

How we are going to deal with the Android.mk with the transition to
meson? Can we just drop them?

Android, in recent releases, is shifting from Makefiles to Soong.
anyway. <https://android.googlesource.com/platform/build/soong/>

-- 
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult
  2017-09-03  9:29   ` Chris Wilson
@ 2017-09-04  8:41     ` Daniel Vetter
  0 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  8:41 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Daniel Vetter, Intel Graphics Development

On Sun, Sep 03, 2017 at 10:29:06AM +0100, Chris Wilson wrote:
> Quoting Daniel Vetter (2017-09-02 18:03:56)
> > We have it. Daniel Stone said it comes from the X11 transition to the
> > modular build.
> 
> What? It's from AC_CONFIG_HEADERS([config.h])
> 
> We tell autoconf to build it so it doesn't have to put all the build
> flags on the command line.

Yes I know where it's from. What I mean is why do we include-guard this,
and Daniel Stone said very old versions of X didn't have config.h (because
they used imake or whatever the horror was again).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult
  2017-09-04  8:28   ` Arkadiusz Hiler
@ 2017-09-04  8:45     ` Daniel Vetter
  2017-09-04  9:27       ` Arkadiusz Hiler
  0 siblings, 1 reply; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  8:45 UTC (permalink / raw)
  To: Arkadiusz Hiler; +Cc: Daniel Vetter, Intel Graphics Development

On Mon, Sep 04, 2017 at 11:28:09AM +0300, Arkadiusz Hiler wrote:
> On Sat, Sep 02, 2017 at 07:03:56PM +0200, Daniel Vetter wrote:
> > We have it. Daniel Stone said it comes from the X11 transition to the
> > modular build.
> > 
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> It's also used for Android builds, which lack the generated config.h.
> 
> But is this even used nowadays by anyone?
> 
> How we are going to deal with the Android.mk with the transition to
> meson? Can we just drop them?
> 
> Android, in recent releases, is shifting from Makefiles to Soong.
> anyway. <https://android.googlesource.com/platform/build/soong/>

Looking at recent igt patches, we've stuffed all the fancy stuff (e.g.
chamelium) into Makefile.am, not Makefile.sources. And no one updated the
android build.

Judging from that, I think the android build is already firmly in bitrot
territory :-/

So yeah the plan would be to just leave it there, until someone cares
more. From a few googles it looks like meson might be able to
cross-compile into an android environment, but it won't be able to get
integrated into the android image build.

We could also try to generate the Makefile.sources files from special
meson targets (probably using the configuration generation stuff and a few
templates).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am
  2017-09-03  9:27 ` [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Chris Wilson
@ 2017-09-04  8:48   ` Daniel Vetter
  0 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  8:48 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter

On Sun, Sep 03, 2017 at 10:27:03AM +0100, Chris Wilson wrote:
> Quoting Daniel Vetter (2017-09-02 18:03:55)
> > In meson I want to just set this everywhere (no reason not to), and
> > doing so will allow us to clean up a few things.
> 
> GNU_SOURCE is defined in config.h, which should be included from all
> files (at least those that depend on system library foibles). I presume
> you intend to move all of config.h onto the command line?

Wrt including config.h, we seem to be rather inconsistent with that. So
what I opted for is to put stuff like that onto the cmdline, and generate
a minimal config.h with just the few #defines we actually use in the meson
build. That seems a robust approach, since if you use such a #define
without including config.h, you'll get a complain. GNU_SOURCE otoh doesn't
result in any complaints if you don't set it, but it is rather surprising
to have it in some files, but not in others. Hence why I figured it's best
to just add it to the gcc cmdline.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w
  2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
                   ` (11 preceding siblings ...)
  2017-09-03  9:27 ` [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Chris Wilson
@ 2017-09-04  9:08 ` Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 2/7] tests/kms_plane: Appease gcc -Wempty-body Daniel Vetter
                     ` (5 more replies)
  12 siblings, 6 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  9:08 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

gcc complains otherwise about empty ; statements ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 lib/ioctl_wrappers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index b4d6210d5942..48750427a0c1 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -60,7 +60,7 @@
 
 #define VG(x) x
 #else
-#define VG(x)
+#define VG(x) do {} while (0)
 #endif
 
 #include "ioctl_wrappers.h"
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 2/7] tests/kms_plane: Appease gcc -Wempty-body
  2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
@ 2017-09-04  9:08   ` Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 3/7] meson: Add some compiler flags to reduce warnings Daniel Vetter
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  9:08 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Not exactly sure what's the point, but oh well.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/kms_plane.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 927d5d37fece..812497500d2d 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -207,8 +207,9 @@ test_plane_position_with_output(data_t *data,
 
 	if (flags & TEST_POSITION_FULLY_COVERED)
 		igt_assert_crc_equal(&test.reference_crc, &crc);
-	else
+	else {
 		;/* FIXME: missing reference CRCs */
+	}
 
 	igt_assert_crc_equal(&crc, &crc2);
 
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 3/7] meson: Add some compiler flags to reduce warnings.
  2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 2/7] tests/kms_plane: Appease gcc -Wempty-body Daniel Vetter
@ 2017-09-04  9:08   ` Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 4/7] meson: Don't build the igt audio test without gsl available Daniel Vetter
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  9:08 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

From: Eric Anholt <eric@anholt.net>

These warnings are apparently new compared to the autotools build.  We
can fix the things they complain about later, if we want.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 meson.build | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meson.build b/meson.build
index fee64fcdf36e..4d6985d191f9 100644
--- a/meson.build
+++ b/meson.build
@@ -8,6 +8,17 @@ project('IGT gpu tests', 'c',
 
 cc = meson.get_compiler('c')
 
+add_global_arguments('-Wno-unused-parameter', language: 'c')
+add_global_arguments('-Wno-sign-compare', language: 'c')
+add_global_arguments('-Wno-missing-field-initializers', language: 'c')
+add_global_arguments('-Wno-clobbered', language: 'c')
+
+# Macros asserting on the range of their arguments triggers this.
+add_global_arguments('-Wno-type-limits', language: 'c')
+
+# igt_assert(0) in switch statements triggers a bunch of this.
+add_global_arguments('-Wimplicit-fallthrough=0', language: 'c')
+
 inc = include_directories('lib', '.')
 
 config_h = configuration_data()
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 4/7] meson: Don't build the igt audio test without gsl available.
  2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 2/7] tests/kms_plane: Appease gcc -Wempty-body Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 3/7] meson: Add some compiler flags to reduce warnings Daniel Vetter
@ 2017-09-04  9:08   ` Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 5/7] meson: Use static libs to handle IGT_LOG_DOMAIN Daniel Vetter
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  9:08 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

From: Eric Anholt <eric@anholt.net>

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/meson.build b/tests/meson.build
index 73833758be0e..4dd5a9c9d4c7 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -248,7 +248,7 @@ if libdrm_amdgpu.found()
 	test_deps += libdrm_amdgpu
 endif
 
-if alsa.found()
+if alsa.found() and gsl.found()
 	test_progs += [
 		'audio',
 	]
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 5/7] meson: Use static libs to handle IGT_LOG_DOMAIN.
  2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
                     ` (2 preceding siblings ...)
  2017-09-04  9:08   ` [PATCH i-g-t 4/7] meson: Don't build the igt audio test without gsl available Daniel Vetter
@ 2017-09-04  9:08   ` Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 6/7] meson: detect cc flags Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 7/7] meson: add manpage support Daniel Vetter
  5 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  9:08 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

From: Eric Anholt <eric@anholt.net>

It means that compiler errors in the .c files take you to the source
place in your editor, not a preprocessed temporary.

v2: Add the library deps, fails linking otherwise.

Signed-off-by: Eric Anholt <eric@anholt.net> (v1)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 lib/dummy.c               |  0
 lib/meson.build           | 36 +++++++++++++++++++++++++-----------
 lib/prepend_log_domain.sh |  8 --------
 3 files changed, 25 insertions(+), 19 deletions(-)
 create mode 100644 lib/dummy.c
 delete mode 100755 lib/prepend_log_domain.sh

diff --git a/lib/dummy.c b/lib/dummy.c
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/lib/meson.build b/lib/meson.build
index 51d3f9e278da..f0672edf1830 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -144,19 +144,33 @@ vcs_tag(input : 'version.h.in', output : 'version.h',
 	fallback : 'NO-GIT',
 	command : [ 'git', 'log', '-n1', '--pretty=format:g%h' ] )
 
-# FIXME we don't regenerate when the script changes
-prepend_log_domain = generator(find_program('prepend_log_domain.sh'),
-		arguments : [ '@INPUT@', '@OUTPUT@' ],
-		output : '@PLAINNAME@' + '.pre.c')
-
-processed_src_dep = prepend_log_domain.process(lib_sources)
+lib_intermediates = []
+foreach f: lib_sources
+    # No / in the target name
+    if f.contains('uwildmat')
+        name = 'uwildmat'
+    else
+        name = f
+    endif
+
+    lib = static_library('igt-' + name,
+        f,
+	include_directories: inc,
+	dependencies : lib_deps,
+	c_args : [
+	    '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
+	    '-DIGT_SRCDIR="@0@"'.format(srcdir),
+	    '-DIGT_LOG_DOMAIN="@0@"'.format(f.split('.')[0]),
+	])
+
+    lib_intermediates += lib
+endforeach
 
 lib_igt_build = shared_library('igt',
-			 processed_src_dep,
-			 include_directories : inc,
-			 dependencies : lib_deps,
-			 c_args : [ '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
-				'-DIGT_SRCDIR="@0@"'.format(srcdir), ])
+    ['dummy.c'],
+    link_whole: lib_intermediates,
+    dependencies: lib_deps,
+)
 
 lib_igt = declare_dependency(link_with : lib_igt_build,
 			    include_directories : inc)
diff --git a/lib/prepend_log_domain.sh b/lib/prepend_log_domain.sh
deleted file mode 100755
index 93a911508b7f..000000000000
--- a/lib/prepend_log_domain.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-input=$1
-output=$2
-basename=$(basename $1 .c)
-
-echo "#define IGT_LOG_DOMAIN \"$basename\"" > $output
-cat $input >> $output
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 6/7] meson: detect cc flags
  2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
                     ` (3 preceding siblings ...)
  2017-09-04  9:08   ` [PATCH i-g-t 5/7] meson: Use static libs to handle IGT_LOG_DOMAIN Daniel Vetter
@ 2017-09-04  9:08   ` Daniel Vetter
  2017-09-04  9:08   ` [PATCH i-g-t 7/7] meson: add manpage support Daniel Vetter
  5 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  9:08 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Somehow my gcc has a different idea of what no-implicit-fallthrough
should look like than the one Eric used.

fixup compiler flags

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 meson.build | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/meson.build b/meson.build
index 4d6985d191f9..39749a0e1103 100644
--- a/meson.build
+++ b/meson.build
@@ -8,16 +8,22 @@ project('IGT gpu tests', 'c',
 
 cc = meson.get_compiler('c')
 
-add_global_arguments('-Wno-unused-parameter', language: 'c')
-add_global_arguments('-Wno-sign-compare', language: 'c')
-add_global_arguments('-Wno-missing-field-initializers', language: 'c')
-add_global_arguments('-Wno-clobbered', language: 'c')
-
+cc_args = [
+	'-Wno-unused-parameter',
+	'-Wno-sign-compare',
+	'-Wno-missing-field-initializers',
+	'-Wno-clobbered',
 # Macros asserting on the range of their arguments triggers this.
-add_global_arguments('-Wno-type-limits', language: 'c')
-
+	'-Wno-type-limits',
 # igt_assert(0) in switch statements triggers a bunch of this.
-add_global_arguments('-Wimplicit-fallthrough=0', language: 'c')
+	'-Wimplicit-fallthrough=0',
+]
+
+foreach cc_arg : cc_args
+  if cc.has_argument(cc_arg)
+    add_global_arguments(cc_arg, language : 'c')
+  endif
+endforeach
 
 inc = include_directories('lib', '.')
 
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH i-g-t 7/7] meson: add manpage support
  2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
                     ` (4 preceding siblings ...)
  2017-09-04  9:08   ` [PATCH i-g-t 6/7] meson: detect cc flags Daniel Vetter
@ 2017-09-04  9:08   ` Daniel Vetter
  5 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  9:08 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

It seems like meson doesn't want you to string together targets
like make does, but wants it all in one step. So another little
shell script it is.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 man/defs.rst.in |  5 +++++
 man/meson.build | 45 +++++++++++++++++++++++++++++++++++++++++++++
 man/rst2man.sh  | 16 ++++++++++++++++
 meson.build     |  1 +
 4 files changed, 67 insertions(+)
 create mode 100644 man/defs.rst.in
 create mode 100644 man/meson.build
 create mode 100755 man/rst2man.sh

diff --git a/man/defs.rst.in b/man/defs.rst.in
new file mode 100644
index 000000000000..54b7eec08903
--- /dev/null
+++ b/man/defs.rst.in
@@ -0,0 +1,5 @@
+.. |PACKAGE_NAME| replace:: @PACKAGE_NAME@
+.. |PACKAGE_VERSION| replace:: @PACKAGE_VERSION@
+.. |PACKAGE_STRING| replace:: @PACKAGE_STRING@
+.. |MANUAL_SECTION| replace:: 1
+.. |MANUAL_GROUP| replace:: General Commands Manual
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 000000000000..4f9f88e87540
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,45 @@
+manpages = [
+	'intel_aubdump',
+	'intel_audio_dump',
+	'intel_bios_dumper',
+	'intel_error_decode',
+	'intel_gpu_frequency',
+	'intel_gpu_top',
+	'intel_gtt',
+	'intel_infoframes',
+	'intel_lid',
+	'intel_panel_fitter',
+	'intel_reg',
+	'intel_stepping',
+	'intel_upload_blit_large',
+	'intel_upload_blit_large_gtt',
+	'intel_upload_blit_large_map',
+	'intel_upload_blit_small',
+	'intel_vbt_decode',
+]
+
+man_config = configuration_data()
+
+man_config.set('PACKAGE_NAME', meson.project_name())
+man_config.set('PACKAGE_VERSION', meson.project_version())
+man_config.set('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
+
+defs_rst = configure_file(input : 'defs.rst.in',
+		output : 'defs.rst',
+		configuration : man_config)
+
+rst2man = find_program('rst2man', required : false)
+rst2man_script = find_program('rst2man.sh')
+
+if rst2man.found()
+	foreach manpage : manpages
+		custom_target(manpage + '.1',
+				build_by_default : true,
+				command : [ rst2man_script, '@INPUT@', '@OUTPUT@' ],
+				depend_files : [ defs_rst ],
+				input: manpage + '.rst',
+				output : manpage + '.1.gz',
+				install : true,
+				install_dir : join_paths(get_option('mandir'), 'man1'))
+	endforeach
+endif
diff --git a/man/rst2man.sh b/man/rst2man.sh
new file mode 100755
index 000000000000..fc2b5ed863b1
--- /dev/null
+++ b/man/rst2man.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+input=$1
+output=$2
+
+out_dir=$(dirname ${output})
+in_file=$(basename ${input})
+
+# rst2man doesn't handle multiple source directories well, and since defs.rst is
+# generated we first need to move it all into the build dir
+cp $input $out_dir
+
+rst2man $out_dir/$in_file ${output%.gz}
+
+rm -f ${output}
+gzip ${output%.gz}
diff --git a/meson.build b/meson.build
index 39749a0e1103..2b49a0db6500 100644
--- a/meson.build
+++ b/meson.build
@@ -120,3 +120,4 @@ if libdrm_intel.found()
 	subdir('assembler')
 	subdir('overlay')
 endif
+subdir('man')
-- 
2.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 12/12] RFC: meson build system support
  2017-09-02 17:04 ` [PATCH i-g-t 12/12] RFC: meson build system support Daniel Vetter
@ 2017-09-04  9:11   ` Daniel Vetter
  2017-09-04 13:11   ` Jani Nikula
  1 sibling, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04  9:11 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

On Sat, Sep 02, 2017 at 07:04:06PM +0200, Daniel Vetter wrote:
> Why?
> 
> Because it's fast.
> 
> Like really, really fast.
> 
> Some data (from a snb laptop, so rather lower-powered):
> 
> - Incremental build after $ touch lib/igt_core.c with meson: 0.6s
>   It notices that the symbol list of the libigt.so hasn't changed and
>   doesn't bother re-linking the almost 300 binaries we have. make -j 6
>   for the same scenario takes 44s.
> 
> - Incremental build with nothing changed: make: 0.7s, meson: 0.2s This
>   means stuff like --disable-git-hash is entirely pointless with
>   meson, it's faster than a make ever can be (with 0.6s).
> 
> - Reconfigure stage: ninja reconfigure 0.8s vs. ./configure 8.6s)
> 
> - Running tests, after a full build: ninja test 6s vs. make check 24s
> 
> - Full build (i.e. including ./autogen.sh respectively meson build),
>   including tests, from a pristine git checkout. automake 2m49s vs.
>   meson 44s.
> 
> TODO:
> - cmdline options

Apparently this isn't how meson is done, but I guess we could do options
to disable chamelium and similar stuff.

> - gcc warnings, debug build, how does that work?
> - man pages

man pages and gcc warnings are now done, with the latest set of patches
from Eric and me.

> - gtkdoc

Working on this, probably hitting some bug in the meson gtkdoc support
right now.

Another thing I totally didn't tackle is install support. Half the stuff
is probably missing or in the wrong place right now.

Also, for convenience, the entire pile on fd.o:

https://cgit.freedesktop.org/~danvet/intel-gpu-tools/log/?h=stuff

I've mentioned that this stuff is fast, right?

:-)

Cheers, Daniel

> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Daniel Stone <daniel@fooishbar.org>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  .gitignore                       |   1 +
>  assembler/meson.build            |  73 ++++++++++
>  benchmarks/meson.build           |  36 +++++
>  lib/meson.build                  | 166 ++++++++++++++++++++++
>  lib/prepend_log_domain.sh        |   8 ++
>  lib/tests/meson.build            |  34 +++++
>  lib/version.h.in                 |   1 +
>  meson.build                      | 105 ++++++++++++++
>  overlay/meson.build              |  59 ++++++++
>  tests/generate_testlist.sh       |  10 ++
>  tests/meson.build                | 290 +++++++++++++++++++++++++++++++++++++++
>  tools/meson.build                |  59 ++++++++
>  tools/null_state_gen/meson.build |  15 ++
>  13 files changed, 857 insertions(+)
>  create mode 100644 assembler/meson.build
>  create mode 100644 benchmarks/meson.build
>  create mode 100644 lib/meson.build
>  create mode 100755 lib/prepend_log_domain.sh
>  create mode 100644 lib/tests/meson.build
>  create mode 100644 lib/version.h.in
>  create mode 100644 meson.build
>  create mode 100644 overlay/meson.build
>  create mode 100755 tests/generate_testlist.sh
>  create mode 100644 tests/meson.build
>  create mode 100644 tools/meson.build
>  create mode 100644 tools/null_state_gen/meson.build
> 
> diff --git a/.gitignore b/.gitignore
> index 6204965a0e32..e6919272d8b6 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -93,3 +93,4 @@ intel-gpu-tools-*/
>  
>  piglit
>  results
> +build
> diff --git a/assembler/meson.build b/assembler/meson.build
> new file mode 100644
> index 000000000000..bdddd0e2db25
> --- /dev/null
> +++ b/assembler/meson.build
> @@ -0,0 +1,73 @@
> +lib_brw_src = [
> +	'brw_context.c',
> +	'brw_disasm.c',
> +	'brw_eu.c',
> +	'brw_eu_compact.c',
> +	'brw_eu_debug.c',
> +	'brw_eu_emit.c',
> +	'brw_eu_util.c',
> +	'gen8_disasm.c',
> +	'gen8_instruction.c',
> +	'ralloc.c',
> +]
> +
> +lib_brw = shared_library('brw', lib_brw_src,
> +		dependencies : igt_deps)
> +
> +flex = find_program('flex')
> +bison = find_program('bison')
> +
> +lgen = generator(flex,
> +		output : '@BASENAME@.c',
> +		arguments : ['-o', '@OUTPUT@', '@INPUT@'])
> +
> +lfiles = lgen.process('lex.l')
> +
> +pgen = generator(bison,
> +		output : ['@BASENAME@.c', '@BASENAME@.h'],
> +		arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
> +
> +pfiles = pgen.process('gram.y')
> +
> +executable('intel-gen4asm', 'main.c', lfiles, pfiles, link_with : lib_brw)
> +
> +executable('intel-gen4disasm', 'disasm-main.c', link_with : lib_brw)
> +
> +gen4asm_testcases = [
> +	'test/mov',
> +	'test/frc',
> +	'test/rndd',
> +	'test/rndu',
> +	'test/rnde',
> +	'test/rnde-intsrc',
> +	'test/rndz',
> +	'test/lzd',
> +	'test/not',
> +	'test/immediate',
> +]
> +
> +# Those tests were already failing when the assembler was imported from
> +# the intel-gen4asm git repository:
> +#   http://cgit.freedesktop.org/xorg/app/intel-gen4asm/
> +# We disable them "for now" as a workaround to be able to release i-g-t
> +gen4asm_testcases_broken = [
> +	'test/declare',
> +	'test/jmpi',
> +	'test/if',
> +	'test/iff',
> +	'test/while',
> +	'test/else',
> +	'test/break',
> +	'test/cont',
> +	'test/halt',
> +	'test/wait',
> +	'test/endif',
> +]
> +
> +test_runner = find_program('test/run-test.sh')
> +foreach testcase : gen4asm_testcases
> +	test('assembler: ' + testcase, test_runner,
> +			args : testcase,
> +			env : [ 'srcdir=' + meson.current_source_dir(),
> +				'top_builddir=' + meson.current_build_dir()])
> +endforeach
> diff --git a/benchmarks/meson.build b/benchmarks/meson.build
> new file mode 100644
> index 000000000000..9ab738f76588
> --- /dev/null
> +++ b/benchmarks/meson.build
> @@ -0,0 +1,36 @@
> +benchmark_progs = [
> +	'gem_blt',
> +	'gem_busy',
> +	'gem_create',
> +	'gem_exec_ctx',
> +	'gem_exec_fault',
> +	'gem_exec_nop',
> +	'gem_exec_reloc',
> +	'gem_exec_trace',
> +	'gem_latency',
> +	'gem_mmap',
> +	'gem_prw',
> +	'gem_set_domain',
> +	'gem_syslatency',
> +	'gem_wsim',
> +	'kms_vblank',
> +	'prime_lookup',
> +	'vgem_mmap',
> +]
> +
> +if libdrm_intel.found()
> +	benchmark_progs += [
> +		'intel_upload_blit_large',
> +		'intel_upload_blit_large_gtt',
> +		'intel_upload_blit_large_map',
> +		'intel_upload_blit_small',
> +		'gem_userptr_benchmark',
> +	]
> +endif
> +
> +foreach prog : benchmark_progs
> +	# FIXME meson doesn't like binaries with the same name
> +	# meanwhile just suffix with _bench
> +	executable(prog + '_bench', prog + '.c',
> +			dependencies : test_deps)
> +endforeach
> diff --git a/lib/meson.build b/lib/meson.build
> new file mode 100644
> index 000000000000..51d3f9e278da
> --- /dev/null
> +++ b/lib/meson.build
> @@ -0,0 +1,166 @@
> +lib_headers = [
> +	'debug.h',
> +	'drmtest.h',
> +	'i830_reg.h',
> +	'i915_3d.h',
> +	'i915_reg.h',
> +	'i915_pciids.h',
> +	'igt.h',
> +	'igt_debugfs.h',
> +	'igt_aux.h',
> +	'igt_edid_template.h',
> +	'igt_gt.h',
> +	'igt_gvt.h',
> +	'igt_primes.h',
> +	'igt_rand.h',
> +	'igt_stats.h',
> +	'igt_sysfs.h',
> +	'igt_x86.h',
> +	'igt_vgem.h',
> +	'instdone.h',
> +	'intel_batchbuffer.h',
> +	'intel_chipset.h',
> +	'intel_io.h',
> +	'intel_reg.h',
> +	'ioctl_wrappers.h',
> +	'media_fill.h',
> +	'media_spin.h',
> +	'gpgpu_fill.h',
> +	'gen7_media.h',
> +	'gen8_media.h',
> +	'gen6_render.h',
> +	'gen7_render.h',
> +	'gen8_render.h',
> +	'gen9_render.h',
> +	'rendercopy.h',
> +	'sw_sync.h',
> +	'igt_kms.h',
> +	'igt_fb.h',
> +	'igt_core.h',
> +	'igt_draw.h',
> +	'igt_pm.h',
> +	'igt_dummyload.h',
> +	'uwildmat/uwildmat.h',
> +	'igt_kmod.h',
> +]
> +
> +lib_sources = [
> +	'drmtest.c',
> +	'igt_debugfs.c',
> +	'igt_aux.c',
> +	'igt_gt.c',
> +	'igt_gvt.c',
> +	'igt_primes.c',
> +	'igt_rand.c',
> +	'igt_stats.c',
> +	'igt_sysfs.c',
> +	'igt_x86.c',
> +	'igt_vgem.c',
> +	'instdone.c',
> +	'intel_batchbuffer.c',
> +	'intel_chipset.c',
> +	'intel_device_info.c',
> +	'intel_os.c',
> +	'intel_mmio.c',
> +	'ioctl_wrappers.c',
> +	'media_fill_gen7.c',
> +	'media_fill_gen8.c',
> +	'media_fill_gen8lp.c',
> +	'media_fill_gen9.c',
> +	'media_spin.c',
> +	'gpgpu_fill.c',
> +	'rendercopy_i915.c',
> +	'rendercopy_i830.c',
> +	'rendercopy_gen6.c',
> +	'rendercopy_gen7.c',
> +	'rendercopy_gen8.c',
> +	'rendercopy_gen9.c',
> +	'sw_sync.c',
> +	'intel_reg_map.c',
> +	'intel_iosf.c',
> +	'igt_kms.c',
> +	'igt_fb.c',
> +	'igt_core.c',
> +	'igt_draw.c',
> +	'igt_pm.c',
> +	'igt_dummyload.c',
> +	'uwildmat/uwildmat.c',
> +	'igt_kmod.c',
> +]
> +
> +lib_deps = [
> +	cairo,
> +	glib,
> +	libdrm,
> +	libkmod,
> +	libprocps,
> +	libudev,
> +	libunwind,
> +	pciaccess,
> +	pthreads,
> +	math,
> +	realtime,
> +]
> +
> +if libdrm_intel.found()
> +	lib_deps += libdrm_intel
> +else
> +	lib_headers += 'stubs/drm/intel_bufmgr.h'
> +	lib_sources += 'stubs/drm/intel_bufmgr.c'
> +endif
> +
> +if libdrm_vc4.found()
> +	lib_headers += 'igt_vc4.h'
> +	lib_sources += 'igt_vc4.c'
> +endif
> +if valgrind.found()
> +	lib_deps += valgrind
> +endif
> +
> +if gsl.found()
> +	lib_deps += gsl
> +	lib_headers += [ 'igt_frame.h', 'igt_audio.h' ]
> +	lib_sources += [ 'igt_frame.c', 'igt_audio.c' ]
> +endif
> +
> +if alsa.found()
> +	lib_deps += alsa
> +	lib_headers += 'igt_alsa.h'
> +	lib_sources += 'igt_alsa.c'
> +endif
> +
> +if chamelium.found()
> +	lib_deps += chamelium
> +	lib_headers += 'igt_chamelium.h'
> +	lib_sources += 'igt_chamelium.c'
> +endif
> +
> +install_headers(lib_headers)
> +
> +pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'intel-gpu-tools')
> +srcdir = join_paths(meson.source_root(), 'tests')
> +
> +vcs_tag(input : 'version.h.in', output : 'version.h',
> +	fallback : 'NO-GIT',
> +	command : [ 'git', 'log', '-n1', '--pretty=format:g%h' ] )
> +
> +# FIXME we don't regenerate when the script changes
> +prepend_log_domain = generator(find_program('prepend_log_domain.sh'),
> +		arguments : [ '@INPUT@', '@OUTPUT@' ],
> +		output : '@PLAINNAME@' + '.pre.c')
> +
> +processed_src_dep = prepend_log_domain.process(lib_sources)
> +
> +lib_igt_build = shared_library('igt',
> +			 processed_src_dep,
> +			 include_directories : inc,
> +			 dependencies : lib_deps,
> +			 c_args : [ '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
> +				'-DIGT_SRCDIR="@0@"'.format(srcdir), ])
> +
> +lib_igt = declare_dependency(link_with : lib_igt_build,
> +			    include_directories : inc)
> +
> +igt_deps = [ lib_igt ] + lib_deps
> +
> +subdir('tests')
> diff --git a/lib/prepend_log_domain.sh b/lib/prepend_log_domain.sh
> new file mode 100755
> index 000000000000..93a911508b7f
> --- /dev/null
> +++ b/lib/prepend_log_domain.sh
> @@ -0,0 +1,8 @@
> +#!/bin/bash
> +
> +input=$1
> +output=$2
> +basename=$(basename $1 .c)
> +
> +echo "#define IGT_LOG_DOMAIN \"$basename\"" > $output
> +cat $input >> $output
> diff --git a/lib/tests/meson.build b/lib/tests/meson.build
> new file mode 100644
> index 000000000000..29bdb2c4222c
> --- /dev/null
> +++ b/lib/tests/meson.build
> @@ -0,0 +1,34 @@
> +lib_tests = [
> +	'igt_fork_helper',
> +	'igt_list_only',
> +	'igt_simulation',
> +	'igt_stats',
> +	'igt_segfault',
> +	'igt_subtest_group',
> +	'igt_assert',
> +	'igt_exit_handler',
> +	'igt_hdmi_inject',
> +	'igt_can_fail',
> +	'igt_can_fail_simple',
> +]
> +
> +lib_fail_tests = [
> +	'igt_no_exit',
> +	'igt_no_exit_list_only',
> +	'igt_no_subtest',
> +	'igt_simple_test_subtests',
> +	'igt_timeout',
> +	'igt_invalid_subtest_name',
> +]
> +
> +foreach lib_test : lib_tests
> +	exec = executable(lib_test, lib_test + '.c', install : true,
> +			dependencies : igt_deps)
> +	test('lib: ' + lib_test, exec)
> +endforeach
> +
> +foreach lib_test : lib_fail_tests
> +	exec = executable(lib_test, lib_test + '.c', install : true,
> +			dependencies : igt_deps)
> +	test('lib: ' + lib_test, exec, should_fail : true)
> +endforeach
> diff --git a/lib/version.h.in b/lib/version.h.in
> new file mode 100644
> index 000000000000..72fc6978cf32
> --- /dev/null
> +++ b/lib/version.h.in
> @@ -0,0 +1 @@
> +#define IGT_GIT_SHA1 "@VCS_TAG@"
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 000000000000..fee64fcdf36e
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,105 @@
> +project('IGT gpu tests', 'c',
> +	version : '1.19',
> +        default_options: [
> +          'warning_level=2',
> +          'c_std=gnu99',
> +        ],
> +	license : 'MIT')
> +
> +cc = meson.get_compiler('c')
> +
> +inc = include_directories('lib', '.')
> +
> +config_h = configuration_data()
> +
> +libdrm = dependency('libdrm', version : '>=2.4.82')
> +libdrm_intel = dependency('libdrm_intel', required : false)
> +libdrm_vc4 = dependency('libdrm_vc4', required : false)
> +libdrm_nouveau = dependency('libdrm_nouveau', required : false)
> +libdrm_amdgpu = dependency('libdrm_amdgpu', required : false)
> +
> +pciaccess = dependency('pciaccess', version : '>=0.10')
> +libkmod = dependency('libkmod')
> +libprocps = dependency('libprocps', required : false)
> +if libprocps.found()
> +	config_h.set('HAVE_PROCPS', 1)
> +endif
> +
> +valgrind = dependency('valgrind', required : false)
> +if valgrind.found()
> +	config_h.set('HAVE_VALGRIND', 1)
> +endif
> +
> +cairo = dependency('cairo', version : '>1.12.0', required : false)
> +
> +libudev = dependency('libudev', required : false)
> +if libudev.found()
> +	config_h.set('HAVE_UDEV', 1)
> +endif
> +
> +glib = dependency('glib-2.0', required : false)
> +if glib.found()
> +	config_h.set('HAVE_GLIB', 1)
> +endif
> +
> +libunwind = dependency('libunwind')
> +gsl = dependency('gsl', required : false)
> +alsa = dependency('alsa', required : false)
> +
> +pixman = dependency('pixman-1', required : false)
> +xmlrpc = dependency('xmlrpc', required : false)
> +xmlrpc_util = dependency('xmlrpc_util', required : false)
> +xmlrpc_client = dependency('xmlrpc_client', required : false)
> +
> +if pixman.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()
> +	chamelium = declare_dependency(dependencies : [ pixman, xmlrpc,
> +	  xmlrpc_util, xmlrpc_client])
> +else
> +	chamelium = dependency('', required: false)
> +endif
> +
> +pthreads = dependency('threads')
> +math = cc.find_library('m')
> +realtime = cc.find_library('rt')
> +dlsym = cc.find_library('dl')
> +zlib = cc.find_library('z')
> +
> +if cc.has_header('linux/kd.h')
> +	config_h.set('HAVE_LINUX_KD_H', 1)
> +endif
> +if cc.has_header('sys/kd.h')
> +	config_h.set('HAVE_SYS_KD_H', 1)
> +endif
> +if cc.has_header('libgen.h')
> +	config_h.set('HAVE_LIBGEN_H', 1)
> +endif
> +if cc.has_header('sys/io.h')
> +	config_h.set('HAVE_SYS_IO_H', 1)
> +endif
> +if cc.has_header('cpuid.h')
> +	# FIXME: Do we need the example link test from configure.ac?
> +	config_h.set('HAVE_CPUID_H', 1)
> +endif
> +
> +if cc.has_member('struct sysinfo', 'totalram',
> +		prefix : '#include <sys/sysinfo.h>')
> +	config_h.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
> +endif
> +
> +add_project_arguments('-D_GNU_SOURCE', language : 'c')
> +add_project_arguments('-include', 'config.h', language : 'c')
> +
> +config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
> +config_h.set_quoted('PACKAGE', meson.project_name())
> +config_h.set_quoted('TARGET_CPU_PLATFORM', host_machine.cpu_family())
> +
> +configure_file(output: 'config.h', install: false, configuration: config_h)
> +
> +subdir('lib')
> +subdir('tests')
> +subdir('benchmarks')
> +subdir('tools')
> +if libdrm_intel.found()
> +	subdir('assembler')
> +	subdir('overlay')
> +endif
> diff --git a/overlay/meson.build b/overlay/meson.build
> new file mode 100644
> index 000000000000..a4b778ca5a86
> --- /dev/null
> +++ b/overlay/meson.build
> @@ -0,0 +1,59 @@
> +gpu_overlay_src = [
> +	'chart.c',
> +	'config.c',
> +	'cpu-top.c',
> +	'debugfs.c',
> +	'gem-interrupts.c',
> +	'gem-objects.c',
> +	'gpu-top.c',
> +	'gpu-perf.c',
> +	'gpu-freq.c',
> +	'igfx.c',
> +	'overlay.c',
> +	'perf.c',
> +	'power.c',
> +	'rc6.c',
> +]
> +
> +xv = dependency('xv', required : false)
> +x11 = dependency('x11', required : false)
> +xext = dependency('xext', required : false)
> +dri2proto = dependency('dri2proto', version : '>= 2.6', required : false)
> +cairo_xlib = dependency('cairo-xlib', required : false)
> +xrandr = dependency('xrandr', version : '>=1.3', required : false)
> +
> +gpu_overlay_deps = [ realtime, cairo, pciaccess, libdrm, libdrm_intel ]
> +
> +both_x11_src = ''
> +
> +gpu_overlay_cflags = []
> +if xv.found() and x11.found() and xext.found() and dri2proto.found()
> +	both_x11_src = 'x11/position.c'
> +	gpu_overlay_src += [
> +		'x11/dri2.c',
> +		'x11/dri2.h',
> +		'x11/rgb2yuv.c',
> +		'x11/rgb2yuv.h',
> +		'x11/x11-overlay.c',
> +	]
> +	gpu_overlay_deps += [ xv, x11, xext, dri2proto ]
> +	gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XVLIB' ]
> +endif
> +
> +if cairo_xlib.found() and xrandr.found() and dri2proto.found()
> +	both_x11_src = 'x11/position.c'
> +	gpu_overlay_src += 'x11/x11-window.c'
> +	gpu_overlay_deps += [ cairo_xlib, dri2proto ]
> +	gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XLIB' ]
> +endif
> +
> +gpu_overlay_src += both_x11_src
> +
> +gpu_overlay_src += 'kms/kms-overlay.c'
> +
> +if xrandr.found() and cairo.found()
> +	executable('intel_gpu_overlay', gpu_overlay_src,
> +			include_directories : inc,
> +			c_args : gpu_overlay_cflags,
> +			dependencies : gpu_overlay_deps)
> +endif
> diff --git a/tests/generate_testlist.sh b/tests/generate_testlist.sh
> new file mode 100755
> index 000000000000..6ea78655daca
> --- /dev/null
> +++ b/tests/generate_testlist.sh
> @@ -0,0 +1,10 @@
> +#!/bin/bash
> +
> +echo TESTLIST > $MESON_BUILD_ROOT/tests/test-list.txt
> +
> +while [[ $# -gt 0 ]] ; do
> +	echo $1 >> $MESON_BUILD_ROOT/tests/test-list.txt
> +	shift
> +done
> +
> +echo END TESTLIST >> $MESON_BUILD_ROOT/tests/test-list.txt
> diff --git a/tests/meson.build b/tests/meson.build
> new file mode 100644
> index 000000000000..73833758be0e
> --- /dev/null
> +++ b/tests/meson.build
> @@ -0,0 +1,290 @@
> +test_progs = [
> +	'core_auth',
> +	'core_get_client_auth',
> +	'core_getclient',
> +	'core_getstats',
> +	'core_getversion',
> +	'core_prop_blob',
> +	'core_setmaster_vs_auth',
> +	'debugfs_test',
> +	'drm_import_export',
> +	'drm_mm',
> +	'drm_read',
> +	'drm_vma_limiter',
> +	'drm_vma_limiter_cached',
> +	'drm_vma_limiter_cpu',
> +	'drm_vma_limiter_gtt',
> +	'drv_getparams_basic',
> +	'drv_hangman',
> +	'drv_missed_irq',
> +	'drv_module_reload',
> +	'drv_selftest',
> +	'drv_suspend',
> +	'gem_bad_length',
> +	'gem_bad_reloc',
> +	'gem_basic',
> +	'gem_busy',
> +	'gem_caching',
> +	'gem_close',
> +	'gem_close_race',
> +	'gem_concurrent_blit',
> +	'gem_cpu_reloc',
> +	'gem_create',
> +	'gem_cs_prefetch',
> +	'gem_cs_tlb',
> +	'gem_ctx_bad_destroy',
> +	'gem_ctx_bad_exec',
> +	'gem_ctx_basic',
> +	'gem_ctx_create',
> +	'gem_ctx_exec',
> +	'gem_ctx_param',
> +	'gem_ctx_switch',
> +	'gem_ctx_thrash',
> +	'gem_double_irq_loop',
> +	'gem_eio',
> +	'gem_evict_alignment',
> +	'gem_evict_everything',
> +	'gem_exec_alignment',
> +	'gem_exec_async',
> +	'gem_exec_await',
> +	'gem_exec_bad_domains',
> +	'gem_exec_basic',
> +	'gem_exec_big',
> +	'gem_exec_blt',
> +	'gem_exec_capture',
> +	'gem_exec_create',
> +	'gem_exec_faulting_reloc',
> +	'gem_exec_fence',
> +	'gem_exec_flush',
> +	'gem_exec_gttfill',
> +	'gem_exec_latency',
> +	'gem_exec_lut_handle',
> +	'gem_exec_nop',
> +	'gem_exec_parallel',
> +	'gem_exec_params',
> +	'gem_exec_parse',
> +	'gem_exec_reloc',
> +	'gem_exec_reuse',
> +	'gem_exec_schedule',
> +	'gem_exec_store',
> +	'gem_exec_suspend',
> +	'gem_exec_whisper',
> +	'gem_fd_exhaustion',
> +	'gem_fence_thrash',
> +	'gem_fence_upload',
> +	'gem_fenced_exec_thrash',
> +	'gem_flink_basic',
> +	'gem_flink_race',
> +	'gem_gpgpu_fill',
> +	'gem_gtt_cpu_tlb',
> +	'gem_gtt_hog',
> +	'gem_gtt_speed',
> +	'gem_hangcheck_forcewake',
> +	'gem_largeobject',
> +	'gem_linear_blits',
> +	'gem_lut_handle',
> +	'gem_madvise',
> +	'gem_media_fill',
> +	'gem_mmap',
> +	'gem_mmap_gtt',
> +	'gem_mmap_offset_exhaustion',
> +	'gem_mmap_wc',
> +	'gem_mocs_settings',
> +	'gem_partial_pwrite_pread',
> +	'gem_persistent_relocs',
> +	'gem_pin',
> +	'gem_pipe_control_store_loop',
> +	'gem_ppgtt',
> +	'gem_pread',
> +	'gem_pread_after_blit',
> +	'gem_pwrite',
> +	'gem_pwrite_pread',
> +	'gem_pwrite_snooped',
> +	'gem_read_read_speed',
> +	'gem_readwrite',
> +	'gem_reg_read',
> +	'gem_reloc_overflow',
> +	'gem_reloc_vs_gpu',
> +	'gem_render_copy',
> +	'gem_render_copy_redux',
> +	'gem_render_linear_blits',
> +	'gem_render_tiled_blits',
> +	'gem_request_retire',
> +	'gem_reset_stats',
> +	'gem_ring_sync_copy',
> +	'gem_ring_sync_loop',
> +	'gem_ringfill',
> +	'gem_seqno_wrap',
> +	'gem_set_tiling_vs_blt',
> +	'gem_set_tiling_vs_gtt',
> +	'gem_set_tiling_vs_pwrite',
> +	'gem_shrink',
> +	'gem_softpin',
> +	'gem_spin_batch',
> +	'gem_stolen',
> +	'gem_storedw_batches_loop',
> +	'gem_storedw_loop',
> +	'gem_streaming_writes',
> +	'gem_sync',
> +	'gem_threaded_access_tiled',
> +	'gem_tiled_blits',
> +	'gem_tiled_fence_blits',
> +	'gem_tiled_partial_pwrite_pread',
> +	'gem_tiled_pread_basic',
> +	'gem_tiled_pread_pwrite',
> +	'gem_tiled_swapping',
> +	'gem_tiled_wb',
> +	'gem_tiled_wc',
> +	'gem_tiling_max_stride',
> +	'gem_unfence_active_buffers',
> +	'gem_unref_active_buffers',
> +	'gem_userptr_blits',
> +	'gem_wait',
> +	'gem_workarounds',
> +	'gem_write_read_ring_switch',
> +	'gen3_mixed_blits',
> +	'gen3_render_linear_blits',
> +	'gen3_render_mixed_blits',
> +	'gen3_render_tiledx_blits',
> +	'gen3_render_tiledy_blits',
> +	'gen7_forcewake_mt',
> +	'gvt_basic',
> +	'kms_3d',
> +	'kms_addfb_basic',
> +	'kms_atomic',
> +	'kms_atomic_transition',
> +	'kms_busy',
> +	'kms_ccs',
> +	'kms_chv_cursor_fail',
> +	'kms_concurrent',
> +	'kms_crtc_background_color',
> +	'kms_cursor_crc',
> +	'kms_cursor_legacy',
> +	'kms_draw_crc',
> +	'kms_fbc_crc',
> +	'kms_fbcon_fbt',
> +	'kms_fence_pin_leak',
> +	'kms_flip',
> +	'kms_flip_event_leak',
> +	'kms_flip_tiling',
> +	'kms_force_connector_basic',
> +	'kms_frontbuffer_tracking',
> +	'kms_hdmi_inject',
> +	'kms_invalid_dotclock',
> +	'kms_legacy_colorkey',
> +	'kms_mmap_write_crc',
> +	'kms_mmio_vs_cs_flip',
> +	'kms_panel_fitting',
> +	'kms_pipe_b_c_ivb',
> +	'kms_pipe_color',
> +	'kms_pipe_crc_basic',
> +	'kms_plane',
> +	'kms_plane_lowres',
> +	'kms_plane_multiple',
> +	'kms_plane_scaling',
> +	'kms_properties',
> +	'kms_psr_sink_crc',
> +	'kms_pwrite_crc',
> +	'kms_render',
> +	'kms_rmfb',
> +	'kms_rotation_crc',
> +	'kms_setmode',
> +	'kms_sink_crc_basic',
> +	'kms_sysfs_edid_timing',
> +	'kms_tv_load_detect',
> +	'kms_universal_plane',
> +	'kms_vblank',
> +	'meta_test',
> +	'perf',
> +	'pm_backlight',
> +	'pm_lpsp',
> +	'pm_rc6_residency',
> +	'pm_rpm',
> +	'pm_rps',
> +	'pm_sseu',
> +	'prime_busy',
> +	'prime_mmap',
> +	'prime_mmap_coherency',
> +	'prime_mmap_kms',
> +	'prime_self_import',
> +	'prime_udl',
> +	'prime_vgem',
> +	'sw_sync',
> +	'syncobj_basic',
> +	'template',
> +	'tools_test',
> +	'vgem_basic',
> +	'vgem_slow',
> +]
> +
> +test_deps = [ igt_deps ]
> +if libdrm_nouveau.found()
> +	test_progs += [
> +		'prime_nv_api',
> +		'prime_nv_pcopy',
> +		'prime_nv_test',
> +	]
> +	test_deps += libdrm_nouveau
> +endif
> +
> +if libdrm_vc4.found()
> +	test_progs += [
> +		'vc4_create_bo',
> +		'vc4_dmabuf_poll',
> +		'vc4_lookup_fail',
> +		'vc4_wait_bo',
> +		'vc4_wait_seqno',
> +	]
> +	test_deps += libdrm_vc4
> +endif
> +
> +if libdrm_amdgpu.found()
> +	# FIXME meson/ninja really doesn't like build targets with paths in them
> +	test_progs += [
> +		'amdgpu/amd_basic',
> +		'amdgpu/amd_cs_nop',
> +		'amdgpu/amd_prime',
> +	]
> +	test_deps += libdrm_amdgpu
> +endif
> +
> +if alsa.found()
> +	test_progs += [
> +		'audio',
> +	]
> +	test_deps += alsa
> +endif
> +
> +foreach prog : test_progs
> +	executable(prog, prog + '.c',
> +			dependencies : test_deps)
> +endforeach
> +
> +executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
> +		dependencies : test_deps)
> +test_progs += 'testdisplay'
> +
> +run_command('generate_testlist.sh', test_progs)
> +
> +test_script = find_program('igt_command_line.sh')
> +foreach prog : test_progs
> +	test('testcase check: ' + prog, test_script,
> +			args : prog)
> +endforeach
> +
> +executable('gem_stress', 'gem_stress.c', dependencies : igt_deps)
> +
> +# IMPORTANT: These tests here are all disabled because the result in sometime
> +# unrecoverable gpu hangs. Don't put real testcases here.
> +hang_progs = [
> +	'gem_bad_batch',
> +	'gem_hang',
> +	'gem_bad_blit',
> +	'gem_bad_address',
> +	'gem_non_secure_batch',
> +]
> +foreach prog : hang_progs
> +	executable(prog, prog + '.c',
> +			dependencies : igt_deps,
> +			install : false)
> +endforeach
> diff --git a/tools/meson.build b/tools/meson.build
> new file mode 100644
> index 000000000000..d2d4410e2130
> --- /dev/null
> +++ b/tools/meson.build
> @@ -0,0 +1,59 @@
> +tools_progs_noisnt = [
> +	'hsw_compute_wrpll',
> +	'skl_compute_wrpll',
> +	'skl_ddb_allocation',
> +]
> +
> +foreach prog : tools_progs_noisnt
> +	executable(prog, prog + '.c',
> +			dependencies : igt_deps,
> +			install : false)
> +endforeach
> +
> +tools_progs = [
> +	# FIXME we already have a libtestcase with this name as target
> +	#'igt_stats',
> +	'intel_audio_dump',
> +	'intel_backlight',
> +	'intel_bios_dumper',
> +	'intel_display_crc',
> +	'intel_display_poller',
> +	'intel_forcewaked',
> +	'intel_gpu_frequency',
> +	'intel_firmware_decode',
> +	'intel_gpu_time',
> +	'intel_gpu_top',
> +	'intel_gtt',
> +	'intel_guc_logger',
> +	'intel_infoframes',
> +	'intel_lid',
> +	'intel_opregion_decode',
> +	'intel_panel_fitter',
> +	'intel_reg_checker',
> +	'intel_residency',
> +	'intel_stepping',
> +	'intel_vbt_decode',
> +	'intel_watermark',
> +	'intel_gem_info',
> +	'intel_gvtg_test',
> +]
> +tool_deps = igt_deps
> +
> +if libdrm_intel.found()
> +	tools_progs += [
> +		'intel_dump_decode',
> +		'intel_error_decode',
> +		'intel_framebuffer_dump',
> +		'intel_perf_counters',
> +	]
> +	tool_deps += zlib
> +endif
> +
> +foreach prog : tools_progs
> +	executable(prog, prog + '.c',
> +			dependencies : tool_deps)
> +endforeach
> +
> +shared_library('intel_aubdump', 'aubdump.c', dependencies : [ igt_deps, dlsym ])
> +
> +subdir('null_state_gen')
> diff --git a/tools/null_state_gen/meson.build b/tools/null_state_gen/meson.build
> new file mode 100644
> index 000000000000..96697dbf64f1
> --- /dev/null
> +++ b/tools/null_state_gen/meson.build
> @@ -0,0 +1,15 @@
> +intel_null_state_gen_src = [
> +	'intel_batchbuffer.c',
> +	'intel_renderstate_gen6.c',
> +	'intel_renderstate_gen7.c',
> +	'intel_renderstate_gen8.c',
> +	'intel_renderstate_gen9.c',
> +	'intel_null_state_gen.c',
> +]
> +
> +intel_null_state_gen = executable('intel_null_state_gen',
> +		intel_null_state_gen_src, dependencies : igt_deps,
> +		install : false)
> +
> +# FIXME actual null_state generation. We probably want to push the the copyright
> +# header generation into intel_null_state_gen for simplicity
> -- 
> 2.9.5
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult
  2017-09-04  8:45     ` Daniel Vetter
@ 2017-09-04  9:27       ` Arkadiusz Hiler
  2017-09-04 10:26         ` Szwichtenberg, Radoslaw
  0 siblings, 1 reply; 32+ messages in thread
From: Arkadiusz Hiler @ 2017-09-04  9:27 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, Intel Graphics Development

On Mon, Sep 04, 2017 at 10:45:19AM +0200, Daniel Vetter wrote:
> On Mon, Sep 04, 2017 at 11:28:09AM +0300, Arkadiusz Hiler wrote:
> > On Sat, Sep 02, 2017 at 07:03:56PM +0200, Daniel Vetter wrote:
> > > We have it. Daniel Stone said it comes from the X11 transition to the
> > > modular build.
> > > 
> > > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > It's also used for Android builds, which lack the generated config.h.
> > 
> > But is this even used nowadays by anyone?
> > 
> > How we are going to deal with the Android.mk with the transition to
> > meson? Can we just drop them?
> > 
> > Android, in recent releases, is shifting from Makefiles to Soong.
> > anyway. <https://android.googlesource.com/platform/build/soong/>
> 
> Looking at recent igt patches, we've stuffed all the fancy stuff (e.g.
> chamelium) into Makefile.am, not Makefile.sources. And no one updated the
> android build.
> 
> Judging from that, I think the android build is already firmly in bitrot
> territory :-/
> 
> So yeah the plan would be to just leave it there, until someone cares
> more. From a few googles it looks like meson might be able to
> cross-compile into an android environment, but it won't be able to get
> integrated into the android image build.

I am actually leaning towards getting rid of it completely from the
tree, instead of making the illusion that Android is supported in any
way.

If someone will care and pick up the maintenance, this should be easy
enough to dig up from the history.

-- 
Arek

> We could also try to generate the Makefile.sources files from special
> meson targets (probably using the configuration generation stuff and a few
> templates).
> -Daniel
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult
  2017-09-04  9:27       ` Arkadiusz Hiler
@ 2017-09-04 10:26         ` Szwichtenberg, Radoslaw
  2017-09-04 10:35           ` Arkadiusz Hiler
  0 siblings, 1 reply; 32+ messages in thread
From: Szwichtenberg, Radoslaw @ 2017-09-04 10:26 UTC (permalink / raw)
  To: Hiler, Arkadiusz, daniel; +Cc: daniel.vetter, intel-gfx

On Mon, 2017-09-04 at 12:27 +0300, Arkadiusz Hiler wrote:
> On Mon, Sep 04, 2017 at 10:45:19AM +0200, Daniel Vetter wrote:
> > On Mon, Sep 04, 2017 at 11:28:09AM +0300, Arkadiusz Hiler wrote:
> > > On Sat, Sep 02, 2017 at 07:03:56PM +0200, Daniel Vetter wrote:
> > > > We have it. Daniel Stone said it comes from the X11 transition to the
> > > > modular build.
> > > > 
> > > > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > 
> > > It's also used for Android builds, which lack the generated config.h.
> > > 
> > > But is this even used nowadays by anyone?
We do use IGTs to test kernels used in Android. We do not use the latest version
of IGT though as we are using one of older kernel versions.
> > > 
> > > How we are going to deal with the Android.mk with the transition to
> > > meson? Can we just drop them?
> > > 
> > > Android, in recent releases, is shifting from Makefiles to Soong.
> > > anyway. <https://android.googlesource.com/platform/build/soong/>
> > 
> > Looking at recent igt patches, we've stuffed all the fancy stuff (e.g.
> > chamelium) into Makefile.am, not Makefile.sources. And no one updated the
> > android build.
We dont use/run chamelium tests - I guess we don't use any fancy stuff ;)
> > 
> > Judging from that, I think the android build is already firmly in bitrot
> > territory :-/
I do have automated build for latest IGTs on android N and so far all builds are
still passing.
> > 
> > So yeah the plan would be to just leave it there, until someone cares
> > more. From a few googles it looks like meson might be able to
> > cross-compile into an android environment, but it won't be able to get
> > integrated into the android image build.
> 
> I am actually leaning towards getting rid of it completely from the
> tree, instead of making the illusion that Android is supported in any
> way.
> 
> If someone will care and pick up the maintenance, this should be easy
> enough to dig up from the history.
> 
Is there no plan at all to support Android long term?

Thanks,
Radek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult
  2017-09-04 10:26         ` Szwichtenberg, Radoslaw
@ 2017-09-04 10:35           ` Arkadiusz Hiler
  0 siblings, 0 replies; 32+ messages in thread
From: Arkadiusz Hiler @ 2017-09-04 10:35 UTC (permalink / raw)
  To: Szwichtenberg, Radoslaw; +Cc: daniel.vetter, intel-gfx

On Mon, Sep 04, 2017 at 12:26:25PM +0200, Szwichtenberg, Radoslaw wrote:
> On Mon, 2017-09-04 at 12:27 +0300, Arkadiusz Hiler wrote:
> > On Mon, Sep 04, 2017 at 10:45:19AM +0200, Daniel Vetter wrote:
> > > On Mon, Sep 04, 2017 at 11:28:09AM +0300, Arkadiusz Hiler wrote:
> > > > On Sat, Sep 02, 2017 at 07:03:56PM +0200, Daniel Vetter wrote:
> > > > > We have it. Daniel Stone said it comes from the X11 transition to the
> > > > > modular build.
> > > > > 
> > > > > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > 
> > > > It's also used for Android builds, which lack the generated config.h.
> > > > 
> > > > But is this even used nowadays by anyone?
> We do use IGTs to test kernels used in Android. We do not use the latest version
> of IGT though as we are using one of older kernel versions.
> > > > 
> > > > How we are going to deal with the Android.mk with the transition to
> > > > meson? Can we just drop them?
> > > > 
> > > > Android, in recent releases, is shifting from Makefiles to Soong.
> > > > anyway. <https://android.googlesource.com/platform/build/soong/>
> > > 
> > > Looking at recent igt patches, we've stuffed all the fancy stuff (e.g.
> > > chamelium) into Makefile.am, not Makefile.sources. And no one updated the
> > > android build.
> We dont use/run chamelium tests - I guess we don't use any fancy stuff ;)
> > > 
> > > Judging from that, I think the android build is already firmly in bitrot
> > > territory :-/
> I do have automated build for latest IGTs on android N and so far all builds are
> still passing.

**If you want to help maintaining the Android build,**  I would be happy
to help you with making pre-merge testing out of what you have and
plugging the results into patchwork (and mailing list).

> > > 
> > > So yeah the plan would be to just leave it there, until someone cares
> > > more. From a few googles it looks like meson might be able to
> > > cross-compile into an android environment, but it won't be able to get
> > > integrated into the android image build.
> > 
> > I am actually leaning towards getting rid of it completely from the
> > tree, instead of making the illusion that Android is supported in any
> > way.
> > 
> > If someone will care and pick up the maintenance, this should be easy
> > enough to dig up from the history.
> > 
> Is there no plan at all to support Android long term?

On IGT side of things? Not to my knowledge. We are not building it or
running on anything.

We just need someone who cares, and have resources to keep this
maintained.

-- 
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 12/12] RFC: meson build system support
  2017-09-02 17:04 ` [PATCH i-g-t 12/12] RFC: meson build system support Daniel Vetter
  2017-09-04  9:11   ` Daniel Vetter
@ 2017-09-04 13:11   ` Jani Nikula
  2017-09-04 14:49     ` Daniel Vetter
  1 sibling, 1 reply; 32+ messages in thread
From: Jani Nikula @ 2017-09-04 13:11 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

On Sat, 02 Sep 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> +if cc.has_member('struct sysinfo', 'totalram',
> +		prefix : '#include <sys/sysinfo.h>')
> +	config_h.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
> +endif
> +
> +add_project_arguments('-D_GNU_SOURCE', language : 'c')

Just something that caught my eye that bit me in the past. The project
arguments are *not* passed on to feature tests such as
cc.has_member(). I don't think it matters in this case, but you'll want
to #define _GNU_SOURCE in the prefix if you're testing for GNU
stuff. Otherwise you may end up using compat versions. Just a heads up,
that's all.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 12/12] RFC: meson build system support
  2017-09-04 13:11   ` Jani Nikula
@ 2017-09-04 14:49     ` Daniel Vetter
  0 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2017-09-04 14:49 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter

On Mon, Sep 04, 2017 at 04:11:17PM +0300, Jani Nikula wrote:
> On Sat, 02 Sep 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > +if cc.has_member('struct sysinfo', 'totalram',
> > +		prefix : '#include <sys/sysinfo.h>')
> > +	config_h.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
> > +endif
> > +
> > +add_project_arguments('-D_GNU_SOURCE', language : 'c')
> 
> Just something that caught my eye that bit me in the past. The project
> arguments are *not* passed on to feature tests such as
> cc.has_member(). I don't think it matters in this case, but you'll want
> to #define _GNU_SOURCE in the prefix if you're testing for GNU
> stuff. Otherwise you may end up using compat versions. Just a heads up,
> that's all.

Ow, the fun. Well since the only has_member/function check we do have
right now tests for linux vs. solaris, we should probably be safe. Or at
least know really quickly when we're not safe.

For the android stuff, we'll probably just have one switch for is_android,
for all the things missing in bionic. Very obviously I've done none of the
"how should this work on android" thinking yet :-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-09-04 14:49 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-02 17:03 [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Daniel Vetter
2017-09-02 17:03 ` [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult Daniel Vetter
2017-09-03  9:29   ` Chris Wilson
2017-09-04  8:41     ` Daniel Vetter
2017-09-04  8:28   ` Arkadiusz Hiler
2017-09-04  8:45     ` Daniel Vetter
2017-09-04  9:27       ` Arkadiusz Hiler
2017-09-04 10:26         ` Szwichtenberg, Radoslaw
2017-09-04 10:35           ` Arkadiusz Hiler
2017-09-02 17:03 ` [PATCH i-g-t 03/12] build: use HAVE_LIBGEN_H consistently Daniel Vetter
2017-09-02 17:03 ` [PATCH i-g-t 04/12] build: remove _GNU_SOURCE from source files Daniel Vetter
2017-09-02 17:03 ` [PATCH i-g-t 05/12] tests/gem_spin_batch: Fix warning Daniel Vetter
2017-09-03  4:39   ` Eric Anholt
2017-09-02 17:04 ` [PATCH i-g-t 06/12] lib: prefix frame_dump_path Daniel Vetter
2017-09-02 17:04 ` [PATCH i-g-t 07/12] lib: clean up header includes Daniel Vetter
2017-09-02 17:04 ` [PATCH i-g-t 08/12] tests/igt_command_line.sh: Allow testing individual tests Daniel Vetter
2017-09-02 17:04 ` [PATCH i-g-t 09/12] lib/uwildmat: Use include paths Daniel Vetter
2017-09-02 17:04 ` [PATCH i-g-t 10/12] demos: remove Daniel Vetter
2017-09-02 17:04 ` [PATCH i-g-t 11/12] assembler/test: Prep work for meson Daniel Vetter
2017-09-02 17:04 ` [PATCH i-g-t 12/12] RFC: meson build system support Daniel Vetter
2017-09-04  9:11   ` Daniel Vetter
2017-09-04 13:11   ` Jani Nikula
2017-09-04 14:49     ` Daniel Vetter
2017-09-03  9:27 ` [PATCH i-g-t 01/12] build: Define _GNU_SOURCE in Makefile.am Chris Wilson
2017-09-04  8:48   ` Daniel Vetter
2017-09-04  9:08 ` [PATCH i-g-t 1/7] lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w Daniel Vetter
2017-09-04  9:08   ` [PATCH i-g-t 2/7] tests/kms_plane: Appease gcc -Wempty-body Daniel Vetter
2017-09-04  9:08   ` [PATCH i-g-t 3/7] meson: Add some compiler flags to reduce warnings Daniel Vetter
2017-09-04  9:08   ` [PATCH i-g-t 4/7] meson: Don't build the igt audio test without gsl available Daniel Vetter
2017-09-04  9:08   ` [PATCH i-g-t 5/7] meson: Use static libs to handle IGT_LOG_DOMAIN Daniel Vetter
2017-09-04  9:08   ` [PATCH i-g-t 6/7] meson: detect cc flags Daniel Vetter
2017-09-04  9:08   ` [PATCH i-g-t 7/7] meson: add manpage support Daniel Vetter

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.