Skip to contentSkip to conversation

build: Define _GNU_SOURCE in Makefile.am

PATCH In review Daniel Vetter 7 participants 32 messages Sep 2, 2017 – Sep 4, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/12 build: Define _GNU_SOURCE in Makefile.am

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.

---
 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(-)
benchmarks/Makefile.am +1 -1
index 1232753917af..9d1838db1178 100644
@@ -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
lib/Makefile.am +1 -0
index 40399be12da9..abc61640dda4 100644
@@ -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
 
lib/tests/Makefile.am +1 -0
index 91440a27a5e8..661292a16446 100644
@@ -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)
tests/Makefile.am +1 -0
index 3d9ea87ef4ee..c7447e1fdafe 100644
@@ -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)
 
tools/Makefile.am +1 -1
index 5991b4988865..6307a4bd54d7 100644
@@ -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
 
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/12 build: Nuke #ifdef HAVE_CONFIG_H cargo-cult

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

---
 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(-)
lib/igt_alsa.h +0 -2
index f3949d262a4f..8f7724ad9727 100644
@@ -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>
lib/igt_audio.h +0 -2
index 507e7ab9c661..21adfee82756 100644
@@ -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>
lib/igt_chamelium.h +0 -2
index 2a0fa234ec60..a2d626eca957 100644
@@ -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>
lib/igt_frame.h +0 -2
index 1d9bbf6a7010..680ad5bbd293 100644
@@ -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>
lib/igt_x86.c +0 -2
index 6f03849f6ff2..0f0963ced044 100644
@@ -25,9 +25,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #ifdef HAVE_CPUID_H
 #include <cpuid.h>
lib/intel_os.c +0 -2
index e5dea6e5a619..6e0a46b3c35c 100644
@@ -26,9 +26,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <unistd.h>
 #include <stdlib.h>
overlay/overlay.h +0 -2
index 793816d2e044..7bc7ada7eafa 100644
@@ -25,9 +25,7 @@
 #ifndef OVERLAY_H
 #define OVERLAY_H
 
-#ifdef HAVE_CONFIG_H
 #include"config.h"
-#endif
 
 #include <cairo.h>
 
overlay/x11/position.c +0 -2
index cd0035394086..9e3db3709ef7 100644
@@ -22,9 +22,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <X11/Xlib.h>
 #ifdef HAVE_XRANDR
tests/amdgpu/amd_basic.c +0 -2
index 5e44b123fcaf..9f21de65bf10 100644
@@ -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>
tests/debugfs_test.c +0 -2
index 1663fd41eab8..5e7805e1559e 100644
@@ -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>
tests/gem_fence_thrash.c +0 -2
index 52095f26fdca..14d026a99f71 100644
@@ -26,9 +26,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <unistd.h>
tests/gem_fence_upload.c +0 -2
index 7d9acdc0fcb3..f3b0e62fa7a7 100644
@@ -25,9 +25,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <unistd.h>
tests/gem_render_linear_blits.c +0 -2
index 5fc8cc5e3abe..db34d427385a 100644
@@ -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>
tests/kms_flip.c +0 -2
index 837ebecda733..06cb3ff29351 100644
@@ -21,9 +21,7 @@
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 
tests/kms_render.c +0 -2
index fd33dfb7cafe..d2208e38f84e 100644
@@ -20,9 +20,7 @@
  * Authors:
  *    Imre Deak <[email protected]>
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <cairo.h>
tests/kms_setmode.c +0 -2
index a7a48de44b0e..206d360607bb 100644
@@ -20,9 +20,7 @@
  * Authors:
  *    Imre Deak <[email protected]>
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "igt.h"
 #include <cairo.h>
tests/testdisplay.c +0 -2
index f2a41fa0e53b..b0156c5cf0e1 100644
@@ -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>
tests/testdisplay_hotplug.c +0 -2
index cf1551183c56..ca1d849d978d 100644
@@ -29,9 +29,7 @@
 #include <sys/stat.h>
 
 #include "testdisplay.h"
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 
 #ifdef HAVE_UDEV
