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

2017-09-04 Thread Daniel Vetter
On Mon, Sep 04, 2017 at 04:11:17PM +0300, Jani Nikula wrote:
> On Sat, 02 Sep 2017, Daniel Vetter  wrote:
> > +if cc.has_member('struct sysinfo', 'totalram',
> > +   prefix : '#include ')
> > +   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


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

2017-09-04 Thread Jani Nikula
On Sat, 02 Sep 2017, Daniel Vetter  wrote:
> +if cc.has_member('struct sysinfo', 'totalram',
> + prefix : '#include ')
> + 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


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

2017-09-04 Thread 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ä 
> Cc: Eric Anholt 
> Cc: Daniel Stone 
> Signed-off-by: Daniel Vetter 
> ---
>  .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 ..b0e2db25
> --- /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 = [
> + 

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

2017-09-02 Thread 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ä 
Cc: Eric Anholt 
Cc: Daniel Stone 
Signed-off-by: Daniel Vetter 
---
 .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 ..b0e2db25
--- /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 ..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',
+