tests/tools_test.c +0 -2
index ccd165de6ca8..3122bb4f7da2 100644
@@ -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>
tools/intel_gpu_top.c +0 -2
index 3fe77f707705..7454de878dd1 100644
@@ -27,9 +27,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <unistd.h>
 #include <stdlib.h>
tools/intel_gvtg_test.c +0 -2
index 3db2c89bdac4..7a29fbdde7cd 100644
@@ -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>
tools/intel_l3_parity.c +0 -2
index eb00c50d33e4..26b7caaa1576 100644
@@ -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>
tools/intel_l3_udev_listener.c +0 -2
index 270bfff44f0f..57a0f0bf713b 100644
@@ -21,9 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #ifdef HAVE_UDEV
 #include <libudev.h>
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult

Quoting Daniel Vetter (2017-09-02 18:03:56)

Quoted 2 lines

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult

Quoted 8 lines · Chris Wilson

Quoting Daniel Vetter (2017-09-02 18:03:56)

Quoted 2 lines

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult

In reply to Daniel Vetter
Quoted 4 lines · Daniel Vetter

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

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/>

Signature · 6 lines
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult

Quoted 8 lines · Arkadiusz Hiler
Quoted 4 lines · Daniel Vetter

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

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

Quoted 7 lines

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult

Quoted 21 lines · Daniel Vetter
Quoted 8 lines · Arkadiusz Hiler
Quoted 4 lines · Daniel Vetter

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

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

Quoted 7 lines

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.

Quoted 7 lines

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.

Signature · 1 line
Arek
Quoted 8 lines

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

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult

Quoted 11 lines · Arkadiusz Hiler
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Arkadiusz Hiler
Quoted 4 lines · Daniel Vetter

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

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.

Quoted 10 lines
Quoted 10 lines
Quoted 6 lines

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 ;)

Quoted 3 lines
Quoted 3 lines

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.

Quoted 6 lines
Quoted 5 lines

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.

Quoted 7 lines

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [PATCH i-g-t 02/12] build: Nuke #ifdef HAVE_CONFIG_H cargo-cult

Quoted 24 lines · Radoslaw
Quoted 11 lines · Arkadiusz Hiler
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Arkadiusz Hiler
Quoted 4 lines · Daniel Vetter

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

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.

Quoted 10 lines
Quoted 10 lines
Quoted 6 lines

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.

Quoted 6 lines

We dont use/run chamelium tests - I guess we don't use any fancy stuff ;)

Quoted 3 lines
Quoted 3 lines

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).

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

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.

Quoted 8 lines
Quoted 7 lines

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.

Signature · 6 lines
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 3/12 build: use HAVE_LIBGEN_H consistently

In reply to Daniel Vetter

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

The next patch will remove _GNU_SOURCE everywhere else.

---
 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(-)
lib/drmtest.c +1 -3
index 158af68283b8..8a07152c701a 100644
@@ -26,9 +26,7 @@
  *
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <stdio.h>
lib/igt_aux.c +1 -3
index d808fe3ed27a..0c83a1f48ed2 100644
@@ -26,9 +26,7 @@
  *
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <stdio.h>
lib/igt_core.c +1 -3
index 99a82d5ae0e1..cf15db69c661 100644
@@ -26,9 +26,7 @@
  *
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <stdio.h>
lib/ioctl_wrappers.c +1 -3
index 51000bac0513..b4d6210d5942 100644
@@ -26,9 +26,7 @@
  *
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <stdio.h>
lib/sw_sync.c +1 -3
index 7bd76702c8d1..9b36dd85c192 100644
@@ -24,9 +24,7 @@
  *    Robert Foss <[email protected]>
  */
 
-#ifndef ANDROID
-#define _GNU_SOURCE
-#else
+#ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
 #include <fcntl.h>
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 4/12 build: remove _GNU_SOURCE from source files

In reply to Daniel Vetter

We are, the build system takes care of that.

---
 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(-)
benchmarks/gem_exec_tracer.c +0 -2
index a49c11a967f0..8ee29b5d8916 100644
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _GNU_SOURCE /* for RTLD_NEXT */
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
benchmarks/gem_latency.c +0 -1
index 6cb16ba4f051..c3fc4bf0f74c 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <pthread.h>
 
 #include "igt.h"
benchmarks/gem_syslatency.c +0 -2
index 83bfac78d02b..4ed23638e717 100644
@@ -22,8 +22,6 @@
  *
  */
 
-#define _GNU_SOURCE
-
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
lib/igt_fb.c +0 -1
index fbdfca8ad278..95434a699dcf 100644
@@ -25,7 +25,6 @@
  * 	Damien Lespiau <[email protected]>
  */
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <math.h>
 
lib/igt_vgem.c +0 -2
index 21cccb375c51..3dd9621d0459 100644
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _GNU_SOURCE
-
 #include "igt.h"
 #include "igt_vgem.h"
 
lib/tests/igt_exit_handler.c +0 -1
index d1b5a8891739..f2997bd13633 100644
@@ -21,7 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _GNU_SOURCE
 #include <assert.h>
 #include <unistd.h>
 #include <fcntl.h>
tests/core_get_client_auth.c +0 -1
index 50e87fac76d6..676083d5e322 100644
@@ -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>
tests/core_setmaster_vs_auth.c +0 -1
index 783033397939..f1ae0c6338fa 100644
@@ -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>
tests/drm_import_export.c +0 -1
index f1234bdcc411..e3ce2480c7f1 100644
@@ -24,7 +24,6 @@
  *    Daniel Vetter <[email protected]>
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <stdio.h>
 #include <sys/types.h>
tests/drv_missed_irq.c +0 -1
index fb81f277f5fc..469be882d39c 100644
@@ -22,7 +22,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <sched.h>
 
 #include "igt.h"
tests/gem_fenced_exec_thrash.c +0 -2
index e403a49155b6..9a43c845e671 100644
@@ -25,8 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
-
 #include "igt.h"
 #include <stdlib.h>
 #include <sys/ioctl.h>
tests/gem_flink_race.c +0 -1
index 30e33f65a7dc..9e3d3a622297 100644
@@ -24,7 +24,6 @@
  *    Daniel Vetter <[email protected]>
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <sys/ioctl.h>
 #include <stdlib.h>
tests/gem_mmap_gtt.c +0 -1
index 4ff5e7f15f81..0f5981257a01 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
tests/gem_mmap_wc.c +0 -1
index fd7988073075..110883eb9a61 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
tests/gem_persistent_relocs.c +0 -1
index bc831ee49920..452fe686e9a5 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <stdlib.h>
 #include <stdio.h>
tests/gem_reloc_vs_gpu.c +0 -1
index afc31328fdc2..d421e4340d62 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <stdlib.h>
 #include <stdio.h>
tests/gem_reset_stats.c +0 -1
index 9ac08aabf3a5..edc407676393 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include "igt_sysfs.h"
 #include <limits.h>
tests/gem_streaming_writes.c +0 -1
index c27e7fa75dc7..e83d69debc5e 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
tests/gem_workarounds.c +0 -1
index c7286d86b7a0..d6641bd5578f 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 
 #include <fcntl.h>
tests/kms_cursor_legacy.c +0 -1
index bdb66f3b51b7..2d32d3a91570 100644
@@ -22,7 +22,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <sched.h>
 #include <sys/poll.h>
 
tests/pm_rc6_residency.c +0 -1
index bdb9747a7ad9..7c87302dcab3 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include "igt_sysfs.h"
 #include <stdio.h>
tests/pm_rps.c +0 -1
index f0455e78752e..8b543bb8506c 100644
@@ -26,7 +26,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include "igt.h"
 #include <stdio.h>
 #include <stdlib.h>
tests/prime_mmap.c +0 -1
index 1ea61c2fda0d..0da0aa681158 100644
@@ -29,7 +29,6 @@
 /*
  * Testcase: Check whether mmap()ing dma-buf works
  */
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
tests/prime_self_import.c +0 -1
index 992334d4bf7d..8c4f53218454 100644
@@ -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>
tools/aubdump.c +0 -2
index 4387ea8399a2..4392e589193b 100644
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _GNU_SOURCE /* for RTLD_NEXT */
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
tools/intel_audio_dump.c +0 -1
index c8d369b548cb..90260a2fe007 100644
@@ -26,7 +26,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
tools/intel_dump_decode.c +0 -1
index 0341aada4016..4bb774406f96 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
tools/intel_error_decode.c +0 -1
index 2cbdd8873edd..cdef3b18ad0e 100644
@@ -38,7 +38,6 @@
  * decode, but never crash in the process.
  */
 
-#define _GNU_SOURCE
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
tools/intel_framebuffer_dump.c +0 -1
index 624a96136137..79c0688b1e70 100644
@@ -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>
tools/intel_gpu_frequency.c +0 -1
index cb758b0a6481..5c439b036a16 100644
@@ -46,7 +46,6 @@
  * intel_gpu_frequency -d
  */
 
-#define _GNU_SOURCE
 #include <assert.h>
 #include <getopt.h>
 #include <stdio.h>
tools/intel_guc_logger.c +0 -1
index 3079878e1191..7c6115a669f6 100644
@@ -1,5 +1,4 @@
 
-#define _GNU_SOURCE  /* For using O_DIRECT */
 #include <inttypes.h>
 #include <stdio.h>
 #include <fcntl.h>
tools/intel_l3_parity.c +0 -1
index 26b7caaa1576..9df4fc2477f2 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#define _GNU_SOURCE
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <assert.h>
tools/intel_l3_udev_listener.c +0 -3
index 57a0f0bf713b..94d931e507bb 100644
@@ -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>
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 5/12 tests/gem_spin_batch: Fix warning

In reply to Daniel Vetter
---
 tests/gem_spin_batch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/gem_spin_batch.c +1 -1
index 941aa1399ae1..09bb3cb37108 100644
@@ -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);
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

PATCH 6/12 lib: prefix frame_dump_path

In reply to Daniel Vetter

Just a bit of ocd for anything non-static.

---
 lib/igt_core.c  | 12 ++++++------
 lib/igt_core.h  |  2 +-
 lib/igt_frame.c | 10 +++++-----
 3 files changed, 12 insertions(+), 12 deletions(-)
lib/igt_core.c +6 -6
index cf15db69c661..017c63048f1e 100644
@@ -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,
lib/igt_core.h +1 -1
index 619c45c6df90..516980e84740 100644
@@ -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:
lib/igt_frame.c +5 -5
index 222a45f801f3..0f6bca243e39 100644
@@ -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);
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH 7/12 lib: clean up header includes

In reply to 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.

---
 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(-)
lib/igt_alsa.c +2 -1
index b5574c7622a1..3ad0521aa6ee 100644
@@ -28,7 +28,8 @@
 
 #include <alsa/asoundlib.h>
 
-#include "igt.h"
+#include "igt_alsa.h"
+#include "igt_core.h"
 
 #define HANDLES_MAX	8
 
lib/igt_alsa.h +0 -1
index 8f7724ad9727..50795130a4f8 100644
@@ -29,7 +29,6 @@
 
 #include "config.h"
 
-#include "igt.h"
 #include <stdbool.h>
 
 struct alsa;
lib/igt_audio.c +2 -1
index 6b35529aa224..2321d1c6e3f1 100644
@@ -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
 
lib/igt_audio.h +0 -1
index 21adfee82756..b3b658a4017f 100644
@@ -29,7 +29,6 @@
 
 #include "config.h"
 
-#include "igt.h"
 #include <stdbool.h>
 
 struct audio_signal;
lib/igt_chamelium.c +5 -1
index dcd8855f3d1b..fb250366ca2c 100644
@@ -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
lib/igt_chamelium.h +5 -1
index a2d626eca957..af9655a0b1cf 100644
@@ -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;
lib/igt_dummyload.c +9 -2
index f2a94b5572ea..a2061ff6138e 100644
@@ -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
lib/igt_frame.c +2 -1
index 0f6bca243e39..6984c02e9912 100644
@@ -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
lib/igt_frame.h +0 -1
index 680ad5bbd293..11f96cbea203 100644
@@ -29,7 +29,6 @@
 
 #include "config.h"
 
-#include "igt.h"
 #include <stdbool.h>
 
 bool igt_frame_dump_is_enabled(void);
lib/igt_gvt.c +5 -5
index a78e98e9f233..acbc349145ce 100644
@@ -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
lib/igt_kmod.c +3 -3
index 26691e308cbd..58624cd12f32 100644
@@ -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
lib/igt_sysfs.h +1 -0
index d666438a667a..07e75042307a 100644
@@ -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);
lib/igt_vgem.c +7 -3
index 3dd9621d0459..7f933b23bd4f 100644
@@ -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
lib/igt_vgem.h +1 -0
index 002ad7f09ceb..92045f0e7a81 100644
@@ -25,6 +25,7 @@
 #define IGT_VGEM_H
 
 #include <stdint.h>
+#include <stdbool.h>
 
 struct vgem_bo {
 	uint32_t handle;
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

PATCH 8/12 tests/igt_command_line.sh: Allow testing individual tests

In reply to Daniel Vetter

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

---
 tests/igt_command_line.sh | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)
tests/igt_command_line.sh +26 -13
index 7f80fc805d37..f98a584a8ea3 100755
@@ -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
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

PATCH 9/12 lib/uwildmat: Use include paths

In reply to 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.

---
 lib/uwildmat/uwildmat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/uwildmat/uwildmat.c +1 -1
index fac2319e1a8c..09155865de7b 100644
@@ -95,7 +95,7 @@
 
 #include <string.h>
 #include <stdint.h>
-#include "uwildmat.h"
+#include "uwildmat/uwildmat.h"
 
 #define ABORT -1
 
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

PATCH 10/12 demos: remove

In reply to 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.

---
 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
Makefile.am +1 -1
index 601686282c64..8c25402789f3 100644
@@ -36,7 +36,7 @@ if BUILD_SHADER_DEBUGGER
 SUBDIRS += debugger
 endif
 
-SUBDIRS += overlay demos benchmarks
+SUBDIRS += overlay benchmarks
 endif
 
 SUBDIRS += docs
demos/.gitignore deleted +0 -1
deleted file mode 100644
index cd80b0b5f259..000000000000
@@ -1 +0,0 @@
-intel_sprite_on
demos/Android.mk deleted +0 -32
deleted file mode 100644
index 1f50fdcb7e82..000000000000
@@ -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)
-
-#================#
demos/Makefile.am deleted +0 -12
deleted file mode 100644
index 031595c1f52f..000000000000
@@ -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
demos/Makefile.sources deleted +0 -7
deleted file mode 100644
index aea363f9ba17..000000000000
@@ -1,7 +0,0 @@
-demos_prog_list =		\
-	$(NULL)
-
-LIBDRM_INTEL_BIN =		\
-	intel_sprite_on		\
-	$(NULL)
-
demos/intel_sprite_on.c deleted +0 -960

960 lines not on this page · raw message

Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

PATCH 11/12 assembler/test: Prep work for meson

In reply to 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.

---
 assembler/test/run-test.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
assembler/test/run-test.sh +12 -4
index 20a408c61b2d..0a5252a89dc7 100644
@@ -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
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

PATCH 12/12 RFC: meson build system support

In reply to 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ä <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Daniel Stone <[email protected]>
---
 .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
.gitignore +1 -0
index 6204965a0e32..e6919272d8b6 100644
@@ -93,3 +93,4 @@ intel-gpu-tools-*/
 
 piglit
 results
+build
assembler/meson.build new file +73 -0

73 lines not on this page · raw message

benchmarks/meson.build new file +36 -0
new file mode 100644
index 000000000000..9ab738f76588
@@ -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
lib/meson.build new file +166 -0

166 lines not on this page · raw message

lib/prepend_log_domain.sh new file +8 -0
new file mode 100755
index 000000000000..93a911508b7f
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+input=$1
+output=$2
+basename=$(basename $1 .c)
+
+echo "#define IGT_LOG_DOMAIN \"$basename\"" > $output
+cat $input >> $output
lib/tests/meson.build new file +34 -0
new file mode 100644
index 000000000000..29bdb2c4222c
@@ -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
lib/version.h.in new file +1 -0
new file mode 100644
index 000000000000..72fc6978cf32
@@ -0,0 +1 @@
+#define IGT_GIT_SHA1 "@VCS_TAG@"
meson.build new file +105 -0

105 lines not on this page · raw message

overlay/meson.build new file +59 -0

59 lines not on this page · raw message

tests/generate_testlist.sh new file +10 -0
new file mode 100755
index 000000000000..6ea78655daca
@@ -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
tests/meson.build new file +290 -0

290 lines not on this page · raw message

tools/meson.build new file +59 -0

59 lines not on this page · raw message

tools/null_state_gen/meson.build new file +15 -0
new file mode 100644
index 000000000000..96697dbf64f1
@@ -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
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [PATCH i-g-t 12/12] RFC: meson build system support

Quoted 19 lines · 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)

Quoted 8 lines

- 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.

Quoted 2 lines

- 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.

Quoted 1 line

- 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

Quoted 973 lines
Cc Ville Syrjälä <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Daniel Stone <[email protected]>
---
 .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
.gitignore +1 -0
index 6204965a0e32..e6919272d8b6 100644
@@ -93,3 +93,4 @@ intel-gpu-tools-*/
 
 piglit
 results
+build
assembler/meson.build new file +73 -0
new file mode 100644
index 000000000000..bdddd0e2db25
@@ -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 : '@[email protected]',
+		arguments : ['-o', '@OUTPUT@', '@INPUT@'])
+
+lfiles = lgen.process('lex.l')
+
+pgen = generator(bison,
+		output : ['@[email protected]', '@[email protected]'],
+		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
benchmarks/meson.build new file +36 -0
new file mode 100644
index 000000000000..9ab738f76588
@@ -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
lib/meson.build new file +166 -0
new file mode 100644
index 000000000000..51d3f9e278da
@@ -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')
lib/prepend_log_domain.sh new file +8 -0
new file mode 100755
index 000000000000..93a911508b7f
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+input=$1
+output=$2
+basename=$(basename $1 .c)
+
+echo "#define IGT_LOG_DOMAIN \"$basename\"" > $output
+cat $input >> $output
lib/tests/meson.build new file +34 -0
new file mode 100644
index 000000000000..29bdb2c4222c
@@ -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
lib/version.h.in new file +1 -0
new file mode 100644
index 000000000000..72fc6978cf32
@@ -0,0 +1 @@
+#define IGT_GIT_SHA1 "@VCS_TAG@"
meson.build new file +105 -0
new file mode 100644
index 000000000000..fee64fcdf36e
@@ -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
overlay/meson.build new file +59 -0
new file mode 100644
index 000000000000..a4b778ca5a86
@@ -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
tests/generate_testlist.sh new file +10 -0
new file mode 100755
index 000000000000..6ea78655daca
@@ -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
tests/meson.build new file +290 -0
new file mode 100644
index 000000000000..73833758be0e
@@ -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
tools/meson.build new file +59 -0
new file mode 100644
index 000000000000..d2d4410e2130
@@ -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')
tools/null_state_gen/meson.build new file +15 -0
new file mode 100644
index 000000000000..96697dbf64f1
@@ -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
Signature · 1 line
2.9.5
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH i-g-t 12/12] RFC: meson build system support

In reply to Daniel Vetter

meson.build line 89

Quoted 6 lines · Daniel Vetter
meson.build new file +6 -0
+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.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

Re: [PATCH i-g-t 12/12] RFC: meson build system support

Quoted 14 lines · Jani Nikula

meson.build line 89

Quoted 6 lines · Daniel Vetter
meson.build new file +6 -0
+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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw
In reply to Daniel Vetter

Quoting Daniel Vetter (2017-09-02 18:03:55)

Quoted 2 lines

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw
Quoted 7 lines · Chris Wilson

Quoting Daniel Vetter (2017-09-02 18:03:55)

Quoted 2 lines

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#25 lore raw

PATCH 1/7 lib/ioctl_wrappers: make the valgrind wrapper always emit a statement:w

In reply to Daniel Vetter

gcc complains otherwise about empty ; statements ...

---
 lib/ioctl_wrappers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ioctl_wrappers.c +1 -1
index b4d6210d5942..48750427a0c1 100644
@@ -60,7 +60,7 @@
 
 #define VG(x) x
 #else
-#define VG(x)
+#define VG(x) do {} while (0)
 #endif
 
 #include "ioctl_wrappers.h"
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#26 lore raw

PATCH 2/7 tests/kms_plane: Appease gcc -Wempty-body

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

---
 tests/kms_plane.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/kms_plane.c +2 -1
index 927d5d37fece..812497500d2d 100644
@@ -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);
 
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#27 lore raw

PATCH 3/7 meson: Add some compiler flags to reduce warnings.

In reply to Daniel Vetter

From: Eric Anholt <[email protected]>

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

---
 meson.build | 11 +++++++++++
 1 file changed, 11 insertions(+)
meson.build +11 -0
index fee64fcdf36e..4d6985d191f9 100644
@@ -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()
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#28 lore raw

PATCH 4/7 meson: Don't build the igt audio test without gsl available.

In reply to Daniel Vetter

From: Eric Anholt <[email protected]>

---
 tests/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/meson.build +1 -1
index 73833758be0e..4dd5a9c9d4c7 100644
@@ -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',
 	]
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#29 lore raw

PATCH 5/7 meson: Use static libs to handle IGT_LOG_DOMAIN.

In reply to Daniel Vetter

From: Eric Anholt <[email protected]>

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.

---
 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
lib/dummy.c new file +0 -0
new file mode 100644
index 000000000000..e69de29bb2d1
lib/meson.build +25 -11
index 51d3f9e278da..f0672edf1830 100644
@@ -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)
lib/prepend_log_domain.sh deleted +0 -8
deleted file mode 100755
index 93a911508b7f..000000000000
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-input=$1
-output=$2
-basename=$(basename $1 .c)
-
-echo "#define IGT_LOG_DOMAIN \"$basename\"" > $output
-cat $input >> $output
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#30 lore raw

PATCH 6/7 meson: detect cc flags

In reply to 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

---
 meson.build | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
meson.build +14 -8
index 4d6985d191f9..39749a0e1103 100644
@@ -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', '.')
 
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#31 lore raw

PATCH 7/7 meson: add manpage support

In reply to 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.

---
 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
man/defs.rst.in new file +5 -0
new file mode 100644
index 000000000000..54b7eec08903
@@ -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
man/meson.build new file +45 -0

45 lines not on this page · raw message

man/rst2man.sh new file +16 -0
new file mode 100755
index 000000000000..fc2b5ed863b1
@@ -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}
meson.build +1 -0
index 39749a0e1103..2b49a0db6500 100644
@@ -120,3 +120,4 @@ if libdrm_intel.found()
 	subdir('assembler')
 	subdir('overlay')
 endif
+subdir('man')
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx