All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Meson build system
@ 2018-01-03 21:31 Dylan Baker
  2018-01-03 21:31 ` [PATCH 1/3] Add meson " Dylan Baker
                   ` (4 more replies)
  0 siblings, 5 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-03 21:31 UTC (permalink / raw)
  To: mesa-dev, dri-devel

This is a third iteration of the meson build system for libdrm. This
version is significantly cleaned up from the last version and uses a
style more like the build system in mesa.

It builds all of the drivers and tests, and the tests can be run via
`ninja test`.

It has support for being used as a wrapped dependency wit ext_foo
variables. This means it can be used to build a mesa that requires a
newer libdrm than the system provides (which can be especially useful if
you can't install packages on that system) and for testing.

This has been build tested only.

Dylan Baker (3):
  Add meson build system
  autotools: Include meson.build files in tarball
  README: Add note about meson

 .editorconfig               |   4 +-
 Makefile.am                 |  30 ++-
 README                      |  21 +-
 amdgpu/.editorconfig        |   5 +-
 amdgpu/meson.build          |  70 +++++++-
 data/meson.build            |  27 +++-
 etnaviv/meson.build         |  64 ++++++-
 exynos/meson.build          |  53 +++++-
 freedreno/meson.build       |  82 ++++++++-
 intel/meson.build           | 111 +++++++++++-
 libkms/meson.build          |  75 +++++++-
 man/meson.build             |  66 ++++++-
 meson.build                 | 378 +++++++++++++++++++++++++++++++++++++-
 meson_options.txt           |  38 ++++-
 nouveau/meson.build         |  65 ++++++-
 omap/meson.build            |  53 +++++-
 radeon/meson.build          |  65 ++++++-
 tegra/meson.build           |  52 +++++-
 tests/amdgpu/meson.build    |  40 ++++-
 tests/etnaviv/meson.build   |  54 +++++-
 tests/exynos/meson.build    |  54 +++++-
 tests/kms/meson.build       |  54 +++++-
 tests/kmstest/meson.build   |  28 +++-
 tests/meson.build           |  85 ++++++++-
 tests/modeprint/meson.build |  29 +++-
 tests/nouveau/meson.build   |  30 +++-
 tests/proptest/meson.build  |  30 +++-
 tests/radeon/meson.build    |  27 +++-
 tests/tegra/meson.build     |  27 +++-
 tests/util/meson.build      |  37 ++++-
 tests/vbltest/meson.build   |  28 +++-
 vc4/meson.build             |  28 +++-
 32 files changed, 1806 insertions(+), 4 deletions(-)
 create mode 100644 amdgpu/meson.build
 create mode 100644 data/meson.build
 create mode 100644 etnaviv/meson.build
 create mode 100644 exynos/meson.build
 create mode 100644 freedreno/meson.build
 create mode 100644 intel/meson.build
 create mode 100644 libkms/meson.build
 create mode 100644 man/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 nouveau/meson.build
 create mode 100644 omap/meson.build
 create mode 100644 radeon/meson.build
 create mode 100644 tegra/meson.build
 create mode 100644 tests/amdgpu/meson.build
 create mode 100644 tests/etnaviv/meson.build
 create mode 100644 tests/exynos/meson.build
 create mode 100644 tests/kms/meson.build
 create mode 100644 tests/kmstest/meson.build
 create mode 100644 tests/meson.build
 create mode 100644 tests/modeprint/meson.build
 create mode 100644 tests/nouveau/meson.build
 create mode 100644 tests/proptest/meson.build
 create mode 100644 tests/radeon/meson.build
 create mode 100644 tests/tegra/meson.build
 create mode 100644 tests/util/meson.build
 create mode 100644 tests/vbltest/meson.build
 create mode 100644 vc4/meson.build

base-commit: 831036a6f62005da9fb4a75fe043bd96ce672d27
-- 
git-series 0.9.1
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

* [PATCH 1/3] Add meson build system
  2018-01-03 21:31 [PATCH 0/3] Meson build system Dylan Baker
@ 2018-01-03 21:31 ` Dylan Baker
  2018-01-03 22:18   ` Dylan Baker
                     ` (2 more replies)
  2018-01-03 21:31 ` [PATCH 2/3] autotools: Include meson.build files in tarball Dylan Baker
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-03 21:31 UTC (permalink / raw)
  To: mesa-dev, dri-devel

This patch adds a complete meson build system, including tests and
install. It has the necessary hooks to allow it be used as a subproject
for other meson based builds such as mesa.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
 .editorconfig               |   4 +-
 amdgpu/.editorconfig        |   5 +-
 amdgpu/meson.build          |  70 +++++++-
 data/meson.build            |  27 +++-
 etnaviv/meson.build         |  64 ++++++-
 exynos/meson.build          |  53 +++++-
 freedreno/meson.build       |  82 ++++++++-
 intel/meson.build           | 111 +++++++++++-
 libkms/meson.build          |  75 +++++++-
 man/meson.build             |  66 ++++++-
 meson.build                 | 378 +++++++++++++++++++++++++++++++++++++-
 meson_options.txt           |  38 ++++-
 nouveau/meson.build         |  65 ++++++-
 omap/meson.build            |  53 +++++-
 radeon/meson.build          |  65 ++++++-
 tegra/meson.build           |  52 +++++-
 tests/amdgpu/meson.build    |  40 ++++-
 tests/etnaviv/meson.build   |  54 +++++-
 tests/exynos/meson.build    |  54 +++++-
 tests/kms/meson.build       |  54 +++++-
 tests/kmstest/meson.build   |  28 +++-
 tests/meson.build           |  85 ++++++++-
 tests/modeprint/meson.build |  29 +++-
 tests/nouveau/meson.build   |  30 +++-
 tests/proptest/meson.build  |  30 +++-
 tests/radeon/meson.build    |  27 +++-
 tests/tegra/meson.build     |  27 +++-
 tests/util/meson.build      |  37 ++++-
 tests/vbltest/meson.build   |  28 +++-
 vc4/meson.build             |  28 +++-
 30 files changed, 1759 insertions(+)
 create mode 100644 amdgpu/meson.build
 create mode 100644 data/meson.build
 create mode 100644 etnaviv/meson.build
 create mode 100644 exynos/meson.build
 create mode 100644 freedreno/meson.build
 create mode 100644 intel/meson.build
 create mode 100644 libkms/meson.build
 create mode 100644 man/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 nouveau/meson.build
 create mode 100644 omap/meson.build
 create mode 100644 radeon/meson.build
 create mode 100644 tegra/meson.build
 create mode 100644 tests/amdgpu/meson.build
 create mode 100644 tests/etnaviv/meson.build
 create mode 100644 tests/exynos/meson.build
 create mode 100644 tests/kms/meson.build
 create mode 100644 tests/kmstest/meson.build
 create mode 100644 tests/meson.build
 create mode 100644 tests/modeprint/meson.build
 create mode 100644 tests/nouveau/meson.build
 create mode 100644 tests/proptest/meson.build
 create mode 100644 tests/radeon/meson.build
 create mode 100644 tests/tegra/meson.build
 create mode 100644 tests/util/meson.build
 create mode 100644 tests/vbltest/meson.build
 create mode 100644 vc4/meson.build

diff --git a/.editorconfig b/.editorconfig
index 893b7be..bbad3e6 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -17,3 +17,7 @@ indent_style = tab
 [*.m4]
 indent_style = space
 indent_size = 2
+
+[meson.build,meson_options.txt]
+indent_style = space
+indent_size = 2
diff --git a/amdgpu/.editorconfig b/amdgpu/.editorconfig
index 2528d67..0c758d6 100644
--- a/amdgpu/.editorconfig
+++ b/amdgpu/.editorconfig
@@ -7,3 +7,8 @@ indent_style = tab
 indent_size = 8
 tab_width = 8
 insert_final_newline = true
+
+[meson.build]
+indent_style = space
+indent_size = 2
+insert_final_newline = false
diff --git a/amdgpu/meson.build b/amdgpu/meson.build
new file mode 100644
index 0000000..13bf88b
--- /dev/null
+++ b/amdgpu/meson.build
@@ -0,0 +1,70 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_amdgpu = files(
+  'amdgpu_asic_id.c',
+  'amdgpu_bo.c',
+  'amdgpu_cs.c',
+  'amdgpu_device.c',
+  'amdgpu_gpu_info.c',
+  'amdgpu_internal.h',
+  'amdgpu_vamgr.c',
+  'amdgpu_vm.c',
+  'util_hash.c',
+  'util_hash.h',
+  'util_hash_table.c',
+  'util_hash_table.h',
+)
+
+libdrm_amdgpu = shared_library(
+  'drm_amdgpu',
+  [files_amdgpu, config_file],
+  c_args : [
+    warn_c_args,
+    '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(get_option('datadir'), 'amdgpu.ids')),
+  ],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('amdgpu.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_amdgpu',
+  libraries : libdrm_amdgpu,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to kernel DRM services for amdgpu',
+)
+
+ext_libdrm_amdgpu = declare_dependency(
+  link_with : [libdrm, libdrm_amdgpu],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+test(
+  'amdgpu-symbol-check',
+  prog_bash,
+  args : [files('amdgpu-symbol-check'), libdrm_amdgpu]
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..4990ca5
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+if with_amdgpu
+  install_data(
+    'amdgpu.ids',
+    install_mode : 'r--r--r--',
+    install_dir : join_paths(get_option('datadir'), 'libdrm'),
+  )
+endif
diff --git a/etnaviv/meson.build b/etnaviv/meson.build
new file mode 100644
index 0000000..8f39775
--- /dev/null
+++ b/etnaviv/meson.build
@@ -0,0 +1,64 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_etnaviv = files(
+  'etnaviv_device.c',
+  'etnaviv_gpu.c',
+  'etnaviv_bo.c',
+  'etnaviv_bo_cache.c',
+  'etnaviv_perfmon.c',
+  'etnaviv_pipe.c',
+  'etnaviv_cmd_stream.c',
+  'etnaviv_drm.h',
+  'etnaviv_priv.h',
+)
+
+libdrm_etnaviv = shared_library(
+  'drm_etnaviv',
+  [files_etnaviv, config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+  dependencies : [dep_pthread_stubs, dep_rt],
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('etnaviv_drmif.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_etnaviv',
+  libraries : libdrm_etnaviv,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to Tegra kernel DRM services',
+)
+
+ext_libdrm_etnaviv = declare_dependency(
+  link_with : [libdrm, libdrm_etnaviv],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+test(
+  'etnaviv-symbol-check',
+  prog_bash,
+  args : [files('etnaviv-symbol-check'), libdrm_etnaviv]
+)
diff --git a/exynos/meson.build b/exynos/meson.build
new file mode 100644
index 0000000..7da74aa
--- /dev/null
+++ b/exynos/meson.build
@@ -0,0 +1,53 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_exynos = shared_library(
+  'drm_exynos',
+  [files('exynos_drm.c', 'exynos_fimg2d.c', 'fimg2d_reg.h'), config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('exynos_drmif.h', subdir : 'libdrm')
+install_headers('exynos_drm.h', 'exynos_fimg2d.h', subdir : 'exynos')
+
+ext_libdrm_exynos = declare_dependency(
+  link_with : [libdrm, libdrm_exynos],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+pkg.generate(
+  name : 'libdrm_exynos',
+  libraries : libdrm_exynos,
+  subdirs : ['.', 'libdrm', 'exynos'],
+  version : '0.7',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to exynos kernel DRM services',
+)
+
+test(
+  'exynos-symbol-check',
+  prog_bash,
+  args : [files('exynos-symbol-check'), libdrm_exynos]
+)
diff --git a/freedreno/meson.build b/freedreno/meson.build
new file mode 100644
index 0000000..47d6e44
--- /dev/null
+++ b/freedreno/meson.build
@@ -0,0 +1,82 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_freedreno = files(
+  'freedreno_device.c',
+  'freedreno_pipe.c',
+  'freedreno_priv.h',
+  'freedreno_ringbuffer.c',
+  'freedreno_bo.c',
+  'freedreno_bo_cache.c',
+  'msm/msm_bo.c',
+  'msm/msm_device.c',
+  'msm/msm_drm.h',
+  'msm/msm_pipe.c',
+  'msm/msm_priv.h',
+  'msm/msm_ringbuffer.c',
+)
+
+if with_freedreno_kgsl != 'false'
+  files_freedreno += files(
+    'kgsl/kgsl_bo.c',
+    'kgsl/kgsl_device.c',
+    'kgsl/kgsl_drm.h',
+    'kgsl/kgsl_pipe.c',
+    'kgsl/kgsl_priv.h',
+    'kgsl/kgsl_ringbuffer.c',
+    'kgsl/msm_kgsl.h',
+  )
+endif
+
+libdrm_freedreno = shared_library(
+  'drm_freedreno',
+  [files_freedreno, config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
+  link_with : libdrm,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_freedreno = declare_dependency(
+  link_with : [libdrm, libdrm_freedreno],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+  'freedreno_drmif.h', 'freedreno_ringbuffer.h',
+  subdir : 'freedreno'
+)
+
+pkg.generate(
+  name : 'libdrm_freedreno',
+  libraries : libdrm_freedreno,
+  subdirs : ['.', 'libdrm', 'freedreno'],
+  version : '0.7',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to freedreno kernel DRM services',
+)
+
+test(
+  'freedreno-symbol-check',
+  prog_bash,
+  args : [files('freedreno-symbol-check'), libdrm_freedreno]
+)
diff --git a/intel/meson.build b/intel/meson.build
new file mode 100644
index 0000000..18f35c0
--- /dev/null
+++ b/intel/meson.build
@@ -0,0 +1,111 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_intel = files(
+  'intel_bufmgr.c',
+  'intel_bufmgr_priv.h',
+  'intel_bufmgr_fake.c',
+  'intel_bufmgr_gem.c',
+  'intel_decode.c',
+  'intel_chipset.h',
+  'mm.c',
+  'mm.h',
+  'uthash.h',
+)
+
+libdrm_intel = shared_library(
+  'drm_intel',
+  [files_intel, config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
+  c_args : warn_c_args,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_intel = declare_dependency(
+  link_with : [libdrm, libdrm_intel],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+  'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h',
+  subdir : 'libdrm',
+)
+
+pkg.generate(
+  name : 'libdrm_intel',
+  libraries : libdrm_intel,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires : 'libdrm',
+  description : 'Userspace interface to intel kernel DRM services',
+)
+
+test_decode = executable(
+  'test_decode',
+  files('test_decode.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : [libdrm, libdrm_intel],
+  c_args : warn_c_args,
+)
+
+test(
+  'gen4-3d.batch',
+  prog_bash,
+  args : files('tests/gen4-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen45-3d.batch',
+  prog_bash,
+  args : files('tests/gm45-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen5-3d.batch',
+  prog_bash,
+  args : files('tests/gen5-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen6-3d.batch',
+  prog_bash,
+  args : files('tests/gen6-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen7-3d.batch',
+  prog_bash,
+  args : files('tests/gen7-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen7-2d-copy.batch',
+  prog_bash,
+  args : files('tests/gen7-2d-copy.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'intel-symbol-check',
+  prog_bash,
+  args : [files('intel-symbol-check'), libdrm_intel]
+)
diff --git a/libkms/meson.build b/libkms/meson.build
new file mode 100644
index 0000000..80afc89
--- /dev/null
+++ b/libkms/meson.build
@@ -0,0 +1,75 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libkms_include = [inc_root, inc_drm]
+files_libkms = files(
+  'internal.h',
+  'linux.c',
+  'dumb.c',
+  'api.c',
+)
+if with_vmwgfx
+  files_libkms += files('vmwgfx.c')
+endif
+if with_intel
+  files_libkms += files('intel.c')
+endif
+if with_nouveau
+  files_libkms += files('nouveau.c')
+endif
+if with_radeon
+  files_libkms += files('radeon.c')
+endif
+if with_exynos
+  files_libkms += files('exynos.c')
+  libkms_include += include_directories('../exynos')
+endif
+
+libkms = shared_library(
+  'kms',
+  [files_libkms, config_file],
+  c_args : warn_c_args,
+  include_directories : libkms_include,
+  link_with : libdrm,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libkms = declare_dependency(
+  link_with : [libdrm, libkms],
+  include_directories : [libkms_include],
+)
+
+install_headers('libkms.h', subdir : 'libkms')
+
+pkg.generate(
+  name : 'libkms',
+  libraries : libkms,
+  subdirs : ['libkms'],
+  version : '1.0.0',
+  requires_private : 'libdrm',
+  description : 'Library that abstracts away the different mm interfaces for kernel drivers',
+)
+
+test(
+  'kms-symbol-check',
+  prog_bash,
+  args : [files('kms-symbol-check'), libkms]
+)
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..0b2efe5
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,66 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+xsltproc_args = [
+  '--stringparam', 'man.authors.section.enabled', '0',
+  '--stringparam', 'man.copyright.section.enabled', '0',
+  '--stringparam', 'funcsynopsis.style', 'ansi',
+  '--stringparam', 'man.output.quietly', '1',
+  '--nonet', manpage_style,
+]
+
+xmls = [
+  ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'],
+  ['drmHandleEvent', '3'], ['drmModeGetResources', '3']
+]
+foreach x : xmls
+  m = x[0]
+  s = x[1]
+  custom_target(
+    m,
+    input : files('@0@.xml'.format(m)),
+    output : '@0@.@1@'.format(m, s),
+    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'],
+    install : true,
+    install_dir : join_paths(get_option('datadir'), 'man', 'man@0@'.format(s)),
+    build_by_default : true,
+  )
+endforeach
+
+foreach x : ['drm-mm', 'drm-gem', 'drm-ttm']
+  gen = custom_target(
+    'gen-@0@'.format(x),
+    input : 'drm-memory.xml',
+    output : '@0@.xml'.format(x),
+    command : [prog_sed, '-e',
+               's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@',
+               '@INPUT@'],
+    capture : true,
+  )
+  custom_target(
+    '@0@.7'.format(x),
+    input : gen,
+    output : '@0@.7'.format(x, '7'),
+    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'],
+    install : true,
+    install_dir : join_paths(get_option('datadir'), 'man', 'man7'),
+    build_by_default : true,
+  )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..74ae222
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,378 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+project(
+  'libdrm',
+  ['c'],
+  version : '2.4.89',
+  license : 'MIT',
+  default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],
+)
+
+pkg = import('pkgconfig')
+
+with_udev = get_option('udev')
+with_freedreno_kgsl = get_option('freedreno-kgls')
+with_install_tests = get_option('install_test_programs')
+with_cairo_tests = get_option('cairo_tests')
+with_valgrind = get_option('valgrind')
+
+config = configuration_data()
+
+# TODO: openbsd is guess, the others are correct
+if ['freebsd', 'dragonfly', 'netbsd', 'openbsd'].contains(host_machine.system())
+  dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
+else
+  dep_pthread_stubs = []
+endif
+dep_threads = dependency('threads')
+
+cc = meson.get_compiler('c')
+# Check for atomics
+if cc.compiles('''
+    int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
+    int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
+    ''',
+    name : 'Intel Atomics')
+  config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', true)
+  with_atomics = true
+elif cc.has_header('atomic_ops.h')
+  config.set10('HAVE_LIB_ATOMIC_OPS', true)
+  with_atomics = true
+elif cc.has_function('atomic_cas_uint')
+  with_atomics = true
+else
+  with_atomics = false
+endif
+
+with_intel = false
+_intel = get_option('intel')
+if _intel != 'false'
+  if _intel == 'true' and not with_atomics
+    error('libdrm_intel requires atomics.')
+  endif
+  with_intel = _intel == 'true' or host_machine.cpu_family().startswith('x86')
+endif
+
+with_radoen = false
+_radeon = get_option('radeon')
+if _radeon != 'false'
+  if _radeon == 'true' and not with_atomics
+    error('libdrm_radeon requires atomics.')
+  endif
+  with_radeon = true
+endif
+
+with_amdgpu = false
+_amdgpu = get_option('amdgpu')
+if _amdgpu != 'false'
+  if _amdgpu == 'true' and not with_atomics
+    error('libdrm_amdgpu requires atomics.')
+  endif
+  with_amdgpu = true
+endif
+
+with_nouveau = false
+_nouveau = get_option('nouveau')
+if _nouveau != 'false'
+  if _nouveau == 'true' and not with_atomics
+    error('libdrm_nouveau requires atomics.')
+  endif
+  with_nouveau = true
+endif
+
+with_vmwgfx = false
+_vmwgfx = get_option('vmwgfx')
+if _vmwgfx != 'false'
+  with_vmwgfx = true
+endif
+
+with_omap = false
+_omap = get_option('omap')
+if _omap != 'false'
+  if _omap == 'true' and not with_atomics
+    error('libdrm_omap requires atomics.')
+  endif
+  with_omap = _omap == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+endif
+
+with_freedreno = false
+_freedreno = get_option('freedreno')
+if _freedreno != 'false'
+  if _freedreno == 'true' and not with_atomics
+    error('libdrm_freedreno requires atomics.')
+  endif
+  with_freedreno = _freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+endif
+
+with_tegra = false
+_tegra = get_option('tegra')
+if _tegra != 'false'
+  if _tegra == 'true' and not with_atomics
+    error('libdrm_tegra requires atomics.')
+  endif
+  with_tegra = _tegra == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+endif
+
+with_etnaviv = false
+_etnaviv = get_option('etnaviv')
+if _etnaviv != 'false'
+  if _etnaviv == 'true' and not with_atomics
+    error('libdrm_etnaviv requires atomics.')
+  endif
+  with_etnaviv = _etnaviv == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+endif
+
+with_exynos = false
+_exynos = get_option('exynos')
+if _exynos != 'false'
+  with_exynos = _exynos == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+endif
+
+with_vc4 = false
+_vc4 = get_option('vc4')
+if _vc4 != 'false'
+  with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+endif
+
+# XXX: Aparently only freebsd and dragonfly bsd actually need this (and
+# gnu/kfreebsd), not openbsd and netbsd
+with_libkms = false
+_libkms = get_option('libkms')
+if _libkms != 'false'
+  with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
+endif
+
+if with_udev
+  dep_udev = dependency('udev')
+  config.set10('UDEV', true)
+else
+  dep_udev = []
+endif
+
+# Among others FreeBSD does not have a separate dl library.
+if not cc.has_function('dlsym')
+  dep_dl = cc.find_library('dl', required : with_nouveau)
+else
+  dep_dl = []
+endif
+# clock_gettime might require -rt, or it might not. find out
+if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
+  # XXX: untested
+  dep_rt = cc.find_library('rt')
+else
+  dep_rt = []
+endif
+dep_m = cc.find_library('m', required : false)
+if cc.has_header('sys/sysctl.h')
+  config.set10('HAVE_SYS_SYSCTL_H', true)
+endif
+if cc.has_header('sys/select.h')
+  config.set10('HAVE_SYS_SELECT_H', true)
+endif
+if cc.has_header_symbol('sys/sysmacros.h', 'major')
+  config.set10('MAJOR_IN_SYSMACROS', true)
+elif cc.has_header_symbol('sys/mkdev.h', 'major')
+  config.set10('MAJOR_IN_MKDEV', true)
+endif
+if cc.has_function('open_memstream')
+  config.set10('HAVE_OPEN_MEMSTREAM', true)
+endif
+
+warn_c_args = []
+foreach a : ['-Wall', '-Wextra', '-Wsign-compare', 
+             '-Werror-implicit-function-declaration', '-Wpointer-arith',
+             '-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes',
+             '-Wmissing-declarations', '-Wnested-externs', '-Wpacked',
+             '-Wswitch-enum', '-Wmissing-format-attribute', 
+             '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', 
+             '-Wdeclaration-after-statement', '-Wold-style-definition']
+  if cc.has_argument(a)
+    warn_c_args += a
+  endif
+endforeach
+# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list
+# of options
+foreach a : ['unused-parameter', 'attributes', 'long-long', 
+             'missing-field-initializers']
+  if cc.has_argument('-W@0@'.format(a))
+    warn_c_args += '-Wno-@0@'.format(a)
+  endif
+endforeach
+
+
+dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
+dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
+dep_cairo = dependency('cairo', required : with_cairo_tests == 'true')
+dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
+
+with_man_pages = get_option('man_pages')
+prog_xslt = find_program('xsltproc', required : with_man_pages == 'true')
+prog_sed = find_program('sed', required : with_man_pages == 'true')
+manpage_style = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
+if prog_xslt.found()
+  if run_command(prog_xslt, '--nonet', manpage_style).returncode() != 0
+    if with_man_pages == 'true'
+      error('Manpage style sheet cannot be found')
+    endif
+    with_man_pages = 'false'
+  endif
+endif
+with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
+
+# Used for tets
+prog_bash = find_program('bash')
+
+if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
+               name : 'compiler supports __attribute__(("hidden"))')
+  config.set10('HAVE_VISIBILITY', true)
+endif
+
+foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'],
+             [with_nouveau, 'NOUVEAU'], [with_omap, 'OMAP'],
+             [with_exynos, 'EXYNOS'], [with_freedreno, 'FREEDRENO'],
+             [with_tegra, 'TEGRA'], [with_vc4, 'VC4'],
+             [with_etnaviv, 'ETNAVIV'], [with_install_tests, 'INSTALL_TESTS']]
+  e = t[0]
+  if e
+    config.set10('HAVE_@0@'.format(t[1]), true)
+  endif
+endforeach
+if with_freedreno_kgsl
+  if not with_freedreno
+    error('cannot enable freedreno-kgsl without freedreno support')
+  endif
+  config.set10('HAVE_FREEDRENO_KGSL', true)
+endif
+if with_amdgpu
+  config.set10('HAVE_AMDGPU', true)
+  if dep_cunit.found()
+    config.set10('HAVE_CUNIT', true)
+  endif
+endif
+if dep_cairo.found()
+  config.set10('HAVE_CAIRO', true)
+endif
+if dep_valgrind.found()
+  config.set10('HAVE_VALGRIND', true)
+endif
+
+config.set10('_GNU_SOURCE', true)
+config_file = configure_file(
+  configuration : config,
+  output : 'config.h',
+)
+add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
+
+inc_root = include_directories('.')
+inc_drm = include_directories('include/drm')
+
+files_libdrm = files(
+	'xf86drm.c',
+	'xf86drmHash.c',
+	'xf86drmHash.h',
+	'xf86drmRandom.c',
+	'xf86drmRandom.h',
+	'xf86drmSL.c',
+	'xf86drmMode.c',
+	'xf86atomic.h',
+	'libdrm_macros.h',
+	'libdrm_lists.h',
+	'util_double_list.h',
+	'util_math.h',
+)
+
+libdrm = shared_library(
+  'drm',
+  [files_libdrm, config_file],
+  c_args : warn_c_args,
+  dependencies : [dep_udev, dep_valgrind, dep_rt, dep_m],
+  include_directories : inc_drm,
+  version : '2.4.0',
+  install : true,
+)
+
+ext_libdrm = declare_dependency(
+  link_with : libdrm,
+  include_directories : inc_drm,
+)
+
+install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
+install_headers(
+	'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
+	'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
+	'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
+	'include/drm/nouveau_drm.h', 'include/drm/qxl_drm.h',
+	'include/drm/r128_drm.h', 'include/drm/radeon_drm.h',
+	'include/drm/amdgpu_drm.h', 'include/drm/savage_drm.h',
+	'include/drm/sis_drm.h', 'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h',
+	'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h',
+  subdir : 'libdrm',
+)
+if with_vmwgfx
+  install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm')
+endif
+
+pkg.generate(
+  name : 'libdrm',
+  libraries : libdrm,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  description : 'Userspace interface to kernel DRM services',
+)
+ 
+if with_libkms
+  subdir('libkms')
+endif
+if with_intel
+  subdir('intel')
+endif
+if with_nouveau
+  subdir('nouveau')
+endif
+if with_radeon
+  subdir('radeon')
+endif
+if with_amdgpu
+  subdir('amdgpu')
+endif
+if with_omap
+  subdir('omap')
+endif
+if with_exynos
+  subdir('exynos')
+endif
+if with_freedreno
+  subdir('freedreno')
+endif
+if with_tegra
+  subdir('tegra')
+endif
+if with_vc4
+  subdir('vc4')
+endif
+if with_etnaviv
+  subdir('etnaviv')
+endif
+if with_man_pages
+  subdir('man')
+endif
+subdir('data')
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..7c2fa4f
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,38 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+option('libkms',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('intel',       type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('radeon',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('amdgpu',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('nouveau',     type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('vmwgfx',      type : 'combo', value : 'true',  choices : ['true', 'false', 'auto'])
+option('omap',        type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
+option('exynos',      type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
+option('freedreno',   type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('tegra',       type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
+option('vc4',         type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('etnaviv',     type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
+option('cairo_tests', type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('man_pages',   type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('valgrind',    type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
+option('freedreno-kgls',        type : 'boolean', value : false)
+option('install_test_programs', type : 'boolean', value : false)
+option('udev',                  type : 'boolean', value : false)
diff --git a/nouveau/meson.build b/nouveau/meson.build
new file mode 100644
index 0000000..a50e4f7
--- /dev/null
+++ b/nouveau/meson.build
@@ -0,0 +1,65 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_nouveau = files(
+	'nouveau.c',
+	'pushbuf.c',
+	'bufctx.c',
+	'abi16.c',
+	'private.h',
+)
+
+libdrm_nouveau = shared_library(
+  'drm_nouveau',
+  [files_nouveau, config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_threads,
+  version : '2.0.0',
+  install : true,
+)
+
+ext_libdrm_nouveau = declare_dependency(
+  link_with : [libdrm, libdrm_nouveau],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('nouveau.h', subdir : 'libdrm/nouveau')
+install_headers(
+  'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h',
+  'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h',
+  subdir : 'libdrm/nouveau/nvif'
+)
+
+pkg.generate(
+  name : 'libdrm_nouveau',
+  libraries : libdrm_nouveau,
+  subdirs : ['.', 'nouveau'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to nouveau kernel DRM services',
+)
+
+test(
+  'nouveau-symbol-check',
+  prog_bash,
+  args : [files('nouveau-symbol-check'), libdrm_nouveau]
+)
diff --git a/omap/meson.build b/omap/meson.build
new file mode 100644
index 0000000..1881087
--- /dev/null
+++ b/omap/meson.build
@@ -0,0 +1,53 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_omap = shared_library(
+  'drm_omap',
+  [files('omap_drm.c'), config_file],
+  include_directories : [inc_root, inc_drm],
+  c_args : warn_c_args,
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_omap = declare_dependency(
+  link_with : [libdrm, libdrm_omap],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('omap_drmif.h', subdir : 'libdrm')
+install_headers('omap_drm.h', subdir : 'omap')
+
+pkg.generate(
+  name : 'libdrm_omap',
+  libraries : libdrm_omap,
+  subdirs : ['.', 'libdrm', 'omap'],
+  version : '0.6',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to omap kernel DRM services',
+)
+
+test(
+  'omap-symbol-check',
+  prog_bash,
+  args : [files('omap-symbol-check'), libdrm_omap]
+)
diff --git a/radeon/meson.build b/radeon/meson.build
new file mode 100644
index 0000000..f41c5c4
--- /dev/null
+++ b/radeon/meson.build
@@ -0,0 +1,65 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_radeon = files(
+	'radeon_bo_gem.c',
+	'radeon_cs_gem.c',
+	'radeon_cs_space.c',
+	'radeon_bo.c',
+	'radeon_cs.c',
+	'radeon_surface.c',
+)
+
+libdrm_radeon = shared_library(
+  'drm_radeon',
+  [files_radeon, config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.1',
+  install : true,
+)
+
+ext_libdrm_radeon = declare_dependency(
+  link_with : [libdrm, libdrm_radeon],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+	'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h',
+	'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h',
+  subdir : 'libdrm'
+)
+
+pkg.generate(
+  name : 'libdrm_radeon',
+  libraries : libdrm_radeon,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to kernel DRM services for radeon',
+)
+
+test(
+  'radeon-symbol-check',
+  prog_bash,
+  args : [files('radeon-symbol-check'), libdrm_radeon]
+)
diff --git a/tegra/meson.build b/tegra/meson.build
new file mode 100644
index 0000000..568531c
--- /dev/null
+++ b/tegra/meson.build
@@ -0,0 +1,52 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_tegra = shared_library(
+  'drm_tegra',
+  [files('private.h', 'tegra.c'), config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  c_args : warn_c_args,
+  version : '0.0.0',
+  install : true,
+)
+
+ext_libdrm_tegra = declare_dependency(
+  link_with : [libdrm, libdrm_tegra],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('tegra.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_tegra',
+  libraries : libdrm_tegra,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to Tegra kernel DRM services',
+)
+
+test(
+  'tegra-symbol-check',
+  prog_bash,
+  args : [files('tegra-symbol-check'), libdrm_tegra]
+)
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
new file mode 100644
index 0000000..5a07ce2
--- /dev/null
+++ b/tests/amdgpu/meson.build
@@ -0,0 +1,40 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_amdgpu_test = files(
+  'amdgpu_test.c',
+  'basic_tests.c',
+  'bo_tests.c',
+  'cs_tests.c',
+  'vce_tests.c',
+  'uvd_enc_tests.c',
+  'vcn_tests.c',
+  'deadlock_tests.c',
+  'vm_tests.c',
+)
+
+amdgpu_test = executable(
+  'amdgpu_test',
+  files_amdgpu_test,
+  dependencies : [dep_cunit, dep_threads],
+  include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')],
+  link_with : [libdrm, libdrm_amdgpu],
+  install : with_install_tests,
+)
diff --git a/tests/etnaviv/meson.build b/tests/etnaviv/meson.build
new file mode 100644
index 0000000..32c5cee
--- /dev/null
+++ b/tests/etnaviv/meson.build
@@ -0,0 +1,54 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_etnaviv_tests = [inc_root, inc_drm, include_directories('../../etnaviv')]
+
+etnaviv_2d_test_files = files(
+  'cmdstream.xml.h',
+  'etnaviv_2d_test.c',
+  'state.xml.h',
+  'state_2d.xml.h',
+  'write_bmp.c',
+  'write_bmp.h',
+)
+
+etnaviv_2d_test = executable(
+  'etnaviv_2d_test',
+  etnaviv_2d_test_files,
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
+
+etnaviv_cmd_stream_test = executable(
+  'etnaviv_cmd_stream_test',
+  files('etnaviv_cmd_stream_test.c'),
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
+
+etnaviv_bo_cache_test = executable(
+  'etnaviv_bo_cache_test',
+  files('etnaviv_bo_cache_test.c'),
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
new file mode 100644
index 0000000..940c3ce
--- /dev/null
+++ b/tests/exynos/meson.build
@@ -0,0 +1,54 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_exynos = include_directories('../../exynos')
+
+if with_libkms
+  exynos_fimg2d_test = executable(
+    'exynos_fimg2d_test',
+    files('exynos_fimg2d_test.c'),
+    c_args : warn_c_args,
+    include_directories : [inc_root, inc_drm, inc_exynos,
+                           include_directories('../../libkms')],
+    link_with : [libdrm, libkms, libdrm_exynos],
+    dependencies : dep_threads,
+    install : with_install_tests,
+  )
+endif
+
+exynos_fimg2d_perf = executable(
+  'exynos_fimg2d_perf',
+  files('exynos_fimg2d_perf.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm, inc_exynos],
+  link_with : [libdrm, libdrm_exynos],
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
+
+exynos_fimg2d_event = executable(
+  'exynos_fimg2d_event',
+  files('exynos_fimg2d_event.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm, inc_exynos],
+  link_with : [libdrm, libdrm_exynos],
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
diff --git a/tests/kms/meson.build b/tests/kms/meson.build
new file mode 100644
index 0000000..e991913
--- /dev/null
+++ b/tests/kms/meson.build
@@ -0,0 +1,54 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libkms_test_files = files(
+	'libkms-test.h',
+	'libkms-test-crtc.c',
+	'libkms-test-device.c',
+	'libkms-test-framebuffer.c',
+	'libkms-test-plane.c',
+	'libkms-test-screen.c',
+)
+
+libkms_test = static_library(
+  'kms-test',
+  libkms_test_files,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+kms_steal_crtc = executable(
+  'kms-steal-crtc',
+  files('kms-steal-crtc.c'),
+  dependencies : dep_cairo,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libkms_test, libutil],
+  install : with_install_tests,
+)
+
+kms_universal_planes = executable(
+  'kms-universal-lanes',
+  files('kms-universal-planes.c'),
+  dependencies : dep_cairo,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libkms_test],
+  install : with_install_tests,
+)
diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
new file mode 100644
index 0000000..f713f26
--- /dev/null
+++ b/tests/kmstest/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+kmstest = executable(
+  'kmstest',
+  files('main.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, include_directories('../../libkms'), inc_drm],
+  link_with : [libutil, libkms, libdrm],
+  install : with_install_tests,
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..960ff7b
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,85 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_tests = include_directories('.')
+
+subdir('util')
+subdir('kms')
+subdir('modeprint')
+subdir('proptest')
+subdir('vbltest')
+if with_libkms
+  subdir('kmstest')
+endif
+if with_radeon
+  subdir('radeon')
+endif
+if with_amdgpu and dep_cunit.found()
+  subdir('amdgpu')
+endif
+if with_exynos
+  subdir('exynos')
+endif
+if with_tegra
+  subdir('tegra')
+endif
+if with_etnaviv
+  subdir('etnaviv')
+endif
+if with_nouveau
+  subdir('nouveau')
+endif
+
+drmsl = executable(
+  'drmsl',
+  files('drmsl.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+hash = executable(
+  'hash',
+  files('hash.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+random = executable(
+  'random',
+  files('random.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+drmdevice = executable(
+  'drmdevice',
+  files('drmdevice.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+test('random', random, timeout : 240)
+test('hash', hash)
+test('drmsl', drmsl)
+test('drmdevice', drmdevice)
diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
new file mode 100644
index 0000000..5f0eb24
--- /dev/null
+++ b/tests/modeprint/meson.build
@@ -0,0 +1,29 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+modeprint = executable(
+  'modeprint',
+  files('modeprint.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
new file mode 100644
index 0000000..f5d73c1
--- /dev/null
+++ b/tests/nouveau/meson.build
@@ -0,0 +1,30 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+threaded = executable(
+  'threaded',
+  files('threaded.c'),
+  dependencies : [dep_dl, dep_threads],
+  include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
+  link_with : [libdrm, libdrm_nouveau],
+  c_args : warn_c_args,
+)
+
+test('threaded', threaded)
diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
new file mode 100644
index 0000000..dcd724f
--- /dev/null
+++ b/tests/proptest/meson.build
@@ -0,0 +1,30 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+proptest_files = files('proptest.c')
+
+proptest = executable(
+  'proptest',
+  files('proptest.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libdrm, libutil],
+  install : with_install_tests,
+)
diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
new file mode 100644
index 0000000..54db231
--- /dev/null
+++ b/tests/radeon/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+radeon_ttm = executable(
+  'radeon_ttm',
+  files('rbo.c', 'rbo.h', 'radeon_ttm.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
new file mode 100644
index 0000000..9c74ac4
--- /dev/null
+++ b/tests/tegra/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+openclose = executable(
+  'openclose',
+  files('openclose.c'),
+  include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
+  c_args : warn_c_args,
+  link_with : [libdrm, libdrm_tegra],
+)
diff --git a/tests/util/meson.build b/tests/util/meson.build
new file mode 100644
index 0000000..a0e1d3c
--- /dev/null
+++ b/tests/util/meson.build
@@ -0,0 +1,37 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+util_files = files(
+  'common.h',
+  'format.c',
+  'format.h',
+  'kms.c',
+  'kms.h',
+  'pattern.c',
+  'pattern.h',
+)
+
+libutil = static_library(
+  'util',
+  [util_files, config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_cairo
+)
diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
new file mode 100644
index 0000000..4fb1ad3
--- /dev/null
+++ b/tests/vbltest/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+vbltest = executable(
+  'vbltest',
+  files('vbltest.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libdrm, libutil],
+  install : with_install_tests,
+)
diff --git a/vc4/meson.build b/vc4/meson.build
new file mode 100644
index 0000000..0136987
--- /dev/null
+++ b/vc4/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_vc4',
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to vc4 kernel DRM services',
+)
-- 
git-series 0.9.1
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

* [PATCH 2/3] autotools: Include meson.build files in tarball
  2018-01-03 21:31 [PATCH 0/3] Meson build system Dylan Baker
  2018-01-03 21:31 ` [PATCH 1/3] Add meson " Dylan Baker
@ 2018-01-03 21:31 ` Dylan Baker
  2018-01-03 21:31 ` [PATCH 3/3] README: Add note about meson Dylan Baker
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-03 21:31 UTC (permalink / raw)
  To: mesa-dev, dri-devel

I have tested that a tarball generated by autotools can be built with meson.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
 Makefile.am | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 7b86214..66f70ca 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -135,7 +135,35 @@ if HAVE_VMWGFX
 klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
 endif
 
-EXTRA_DIST = include/drm/README
+EXTRA_DIST = \
+	include/drm/README \
+	amdgpu/meson.build \
+	etnaviv/meson.build \
+	exynos/meson.build \
+	freedreno/meson.build \
+	intel/meson.build \
+	libkms/meson.build \
+	man/meson.build \
+	nouveau/meson.build \
+	omap/meson.build \
+	radeon/meson.build \
+	tests/amdgpu/meson.build \
+	tests/etnaviv/meson.build \
+	tests/exynos/meson.build \
+	tests/kms/meson.build \
+	tests/kmstest/meson.build \
+	tests/modeprint/meson.build \
+	tests/nouveau/meson.build \
+	tests/proptest/meson.build \
+	tests/radeon/meson.build \
+	tests/tegra/meson.build \
+	tests/util/meson.build \
+	tests/vbltest/meson.build \
+	tests/meson.build \
+	vc4/meson.build \
+	data/meson.build \
+	meson.build \
+	meson_options.txt
 
 copy-headers :
 	cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/
-- 
git-series 0.9.1
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

* [PATCH 3/3] README: Add note about meson
  2018-01-03 21:31 [PATCH 0/3] Meson build system Dylan Baker
  2018-01-03 21:31 ` [PATCH 1/3] Add meson " Dylan Baker
  2018-01-03 21:31 ` [PATCH 2/3] autotools: Include meson.build files in tarball Dylan Baker
@ 2018-01-03 21:31 ` Dylan Baker
  2018-01-04 18:28 ` [PATCH v4 0/3] Meson build system Dylan Baker
  2018-01-05 20:00 ` [PATCH 0/3] Meson build system Dylan Baker
  4 siblings, 0 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-03 21:31 UTC (permalink / raw)
  To: mesa-dev, dri-devel

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
 README | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 26cab9d..58e55bc 100644
--- a/README
+++ b/README
@@ -15,9 +15,24 @@ with an older kernel.
 Compiling
 ---------
 
-libdrm  is  a  standard  autotools  package and  follows  the  normal
-configure, build  and install steps.   The first step is  to configure
-the package, which is done by running the configure shell script:
+libdrm has two build systems, a legacy autotools build system, and a newer
+meson build system. The meson build system is much faster, and offers a 
+slightly different interface, but otherwise provides much the same 
+feature set.
+
+To use it:
+
+    meson builddir
+
+By default this will install into /usr/local, you can change your prefix
+with --prefix=/usr (or -Dprefix=/usr to meson configure).
+
+Then use ninja to build and install:
+
+    ninja -C builddir install
+
+
+Alternatively you can invoke autotools configure:
 
 	./configure
 
-- 
git-series 0.9.1
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

* Re: [PATCH 1/3] Add meson build system
  2018-01-03 21:31 ` [PATCH 1/3] Add meson " Dylan Baker
@ 2018-01-03 22:18   ` Dylan Baker
  2018-01-03 23:22   ` [Mesa-dev] " Igor Gnatenko
  2018-01-05 13:34   ` Eric Engestrom
  2 siblings, 0 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-03 22:18 UTC (permalink / raw)
  To: dri-devel, mesa-dev


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

Quoting Dylan Baker (2018-01-03 13:31:28)
<snip>
> diff --git a/freedreno/meson.build b/freedreno/meson.build
> new file mode 100644
> index 0000000..47d6e44
> --- /dev/null
> +++ b/freedreno/meson.build
> @@ -0,0 +1,82 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_freedreno = files(
> +  'freedreno_device.c',
> +  'freedreno_pipe.c',
> +  'freedreno_priv.h',
> +  'freedreno_ringbuffer.c',
> +  'freedreno_bo.c',
> +  'freedreno_bo_cache.c',
> +  'msm/msm_bo.c',
> +  'msm/msm_device.c',
> +  'msm/msm_drm.h',
> +  'msm/msm_pipe.c',
> +  'msm/msm_priv.h',
> +  'msm/msm_ringbuffer.c',
> +)
> +
> +if with_freedreno_kgsl != 'false'

This should be "if with_freedreno_kgsl" I've fixed that locally.

> +  files_freedreno += files(
> +    'kgsl/kgsl_bo.c',
> +    'kgsl/kgsl_device.c',
> +    'kgsl/kgsl_drm.h',
> +    'kgsl/kgsl_pipe.c',
> +    'kgsl/kgsl_priv.h',
> +    'kgsl/kgsl_ringbuffer.c',
> +    'kgsl/msm_kgsl.h',
> +  )
> +endif

<snip>

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlpNVqcACgkQCJ4WlhQG
iO9JIAf7B0xq6QyiepmS/8CgUyahwZHR/GP59RXfHSB0DkrWpHVfJYRWaZS6eoiH
Cmhb+LS3Gm3LLHOYITC7Is9ue3peeQLM1TB2M+tD/nDGLBZzJMIb5Lp9+tWuW6zn
Z1rH/OO9c68zqhx8x45fzLLcd1V7NyktKFn99gtRqHtYIBkHU/DgT2IfUtZM08fA
YU4p8VQ5gTEj60yMsnffgW/03UYeb3mf2AnywW8Ql7jt7n5CD4lyBLljkPUTMbah
WjYcpQYleMchTTqkpF2X5YiBXwrDBUiuRP/R3iuPiWMN9cmunz9qpOkh1HIly02M
Ty6nNGQKMdAsSQR/h+IkaJv+y8PDGw==
=bBku
-----END PGP SIGNATURE-----

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Mesa-dev] [PATCH 1/3] Add meson build system
  2018-01-03 21:31 ` [PATCH 1/3] Add meson " Dylan Baker
  2018-01-03 22:18   ` Dylan Baker
@ 2018-01-03 23:22   ` Igor Gnatenko
  2018-01-04  0:02     ` Dylan Baker
  2018-01-05 13:34   ` Eric Engestrom
  2 siblings, 1 reply; 29+ messages in thread
From: Igor Gnatenko @ 2018-01-03 23:22 UTC (permalink / raw)
  To: Dylan Baker, mesa-dev, dri-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Wed, 2018-01-03 at 13:31 -0800, Dylan Baker wrote:
> This patch adds a complete meson build system, including tests and
> install. It has the necessary hooks to allow it be used as a subproject
> for other meson based builds such as mesa.

It is failing to build with (autofoo-based builds fine):

[25/109] cc  -Iamdgpu/drm_amdgpu@sha -Iamdgpu -I../amdgpu -I. -I../
- -I../include/drm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64
- -std=gnu99 -DHAVE_CONFIG_H -O2 -g -Wall -Werror=format-security -Wp,-
D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-
size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
- -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fPIC -Wall
- -Wextra -Wsign-compare -Werror-implicit-function-declaration -Wpointer-arith
- -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
- -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-
aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-
style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-
missing-field-initializers '-DAMDGPU_ASIC_ID_TABLE="share/amdgpu.ids"' -MMD -MQ
'amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o' -MF 'amdgpu/drm_amdgpu@sha/amdgpu_as
ic_id.c.o.d' -o 'amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o' -c
../amdgpu/amdgpu_asic_id.c
FAILED: amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o 
cc  -Iamdgpu/drm_amdgpu@sha -Iamdgpu -I../amdgpu -I. -I../ -I../include/drm
- -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99
- -DHAVE_CONFIG_H -O2 -g -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
- -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-
switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
- -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fPIC -Wall
- -Wextra -Wsign-compare -Werror-implicit-function-declaration -Wpointer-arith
- -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
- -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-
aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-
style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-
missing-field-initializers '-DAMDGPU_ASIC_ID_TABLE="share/amdgpu.ids"' -MMD -MQ
'amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o' -MF 'amdgpu/drm_amdgpu@sha/amdgpu_as
ic_id.c.o.d' -o 'amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o' -c
../amdgpu/amdgpu_asic_id.c
../amdgpu/amdgpu_asic_id.c: In function ‘amdgpu_parse_asic_ids’:
../amdgpu/amdgpu_asic_id.c:122:26: error: ‘AMDGPU_ASIC_ID_TABLE_NUM_ENTRIES’
undeclared (first use in this function); did you mean
‘AMDGPU_VCE_CLOCK_TABLE_ENTRIES’?
  size_t table_max_size = AMDGPU_ASIC_ID_TABLE_NUM_ENTRIES;
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          AMDGPU_VCE_CLOCK_TABLE_ENTRIES
../amdgpu/amdgpu_asic_id.c:122:26: note: each undeclared identifier is reported
only once for each function it appears in

[...]

> diff --git a/freedreno/meson.build b/freedreno/meson.build
> new file mode 100644
> index 0000000..47d6e44
> --- /dev/null
> +++ b/freedreno/meson.build
> @@ -0,0 +1,82 @@
> [...]
> +if with_freedreno_kgsl != 'false'

Booleans should not compare with strings, so do just `if with_freedreno_kgsl`.

Submitted meson RFE to warn: https://github.com/mesonbuild/meson/issues/2870.

> +  files_freedreno += files(
> +    'kgsl/kgsl_bo.c',
> +    'kgsl/kgsl_device.c',
> +    'kgsl/kgsl_drm.h',
> +    'kgsl/kgsl_pipe.c',
> +    'kgsl/kgsl_priv.h',
> +    'kgsl/kgsl_ringbuffer.c',
> +    'kgsl/msm_kgsl.h',
> +  )
> +endif

[...]

> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 0000000..7c2fa4f
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,38 @@
> [...]
> +option('libkms',      type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('intel',       type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('radeon',      type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('amdgpu',      type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('nouveau',     type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('vmwgfx',      type : 'combo', value : 'true',  choices : ['true',
> 'false', 'auto'])
> +option('omap',        type : 'combo', value : 'false', choices : ['true',
> 'false', 'auto'])
> +option('exynos',      type : 'combo', value : 'false', choices : ['true',
> 'false', 'auto'])
> +option('freedreno',   type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('tegra',       type : 'combo', value : 'false', choices : ['true',
> 'false', 'auto'])
> +option('vc4',         type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('etnaviv',     type : 'combo', value : 'false', choices : ['true',
> 'false', 'auto'])
> +option('cairo_tests', type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('man_pages',   type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('valgrind',    type : 'combo', value : 'auto',  choices : ['true',
> 'false', 'auto'])
> +option('freedreno-kgls',        type : 'boolean', value : false)

Probably using `_` would be better for consistency..

Also, option should be named kgsl, not kgls (note sl vs ls).

> +option('install_test_programs', type : 'boolean', value : false)
> +option('udev',                  type : 'boolean', value : false)

Having description on all those options would be extremely useful 😉

[...]

Still testing it, once will have more results -- will come back.
- -- 
- -Igor Gnatenko
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEhLFO09aHZVqO+CM6aVcUvRu8X0wFAlpNZbwACgkQaVcUvRu8
X0xuQRAAulgnkHdNb2LCq6R+4A+IwEbyVD3uNIBv0eF0X/k/8w7IT7PcNwdS8VN3
XBrSLqFTxHTsghtMXSDXDW6LqA3Zv8VCkWZb3G/bek4w6iwwHmEVLGawiO1jVlHY
uX7bQEf/bdrM/UnXY1PnBmzmfhIcu6LhAry+pPS0iYxJWgcv6XbFil5fYu+N9T1H
vdlj8WJtZA9u4VhHdqFaf8JN8OwuBC2+87mNvuZMwKF1d4BD9r77WRuhDnyRWzJs
NoxufXz9JPx2YRbg6V8V5V4fsCV5oFpSpkpnTqIasjWlyJXo2Dhatt6oCbtu+ip4
Vf5Nr7WzIbXhT8WAYnLPc8E2mtWK5HG8NhrLJnqY4kdyiJ+w7X0PXKYeBPXRN1NG
zrF+h7Kd4LJvPwh0KMl1idGiGa5Mmr/vF/apIKrMBMvJ++E9zs+sPCNbSjnI3aWe
47LIqTkVxCLjwHIpQqDWZ+bUNanpwFaWtVWm9xvlPcpZ35pP2PqeyZ6abpqykP8b
OSQK9fN0PpiZsfVT25K8SaGvFzUy37lFSs/3cvTFQ+rmKo7xYxj1qbd4xvml0CU8
4IcPcFKRZRMFIE1cecqg7lNxlgfcA7bdrOSbvjHpKNlEUpRZOtNDPjgkx8RWlA3J
x1u8mcARzI5m837isa0eOatVgYXy+Eg86zWxiIy1jGliWaJTvN0=
=Rikj
-----END PGP SIGNATURE-----

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Mesa-dev] [PATCH 1/3] Add meson build system
  2018-01-03 23:22   ` [Mesa-dev] " Igor Gnatenko
@ 2018-01-04  0:02     ` Dylan Baker
  0 siblings, 0 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-04  0:02 UTC (permalink / raw)
  To: Igor Gnatenko, dri-devel, mesa-dev


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

Quoting Igor Gnatenko (2018-01-03 15:22:36)
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On Wed, 2018-01-03 at 13:31 -0800, Dylan Baker wrote:
> > This patch adds a complete meson build system, including tests and
> > install. It has the necessary hooks to allow it be used as a subproject
> > for other meson based builds such as mesa.
> 
> It is failing to build with (autofoo-based builds fine):
> 
> [25/109] cc  -Iamdgpu/drm_amdgpu@sha -Iamdgpu -I../amdgpu -I. -I../
> - -I../include/drm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64
> - -std=gnu99 -DHAVE_CONFIG_H -O2 -g -Wall -Werror=format-security -Wp,-
> D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-
> size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
> - -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fPIC -Wall
> - -Wextra -Wsign-compare -Werror-implicit-function-declaration -Wpointer-arith
> - -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
> - -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-
> aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-
> style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-
> missing-field-initializers '-DAMDGPU_ASIC_ID_TABLE="share/amdgpu.ids"' -MMD -MQ
> 'amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o' -MF 'amdgpu/drm_amdgpu@sha/amdgpu_as
> ic_id.c.o.d' -o 'amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o' -c
> ../amdgpu/amdgpu_asic_id.c
> FAILED: amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o 
> cc  -Iamdgpu/drm_amdgpu@sha -Iamdgpu -I../amdgpu -I. -I../ -I../include/drm
> - -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99
> - -DHAVE_CONFIG_H -O2 -g -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
> - -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-
> switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
> - -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fPIC -Wall
> - -Wextra -Wsign-compare -Werror-implicit-function-declaration -Wpointer-arith
> - -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
> - -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-
> aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-
> style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-
> missing-field-initializers '-DAMDGPU_ASIC_ID_TABLE="share/amdgpu.ids"' -MMD -MQ
> 'amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o' -MF 'amdgpu/drm_amdgpu@sha/amdgpu_as
> ic_id.c.o.d' -o 'amdgpu/drm_amdgpu@sha/amdgpu_asic_id.c.o' -c
> ../amdgpu/amdgpu_asic_id.c
> ../amdgpu/amdgpu_asic_id.c: In function ‘amdgpu_parse_asic_ids’:
> ../amdgpu/amdgpu_asic_id.c:122:26: error: ‘AMDGPU_ASIC_ID_TABLE_NUM_ENTRIES’
> undeclared (first use in this function); did you mean
> ‘AMDGPU_VCE_CLOCK_TABLE_ENTRIES’?
>   size_t table_max_size = AMDGPU_ASIC_ID_TABLE_NUM_ENTRIES;
>                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                           AMDGPU_VCE_CLOCK_TABLE_ENTRIES
> ../amdgpu/amdgpu_asic_id.c:122:26: note: each undeclared identifier is reported
> only once for each function it appears in

You need to rebase on master, that was removed in f05a2b4cb1aedb906524718db8ba2e62383f3064.

> 
> [...]
> 
> > diff --git a/freedreno/meson.build b/freedreno/meson.build
> > new file mode 100644
> > index 0000000..47d6e44
> > --- /dev/null
> > +++ b/freedreno/meson.build
> > @@ -0,0 +1,82 @@
> > [...]
> > +if with_freedreno_kgsl != 'false'
> 
> Booleans should not compare with strings, so do just `if with_freedreno_kgsl`.
> 
> Submitted meson RFE to warn: https://github.com/mesonbuild/meson/issues/2870.
> 
> > +  files_freedreno += files(
> > +    'kgsl/kgsl_bo.c',
> > +    'kgsl/kgsl_device.c',
> > +    'kgsl/kgsl_drm.h',
> > +    'kgsl/kgsl_pipe.c',
> > +    'kgsl/kgsl_priv.h',
> > +    'kgsl/kgsl_ringbuffer.c',
> > +    'kgsl/msm_kgsl.h',
> > +  )
> > +endif
> 
> [...]
> 
> > diff --git a/meson_options.txt b/meson_options.txt
> > new file mode 100644
> > index 0000000..7c2fa4f
> > --- /dev/null
> > +++ b/meson_options.txt
> > @@ -0,0 +1,38 @@
> > [...]
> > +option('libkms',      type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('intel',       type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('radeon',      type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('amdgpu',      type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('nouveau',     type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('vmwgfx',      type : 'combo', value : 'true',  choices : ['true',
> > 'false', 'auto'])
> > +option('omap',        type : 'combo', value : 'false', choices : ['true',
> > 'false', 'auto'])
> > +option('exynos',      type : 'combo', value : 'false', choices : ['true',
> > 'false', 'auto'])
> > +option('freedreno',   type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('tegra',       type : 'combo', value : 'false', choices : ['true',
> > 'false', 'auto'])
> > +option('vc4',         type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('etnaviv',     type : 'combo', value : 'false', choices : ['true',
> > 'false', 'auto'])
> > +option('cairo_tests', type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('man_pages',   type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('valgrind',    type : 'combo', value : 'auto',  choices : ['true',
> > 'false', 'auto'])
> > +option('freedreno-kgls',        type : 'boolean', value : false)
> 
> Probably using `_` would be better for consistency..

We use `-` in mesa for options, and I think it makes more sense to be consistent
with libdrm's biggest consumer, so I'd prefer to change install_test_programs to
install-test-programs

> 
> Also, option should be named kgsl, not kgls (note sl vs ls).

gah, I keep screwing that up.

> 
> > +option('install_test_programs', type : 'boolean', value : false)
> > +option('udev',                  type : 'boolean', value : false)
> 
> Having description on all those options would be extremely useful 😉

I can add those :)

> 
> [...]
> 
> Still testing it, once will have more results -- will come back.
> - -- 
> - -Igor Gnatenko
> -----BEGIN PGP SIGNATURE-----
> 
> iQIzBAEBCAAdFiEEhLFO09aHZVqO+CM6aVcUvRu8X0wFAlpNZbwACgkQaVcUvRu8
> X0xuQRAAulgnkHdNb2LCq6R+4A+IwEbyVD3uNIBv0eF0X/k/8w7IT7PcNwdS8VN3
> XBrSLqFTxHTsghtMXSDXDW6LqA3Zv8VCkWZb3G/bek4w6iwwHmEVLGawiO1jVlHY
> uX7bQEf/bdrM/UnXY1PnBmzmfhIcu6LhAry+pPS0iYxJWgcv6XbFil5fYu+N9T1H
> vdlj8WJtZA9u4VhHdqFaf8JN8OwuBC2+87mNvuZMwKF1d4BD9r77WRuhDnyRWzJs
> NoxufXz9JPx2YRbg6V8V5V4fsCV5oFpSpkpnTqIasjWlyJXo2Dhatt6oCbtu+ip4
> Vf5Nr7WzIbXhT8WAYnLPc8E2mtWK5HG8NhrLJnqY4kdyiJ+w7X0PXKYeBPXRN1NG
> zrF+h7Kd4LJvPwh0KMl1idGiGa5Mmr/vF/apIKrMBMvJ++E9zs+sPCNbSjnI3aWe
> 47LIqTkVxCLjwHIpQqDWZ+bUNanpwFaWtVWm9xvlPcpZ35pP2PqeyZ6abpqykP8b
> OSQK9fN0PpiZsfVT25K8SaGvFzUy37lFSs/3cvTFQ+rmKo7xYxj1qbd4xvml0CU8
> 4IcPcFKRZRMFIE1cecqg7lNxlgfcA7bdrOSbvjHpKNlEUpRZOtNDPjgkx8RWlA3J
> x1u8mcARzI5m837isa0eOatVgYXy+Eg86zWxiIy1jGliWaJTvN0=
> =Rikj
> -----END PGP SIGNATURE-----
> 

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlpNby0ACgkQCJ4WlhQG
iO+5Egf/Ua+wIxR/GT4UNj7/uuXd2dA8ILFRQ7UmALNTycISvRnG5XItX2SRE5Zg
85jOBsoONyc72PDz8p77uaaR/Uuxd414QYCbdujMqYQr6e7QuOusTV+sNfANcCOA
EnrEEuk9RDmMsmV8N9BzXRfS3kOzWoeCAkKVBtw/1xs6uRPs0OwbkLtRbW0Hj9Y0
mCtsDzE5LQwkrrGZ0i4b7jXpNYSQKQ+BhKJehMIkd2ggn2XC6DUHZaHBHuDwAhbL
zOVY3USX67LOid/FXjKQIJvVAg/796Fh5N00SiM48/OtU4Cf1UZpvoB9aZFh0Eit
uC3p+x02RBmQjeG9asXRFrahdowNSg==
=ItX6
-----END PGP SIGNATURE-----

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v4 0/3] Meson build system
  2018-01-03 21:31 [PATCH 0/3] Meson build system Dylan Baker
                   ` (2 preceding siblings ...)
  2018-01-03 21:31 ` [PATCH 3/3] README: Add note about meson Dylan Baker
@ 2018-01-04 18:28 ` Dylan Baker
  2018-01-04 18:28   ` [PATCH v4 1/3] Add meson " Dylan Baker
                     ` (2 more replies)
  2018-01-05 20:00 ` [PATCH 0/3] Meson build system Dylan Baker
  4 siblings, 3 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-04 18:28 UTC (permalink / raw)
  To: mesa-dev, dri-devel; +Cc: Dylan Baker

This is a third iteration of the meson build system for libdrm. This
version is significantly cleaned up from the last version and uses a
style more like the build system in mesa.

It builds all of the drivers and tests, and the tests can be run via
`ninja test`.

It has support for being used as a wrapped dependency wit ext_foo
variables. This means it can be used to build a mesa that requires a
newer libdrm than the system provides (which can be especially useful if
you can't install packages on that system) and for testing.

This has been build tested and mesa has been compiled against it, but
not functional testing has been done.

Changes since v3:
  - Fix freedreno kgsl check
  - Fix kgls -> kgsl typo
  - standardize meson options to use only `-` and not `_`
  - fix typo radoen -> radeon
  - add help messages to options
  - fix typo in kms-universal-planes binary
  - build and install modetest (this was missed in the first version for
    some reason)
  - install amdgpu.ids as 644 instead of 444

Dylan Baker (3):
  Add meson build system
  autotools: Include meson.build files in tarball
  README: Add note about meson

 .editorconfig               |   4 +-
 Makefile.am                 |  30 ++-
 README                      |  21 +-
 amdgpu/.editorconfig        |   5 +-
 amdgpu/meson.build          |  70 +++++++-
 data/meson.build            |  27 +++-
 etnaviv/meson.build         |  64 ++++++-
 exynos/meson.build          |  53 +++++-
 freedreno/meson.build       |  82 ++++++++-
 intel/meson.build           | 111 +++++++++++-
 libkms/meson.build          |  75 +++++++-
 man/meson.build             |  66 ++++++-
 meson.build                 | 376 +++++++++++++++++++++++++++++++++++++-
 meson_options.txt           | 143 ++++++++++++++-
 nouveau/meson.build         |  65 ++++++-
 omap/meson.build            |  53 +++++-
 radeon/meson.build          |  65 ++++++-
 tegra/meson.build           |  52 +++++-
 tests/amdgpu/meson.build    |  40 ++++-
 tests/etnaviv/meson.build   |  54 +++++-
 tests/exynos/meson.build    |  54 +++++-
 tests/kms/meson.build       |  54 +++++-
 tests/kmstest/meson.build   |  28 +++-
 tests/meson.build           |  86 ++++++++-
 tests/modeprint/meson.build |  29 +++-
 tests/modetest/meson.build  |  29 +++-
 tests/nouveau/meson.build   |  30 +++-
 tests/proptest/meson.build  |  30 +++-
 tests/radeon/meson.build    |  27 +++-
 tests/tegra/meson.build     |  27 +++-
 tests/util/meson.build      |  37 ++++-
 tests/vbltest/meson.build   |  28 +++-
 vc4/meson.build             |  28 +++-
 33 files changed, 1939 insertions(+), 4 deletions(-)
 create mode 100644 amdgpu/meson.build
 create mode 100644 data/meson.build
 create mode 100644 etnaviv/meson.build
 create mode 100644 exynos/meson.build
 create mode 100644 freedreno/meson.build
 create mode 100644 intel/meson.build
 create mode 100644 libkms/meson.build
 create mode 100644 man/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 nouveau/meson.build
 create mode 100644 omap/meson.build
 create mode 100644 radeon/meson.build
 create mode 100644 tegra/meson.build
 create mode 100644 tests/amdgpu/meson.build
 create mode 100644 tests/etnaviv/meson.build
 create mode 100644 tests/exynos/meson.build
 create mode 100644 tests/kms/meson.build
 create mode 100644 tests/kmstest/meson.build
 create mode 100644 tests/meson.build
 create mode 100644 tests/modeprint/meson.build
 create mode 100644 tests/modetest/meson.build
 create mode 100644 tests/nouveau/meson.build
 create mode 100644 tests/proptest/meson.build
 create mode 100644 tests/radeon/meson.build
 create mode 100644 tests/tegra/meson.build
 create mode 100644 tests/util/meson.build
 create mode 100644 tests/vbltest/meson.build
 create mode 100644 vc4/meson.build

base-commit: 831036a6f62005da9fb4a75fe043bd96ce672d27
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v4 1/3] Add meson build system
  2018-01-04 18:28 ` [PATCH v4 0/3] Meson build system Dylan Baker
@ 2018-01-04 18:28   ` Dylan Baker
  2018-01-04 21:43     ` [Mesa-dev] " Igor Gnatenko
  2018-01-04 18:28   ` [PATCH v4 2/3] autotools: Include meson.build files in tarball Dylan Baker
  2018-01-04 18:28   ` [PATCH v4 3/3] README: Add note about meson Dylan Baker
  2 siblings, 1 reply; 29+ messages in thread
From: Dylan Baker @ 2018-01-04 18:28 UTC (permalink / raw)
  To: mesa-dev, dri-devel

This patch adds a complete meson build system, including tests and
install. It has the necessary hooks to allow it be used as a subproject
for other meson based builds such as mesa.

v4: - fix freedreno kgls check

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
 .editorconfig               |   4 +-
 amdgpu/.editorconfig        |   5 +-
 amdgpu/meson.build          |  70 +++++++-
 data/meson.build            |  27 +++-
 etnaviv/meson.build         |  64 ++++++-
 exynos/meson.build          |  53 +++++-
 freedreno/meson.build       |  82 ++++++++-
 intel/meson.build           | 111 +++++++++++-
 libkms/meson.build          |  75 +++++++-
 man/meson.build             |  66 ++++++-
 meson.build                 | 376 +++++++++++++++++++++++++++++++++++++-
 meson_options.txt           | 143 ++++++++++++++-
 nouveau/meson.build         |  65 ++++++-
 omap/meson.build            |  53 +++++-
 radeon/meson.build          |  65 ++++++-
 tegra/meson.build           |  52 +++++-
 tests/amdgpu/meson.build    |  40 ++++-
 tests/etnaviv/meson.build   |  54 +++++-
 tests/exynos/meson.build    |  54 +++++-
 tests/kms/meson.build       |  54 +++++-
 tests/kmstest/meson.build   |  28 +++-
 tests/meson.build           |  86 ++++++++-
 tests/modeprint/meson.build |  29 +++-
 tests/modetest/meson.build  |  29 +++-
 tests/nouveau/meson.build   |  30 +++-
 tests/proptest/meson.build  |  30 +++-
 tests/radeon/meson.build    |  27 +++-
 tests/tegra/meson.build     |  27 +++-
 tests/util/meson.build      |  37 ++++-
 tests/vbltest/meson.build   |  28 +++-
 vc4/meson.build             |  28 +++-
 31 files changed, 1892 insertions(+)
 create mode 100644 amdgpu/meson.build
 create mode 100644 data/meson.build
 create mode 100644 etnaviv/meson.build
 create mode 100644 exynos/meson.build
 create mode 100644 freedreno/meson.build
 create mode 100644 intel/meson.build
 create mode 100644 libkms/meson.build
 create mode 100644 man/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 nouveau/meson.build
 create mode 100644 omap/meson.build
 create mode 100644 radeon/meson.build
 create mode 100644 tegra/meson.build
 create mode 100644 tests/amdgpu/meson.build
 create mode 100644 tests/etnaviv/meson.build
 create mode 100644 tests/exynos/meson.build
 create mode 100644 tests/kms/meson.build
 create mode 100644 tests/kmstest/meson.build
 create mode 100644 tests/meson.build
 create mode 100644 tests/modeprint/meson.build
 create mode 100644 tests/modetest/meson.build
 create mode 100644 tests/nouveau/meson.build
 create mode 100644 tests/proptest/meson.build
 create mode 100644 tests/radeon/meson.build
 create mode 100644 tests/tegra/meson.build
 create mode 100644 tests/util/meson.build
 create mode 100644 tests/vbltest/meson.build
 create mode 100644 vc4/meson.build

diff --git a/.editorconfig b/.editorconfig
index 893b7be..bbad3e6 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -17,3 +17,7 @@ indent_style = tab
 [*.m4]
 indent_style = space
 indent_size = 2
+
+[meson.build,meson_options.txt]
+indent_style = space
+indent_size = 2
diff --git a/amdgpu/.editorconfig b/amdgpu/.editorconfig
index 2528d67..0c758d6 100644
--- a/amdgpu/.editorconfig
+++ b/amdgpu/.editorconfig
@@ -7,3 +7,8 @@ indent_style = tab
 indent_size = 8
 tab_width = 8
 insert_final_newline = true
+
+[meson.build]
+indent_style = space
+indent_size = 2
+insert_final_newline = false
diff --git a/amdgpu/meson.build b/amdgpu/meson.build
new file mode 100644
index 0000000..13bf88b
--- /dev/null
+++ b/amdgpu/meson.build
@@ -0,0 +1,70 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_amdgpu = files(
+  'amdgpu_asic_id.c',
+  'amdgpu_bo.c',
+  'amdgpu_cs.c',
+  'amdgpu_device.c',
+  'amdgpu_gpu_info.c',
+  'amdgpu_internal.h',
+  'amdgpu_vamgr.c',
+  'amdgpu_vm.c',
+  'util_hash.c',
+  'util_hash.h',
+  'util_hash_table.c',
+  'util_hash_table.h',
+)
+
+libdrm_amdgpu = shared_library(
+  'drm_amdgpu',
+  [files_amdgpu, config_file],
+  c_args : [
+    warn_c_args,
+    '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(get_option('datadir'), 'amdgpu.ids')),
+  ],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('amdgpu.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_amdgpu',
+  libraries : libdrm_amdgpu,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to kernel DRM services for amdgpu',
+)
+
+ext_libdrm_amdgpu = declare_dependency(
+  link_with : [libdrm, libdrm_amdgpu],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+test(
+  'amdgpu-symbol-check',
+  prog_bash,
+  args : [files('amdgpu-symbol-check'), libdrm_amdgpu]
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..7f2d3bb
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+if with_amdgpu
+  install_data(
+    'amdgpu.ids',
+    install_mode : 'rw-r--r--',
+    install_dir : join_paths(get_option('datadir'), 'libdrm'),
+  )
+endif
diff --git a/etnaviv/meson.build b/etnaviv/meson.build
new file mode 100644
index 0000000..8f39775
--- /dev/null
+++ b/etnaviv/meson.build
@@ -0,0 +1,64 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_etnaviv = files(
+  'etnaviv_device.c',
+  'etnaviv_gpu.c',
+  'etnaviv_bo.c',
+  'etnaviv_bo_cache.c',
+  'etnaviv_perfmon.c',
+  'etnaviv_pipe.c',
+  'etnaviv_cmd_stream.c',
+  'etnaviv_drm.h',
+  'etnaviv_priv.h',
+)
+
+libdrm_etnaviv = shared_library(
+  'drm_etnaviv',
+  [files_etnaviv, config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+  dependencies : [dep_pthread_stubs, dep_rt],
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('etnaviv_drmif.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_etnaviv',
+  libraries : libdrm_etnaviv,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to Tegra kernel DRM services',
+)
+
+ext_libdrm_etnaviv = declare_dependency(
+  link_with : [libdrm, libdrm_etnaviv],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+test(
+  'etnaviv-symbol-check',
+  prog_bash,
+  args : [files('etnaviv-symbol-check'), libdrm_etnaviv]
+)
diff --git a/exynos/meson.build b/exynos/meson.build
new file mode 100644
index 0000000..7da74aa
--- /dev/null
+++ b/exynos/meson.build
@@ -0,0 +1,53 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_exynos = shared_library(
+  'drm_exynos',
+  [files('exynos_drm.c', 'exynos_fimg2d.c', 'fimg2d_reg.h'), config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('exynos_drmif.h', subdir : 'libdrm')
+install_headers('exynos_drm.h', 'exynos_fimg2d.h', subdir : 'exynos')
+
+ext_libdrm_exynos = declare_dependency(
+  link_with : [libdrm, libdrm_exynos],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+pkg.generate(
+  name : 'libdrm_exynos',
+  libraries : libdrm_exynos,
+  subdirs : ['.', 'libdrm', 'exynos'],
+  version : '0.7',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to exynos kernel DRM services',
+)
+
+test(
+  'exynos-symbol-check',
+  prog_bash,
+  args : [files('exynos-symbol-check'), libdrm_exynos]
+)
diff --git a/freedreno/meson.build b/freedreno/meson.build
new file mode 100644
index 0000000..9304c6f
--- /dev/null
+++ b/freedreno/meson.build
@@ -0,0 +1,82 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_freedreno = files(
+  'freedreno_device.c',
+  'freedreno_pipe.c',
+  'freedreno_priv.h',
+  'freedreno_ringbuffer.c',
+  'freedreno_bo.c',
+  'freedreno_bo_cache.c',
+  'msm/msm_bo.c',
+  'msm/msm_device.c',
+  'msm/msm_drm.h',
+  'msm/msm_pipe.c',
+  'msm/msm_priv.h',
+  'msm/msm_ringbuffer.c',
+)
+
+if with_freedreno_kgsl
+  files_freedreno += files(
+    'kgsl/kgsl_bo.c',
+    'kgsl/kgsl_device.c',
+    'kgsl/kgsl_drm.h',
+    'kgsl/kgsl_pipe.c',
+    'kgsl/kgsl_priv.h',
+    'kgsl/kgsl_ringbuffer.c',
+    'kgsl/msm_kgsl.h',
+  )
+endif
+
+libdrm_freedreno = shared_library(
+  'drm_freedreno',
+  [files_freedreno, config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
+  link_with : libdrm,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_freedreno = declare_dependency(
+  link_with : [libdrm, libdrm_freedreno],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+  'freedreno_drmif.h', 'freedreno_ringbuffer.h',
+  subdir : 'freedreno'
+)
+
+pkg.generate(
+  name : 'libdrm_freedreno',
+  libraries : libdrm_freedreno,
+  subdirs : ['.', 'libdrm', 'freedreno'],
+  version : '0.7',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to freedreno kernel DRM services',
+)
+
+test(
+  'freedreno-symbol-check',
+  prog_bash,
+  args : [files('freedreno-symbol-check'), libdrm_freedreno]
+)
diff --git a/intel/meson.build b/intel/meson.build
new file mode 100644
index 0000000..18f35c0
--- /dev/null
+++ b/intel/meson.build
@@ -0,0 +1,111 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_intel = files(
+  'intel_bufmgr.c',
+  'intel_bufmgr_priv.h',
+  'intel_bufmgr_fake.c',
+  'intel_bufmgr_gem.c',
+  'intel_decode.c',
+  'intel_chipset.h',
+  'mm.c',
+  'mm.h',
+  'uthash.h',
+)
+
+libdrm_intel = shared_library(
+  'drm_intel',
+  [files_intel, config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
+  c_args : warn_c_args,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_intel = declare_dependency(
+  link_with : [libdrm, libdrm_intel],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+  'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h',
+  subdir : 'libdrm',
+)
+
+pkg.generate(
+  name : 'libdrm_intel',
+  libraries : libdrm_intel,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires : 'libdrm',
+  description : 'Userspace interface to intel kernel DRM services',
+)
+
+test_decode = executable(
+  'test_decode',
+  files('test_decode.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : [libdrm, libdrm_intel],
+  c_args : warn_c_args,
+)
+
+test(
+  'gen4-3d.batch',
+  prog_bash,
+  args : files('tests/gen4-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen45-3d.batch',
+  prog_bash,
+  args : files('tests/gm45-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen5-3d.batch',
+  prog_bash,
+  args : files('tests/gen5-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen6-3d.batch',
+  prog_bash,
+  args : files('tests/gen6-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen7-3d.batch',
+  prog_bash,
+  args : files('tests/gen7-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen7-2d-copy.batch',
+  prog_bash,
+  args : files('tests/gen7-2d-copy.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'intel-symbol-check',
+  prog_bash,
+  args : [files('intel-symbol-check'), libdrm_intel]
+)
diff --git a/libkms/meson.build b/libkms/meson.build
new file mode 100644
index 0000000..80afc89
--- /dev/null
+++ b/libkms/meson.build
@@ -0,0 +1,75 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libkms_include = [inc_root, inc_drm]
+files_libkms = files(
+  'internal.h',
+  'linux.c',
+  'dumb.c',
+  'api.c',
+)
+if with_vmwgfx
+  files_libkms += files('vmwgfx.c')
+endif
+if with_intel
+  files_libkms += files('intel.c')
+endif
+if with_nouveau
+  files_libkms += files('nouveau.c')
+endif
+if with_radeon
+  files_libkms += files('radeon.c')
+endif
+if with_exynos
+  files_libkms += files('exynos.c')
+  libkms_include += include_directories('../exynos')
+endif
+
+libkms = shared_library(
+  'kms',
+  [files_libkms, config_file],
+  c_args : warn_c_args,
+  include_directories : libkms_include,
+  link_with : libdrm,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libkms = declare_dependency(
+  link_with : [libdrm, libkms],
+  include_directories : [libkms_include],
+)
+
+install_headers('libkms.h', subdir : 'libkms')
+
+pkg.generate(
+  name : 'libkms',
+  libraries : libkms,
+  subdirs : ['libkms'],
+  version : '1.0.0',
+  requires_private : 'libdrm',
+  description : 'Library that abstracts away the different mm interfaces for kernel drivers',
+)
+
+test(
+  'kms-symbol-check',
+  prog_bash,
+  args : [files('kms-symbol-check'), libkms]
+)
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..0b2efe5
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,66 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+xsltproc_args = [
+  '--stringparam', 'man.authors.section.enabled', '0',
+  '--stringparam', 'man.copyright.section.enabled', '0',
+  '--stringparam', 'funcsynopsis.style', 'ansi',
+  '--stringparam', 'man.output.quietly', '1',
+  '--nonet', manpage_style,
+]
+
+xmls = [
+  ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'],
+  ['drmHandleEvent', '3'], ['drmModeGetResources', '3']
+]
+foreach x : xmls
+  m = x[0]
+  s = x[1]
+  custom_target(
+    m,
+    input : files('@0@.xml'.format(m)),
+    output : '@0@.@1@'.format(m, s),
+    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'],
+    install : true,
+    install_dir : join_paths(get_option('datadir'), 'man', 'man@0@'.format(s)),
+    build_by_default : true,
+  )
+endforeach
+
+foreach x : ['drm-mm', 'drm-gem', 'drm-ttm']
+  gen = custom_target(
+    'gen-@0@'.format(x),
+    input : 'drm-memory.xml',
+    output : '@0@.xml'.format(x),
+    command : [prog_sed, '-e',
+               's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@',
+               '@INPUT@'],
+    capture : true,
+  )
+  custom_target(
+    '@0@.7'.format(x),
+    input : gen,
+    output : '@0@.7'.format(x, '7'),
+    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'],
+    install : true,
+    install_dir : join_paths(get_option('datadir'), 'man', 'man7'),
+    build_by_default : true,
+  )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..162074d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,376 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+project(
+  'libdrm',
+  ['c'],
+  version : '2.4.89',
+  license : 'MIT',
+  default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],
+)
+
+pkg = import('pkgconfig')
+
+with_udev = get_option('udev')
+with_freedreno_kgsl = get_option('freedreno-kgsl')
+with_install_tests = get_option('install-test-programs')
+with_cairo_tests = get_option('cairo-tests')
+with_valgrind = get_option('valgrind')
+
+config = configuration_data()
+
+# TODO: openbsd is guess, the others are correct
+if ['freebsd', 'dragonfly', 'netbsd', 'openbsd'].contains(host_machine.system())
+  dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
+else
+  dep_pthread_stubs = []
+endif
+dep_threads = dependency('threads')
+
+cc = meson.get_compiler('c')
+# Check for atomics
+if cc.compiles('''
+    int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
+    int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
+    ''',
+    name : 'Intel Atomics')
+  config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', true)
+  with_atomics = true
+elif cc.has_header('atomic_ops.h')
+  config.set10('HAVE_LIB_ATOMIC_OPS', true)
+  with_atomics = true
+elif cc.has_function('atomic_cas_uint')
+  with_atomics = true
+else
+  with_atomics = false
+endif
+
+with_intel = false
+_intel = get_option('intel')
+if _intel != 'false'
+  if _intel == 'true' and not with_atomics
+    error('libdrm_intel requires atomics.')
+  else
+    with_intel = _intel == 'true' or host_machine.cpu_family().startswith('x86')
+  endif
+endif
+
+with_radeon = false
+_radeon = get_option('radeon')
+if _radeon != 'false'
+  if _radeon == 'true' and not with_atomics
+    error('libdrm_radeon requires atomics.')
+  endif
+  with_radeon = true
+endif
+
+with_amdgpu = false
+_amdgpu = get_option('amdgpu')
+if _amdgpu != 'false'
+  if _amdgpu == 'true' and not with_atomics
+    error('libdrm_amdgpu requires atomics.')
+  endif
+  with_amdgpu = true
+endif
+
+with_nouveau = false
+_nouveau = get_option('nouveau')
+if _nouveau != 'false'
+  if _nouveau == 'true' and not with_atomics
+    error('libdrm_nouveau requires atomics.')
+  endif
+  with_nouveau = true
+endif
+
+with_vmwgfx = false
+_vmwgfx = get_option('vmwgfx')
+if _vmwgfx != 'false'
+  with_vmwgfx = true
+endif
+
+with_omap = false
+_omap = get_option('omap')
+if _omap == 'true'
+  if not with_atomics
+    error('libdrm_omap requires atomics.')
+  endif
+  with_omap = true
+endif
+
+with_freedreno = false
+_freedreno = get_option('freedreno')
+if _freedreno != 'false'
+  if _freedreno == 'true' and not with_atomics
+    error('libdrm_freedreno requires atomics.')
+  else
+    with_freedreno = _freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+  endif
+endif
+
+with_tegra = false
+_tegra = get_option('tegra')
+if _tegra == 'true'
+  if not with_atomics
+    error('libdrm_tegra requires atomics.')
+  endif
+  with_tegra = true
+endif
+
+with_etnaviv = false
+_etnaviv = get_option('etnaviv')
+if _etnaviv == 'true'
+  if not with_atomics
+    error('libdrm_etnaviv requires atomics.')
+  endif
+  with_etnaviv = true
+endif
+
+with_exynos = get_option('exynos') == 'true'
+
+with_vc4 = false
+_vc4 = get_option('vc4')
+if _vc4 != 'false'
+  with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+endif
+
+# XXX: Aparently only freebsd and dragonfly bsd actually need this (and
+# gnu/kfreebsd), not openbsd and netbsd
+with_libkms = false
+_libkms = get_option('libkms')
+if _libkms != 'false'
+  with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
+endif
+
+if with_udev
+  dep_udev = dependency('udev')
+  config.set10('UDEV', true)
+else
+  dep_udev = []
+endif
+
+# Among others FreeBSD does not have a separate dl library.
+if not cc.has_function('dlsym')
+  dep_dl = cc.find_library('dl', required : with_nouveau)
+else
+  dep_dl = []
+endif
+# clock_gettime might require -rt, or it might not. find out
+if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
+  # XXX: untested
+  dep_rt = cc.find_library('rt')
+else
+  dep_rt = []
+endif
+dep_m = cc.find_library('m', required : false)
+if cc.has_header('sys/sysctl.h')
+  config.set10('HAVE_SYS_SYSCTL_H', true)
+endif
+if cc.has_header('sys/select.h')
+  config.set10('HAVE_SYS_SELECT_H', true)
+endif
+if cc.has_header_symbol('sys/sysmacros.h', 'major')
+  config.set10('MAJOR_IN_SYSMACROS', true)
+elif cc.has_header_symbol('sys/mkdev.h', 'major')
+  config.set10('MAJOR_IN_MKDEV', true)
+endif
+if cc.has_function('open_memstream')
+  config.set10('HAVE_OPEN_MEMSTREAM', true)
+endif
+
+warn_c_args = []
+foreach a : ['-Wall', '-Wextra', '-Wsign-compare', 
+             '-Werror-implicit-function-declaration', '-Wpointer-arith',
+             '-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes',
+             '-Wmissing-declarations', '-Wnested-externs', '-Wpacked',
+             '-Wswitch-enum', '-Wmissing-format-attribute', 
+             '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', 
+             '-Wdeclaration-after-statement', '-Wold-style-definition']
+  if cc.has_argument(a)
+    warn_c_args += a
+  endif
+endforeach
+# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list
+# of options
+foreach a : ['unused-parameter', 'attributes', 'long-long', 
+             'missing-field-initializers']
+  if cc.has_argument('-W@0@'.format(a))
+    warn_c_args += '-Wno-@0@'.format(a)
+  endif
+endforeach
+
+
+dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
+dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
+dep_cairo = dependency('cairo', required : with_cairo_tests == 'true')
+dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
+
+with_man_pages = get_option('man-pages')
+prog_xslt = find_program('xsltproc', required : with_man_pages == 'true')
+prog_sed = find_program('sed', required : with_man_pages == 'true')
+manpage_style = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
+if prog_xslt.found()
+  if run_command(prog_xslt, '--nonet', manpage_style).returncode() != 0
+    if with_man_pages == 'true'
+      error('Manpage style sheet cannot be found')
+    endif
+    with_man_pages = 'false'
+  endif
+endif
+with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
+
+# Used for tets
+prog_bash = find_program('bash')
+
+if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
+               name : 'compiler supports __attribute__(("hidden"))')
+  config.set10('HAVE_VISIBILITY', true)
+endif
+
+foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'],
+             [with_nouveau, 'NOUVEAU'], [with_omap, 'OMAP'],
+             [with_exynos, 'EXYNOS'], [with_freedreno, 'FREEDRENO'],
+             [with_tegra, 'TEGRA'], [with_vc4, 'VC4'],
+             [with_etnaviv, 'ETNAVIV'], [with_install_tests, 'INSTALL_TESTS']]
+  e = t[0]
+  if e
+    config.set10('HAVE_@0@'.format(t[1]), true)
+  endif
+endforeach
+if with_freedreno_kgsl
+  if not with_freedreno
+    error('cannot enable freedreno-kgsl without freedreno support')
+  endif
+  config.set10('HAVE_FREEDRENO_KGSL', true)
+endif
+if with_amdgpu
+  config.set10('HAVE_AMDGPU', true)
+  if dep_cunit.found()
+    config.set10('HAVE_CUNIT', true)
+  endif
+endif
+if dep_cairo.found()
+  config.set10('HAVE_CAIRO', true)
+endif
+if dep_valgrind.found()
+  config.set10('HAVE_VALGRIND', true)
+endif
+
+config.set10('_GNU_SOURCE', true)
+config_file = configure_file(
+  configuration : config,
+  output : 'config.h',
+)
+add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
+
+inc_root = include_directories('.')
+inc_drm = include_directories('include/drm')
+
+files_libdrm = files(
+	'xf86drm.c',
+	'xf86drmHash.c',
+	'xf86drmHash.h',
+	'xf86drmRandom.c',
+	'xf86drmRandom.h',
+	'xf86drmSL.c',
+	'xf86drmMode.c',
+	'xf86atomic.h',
+	'libdrm_macros.h',
+	'libdrm_lists.h',
+	'util_double_list.h',
+	'util_math.h',
+)
+
+libdrm = shared_library(
+  'drm',
+  [files_libdrm, config_file],
+  c_args : warn_c_args,
+  dependencies : [dep_udev, dep_valgrind, dep_rt, dep_m],
+  include_directories : inc_drm,
+  version : '2.4.0',
+  install : true,
+)
+
+ext_libdrm = declare_dependency(
+  link_with : libdrm,
+  include_directories : inc_drm,
+)
+
+install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
+install_headers(
+	'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
+	'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
+	'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
+	'include/drm/nouveau_drm.h', 'include/drm/qxl_drm.h',
+	'include/drm/r128_drm.h', 'include/drm/radeon_drm.h',
+	'include/drm/amdgpu_drm.h', 'include/drm/savage_drm.h',
+	'include/drm/sis_drm.h', 'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h',
+	'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h',
+  subdir : 'libdrm',
+)
+if with_vmwgfx
+  install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm')
+endif
+
+pkg.generate(
+  name : 'libdrm',
+  libraries : libdrm,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  description : 'Userspace interface to kernel DRM services',
+)
+ 
+if with_libkms
+  subdir('libkms')
+endif
+if with_intel
+  subdir('intel')
+endif
+if with_nouveau
+  subdir('nouveau')
+endif
+if with_radeon
+  subdir('radeon')
+endif
+if with_amdgpu
+  subdir('amdgpu')
+endif
+if with_omap
+  subdir('omap')
+endif
+if with_exynos
+  subdir('exynos')
+endif
+if with_freedreno
+  subdir('freedreno')
+endif
+if with_tegra
+  subdir('tegra')
+endif
+if with_vc4
+  subdir('vc4')
+endif
+if with_etnaviv
+  subdir('etnaviv')
+endif
+if with_man_pages
+  subdir('man')
+endif
+subdir('data')
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..08c2ccd
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,143 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+option(
+  'libkms',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : 'Build libkms mm abstraction library.',
+)
+option(
+  'intel',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for Intel's KMS API.''',
+)
+option(
+  'radeon',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for radeons's KMS API.''',
+)
+option(
+  'amdgpu',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for amdgpu's KMS API.''',
+)
+option(
+  'nouveau',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for nouveau's KMS API.''',
+)
+option(
+  'vmwgfx',
+  type : 'combo',
+  value : 'true',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for vmgfx's KMS API.''',
+)
+option(
+  'omap',
+  type : 'combo',
+  value : 'false',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for OMAP's experimental KMS API.''',
+)
+option(
+  'exynos',
+  type : 'combo',
+  value : 'false',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for EXYNOS's experimental KMS API.''',
+)
+option(
+  'freedreno',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for freedreno's KMS API.''',
+)
+option(
+  'tegra',
+  type : 'combo',
+  value : 'false',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for Tegra's experimental KMS API.''',
+)
+option(
+  'vc4',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for vc4's KMS API.''',
+)
+option(
+  'etnaviv',
+  type : 'combo',
+  value : 'false',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for etnaviv's experimental KMS API.''',
+)
+option(
+  'cairo-tests',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : 'Enable support for Cairo rendering in tests.',
+)
+option(
+  'man-pages',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : 'Enable manpage generation and install.',
+)
+option(
+  'valgrind',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : 'build libdrm with valgrind support',
+)
+option(
+  'freedreno-kgsl',
+  type : 'boolean',
+  value : false,
+  description : 'Enable support for freedreno to use downstream android kernel API.',
+)
+option(
+  'install-test-programs',
+  type : 'boolean',
+  value : false,
+  description : 'Install test programs.',
+)
+option(
+  'udev',
+  type : 'boolean',
+  value : false,
+  description : 'Enable support for using udev instead of mknod.',
+)
diff --git a/nouveau/meson.build b/nouveau/meson.build
new file mode 100644
index 0000000..a50e4f7
--- /dev/null
+++ b/nouveau/meson.build
@@ -0,0 +1,65 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_nouveau = files(
+	'nouveau.c',
+	'pushbuf.c',
+	'bufctx.c',
+	'abi16.c',
+	'private.h',
+)
+
+libdrm_nouveau = shared_library(
+  'drm_nouveau',
+  [files_nouveau, config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_threads,
+  version : '2.0.0',
+  install : true,
+)
+
+ext_libdrm_nouveau = declare_dependency(
+  link_with : [libdrm, libdrm_nouveau],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('nouveau.h', subdir : 'libdrm/nouveau')
+install_headers(
+  'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h',
+  'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h',
+  subdir : 'libdrm/nouveau/nvif'
+)
+
+pkg.generate(
+  name : 'libdrm_nouveau',
+  libraries : libdrm_nouveau,
+  subdirs : ['.', 'nouveau'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to nouveau kernel DRM services',
+)
+
+test(
+  'nouveau-symbol-check',
+  prog_bash,
+  args : [files('nouveau-symbol-check'), libdrm_nouveau]
+)
diff --git a/omap/meson.build b/omap/meson.build
new file mode 100644
index 0000000..1881087
--- /dev/null
+++ b/omap/meson.build
@@ -0,0 +1,53 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_omap = shared_library(
+  'drm_omap',
+  [files('omap_drm.c'), config_file],
+  include_directories : [inc_root, inc_drm],
+  c_args : warn_c_args,
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_omap = declare_dependency(
+  link_with : [libdrm, libdrm_omap],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('omap_drmif.h', subdir : 'libdrm')
+install_headers('omap_drm.h', subdir : 'omap')
+
+pkg.generate(
+  name : 'libdrm_omap',
+  libraries : libdrm_omap,
+  subdirs : ['.', 'libdrm', 'omap'],
+  version : '0.6',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to omap kernel DRM services',
+)
+
+test(
+  'omap-symbol-check',
+  prog_bash,
+  args : [files('omap-symbol-check'), libdrm_omap]
+)
diff --git a/radeon/meson.build b/radeon/meson.build
new file mode 100644
index 0000000..f41c5c4
--- /dev/null
+++ b/radeon/meson.build
@@ -0,0 +1,65 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_radeon = files(
+	'radeon_bo_gem.c',
+	'radeon_cs_gem.c',
+	'radeon_cs_space.c',
+	'radeon_bo.c',
+	'radeon_cs.c',
+	'radeon_surface.c',
+)
+
+libdrm_radeon = shared_library(
+  'drm_radeon',
+  [files_radeon, config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.1',
+  install : true,
+)
+
+ext_libdrm_radeon = declare_dependency(
+  link_with : [libdrm, libdrm_radeon],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+	'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h',
+	'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h',
+  subdir : 'libdrm'
+)
+
+pkg.generate(
+  name : 'libdrm_radeon',
+  libraries : libdrm_radeon,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to kernel DRM services for radeon',
+)
+
+test(
+  'radeon-symbol-check',
+  prog_bash,
+  args : [files('radeon-symbol-check'), libdrm_radeon]
+)
diff --git a/tegra/meson.build b/tegra/meson.build
new file mode 100644
index 0000000..568531c
--- /dev/null
+++ b/tegra/meson.build
@@ -0,0 +1,52 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_tegra = shared_library(
+  'drm_tegra',
+  [files('private.h', 'tegra.c'), config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  c_args : warn_c_args,
+  version : '0.0.0',
+  install : true,
+)
+
+ext_libdrm_tegra = declare_dependency(
+  link_with : [libdrm, libdrm_tegra],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('tegra.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_tegra',
+  libraries : libdrm_tegra,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to Tegra kernel DRM services',
+)
+
+test(
+  'tegra-symbol-check',
+  prog_bash,
+  args : [files('tegra-symbol-check'), libdrm_tegra]
+)
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
new file mode 100644
index 0000000..5a07ce2
--- /dev/null
+++ b/tests/amdgpu/meson.build
@@ -0,0 +1,40 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_amdgpu_test = files(
+  'amdgpu_test.c',
+  'basic_tests.c',
+  'bo_tests.c',
+  'cs_tests.c',
+  'vce_tests.c',
+  'uvd_enc_tests.c',
+  'vcn_tests.c',
+  'deadlock_tests.c',
+  'vm_tests.c',
+)
+
+amdgpu_test = executable(
+  'amdgpu_test',
+  files_amdgpu_test,
+  dependencies : [dep_cunit, dep_threads],
+  include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')],
+  link_with : [libdrm, libdrm_amdgpu],
+  install : with_install_tests,
+)
diff --git a/tests/etnaviv/meson.build b/tests/etnaviv/meson.build
new file mode 100644
index 0000000..32c5cee
--- /dev/null
+++ b/tests/etnaviv/meson.build
@@ -0,0 +1,54 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_etnaviv_tests = [inc_root, inc_drm, include_directories('../../etnaviv')]
+
+etnaviv_2d_test_files = files(
+  'cmdstream.xml.h',
+  'etnaviv_2d_test.c',
+  'state.xml.h',
+  'state_2d.xml.h',
+  'write_bmp.c',
+  'write_bmp.h',
+)
+
+etnaviv_2d_test = executable(
+  'etnaviv_2d_test',
+  etnaviv_2d_test_files,
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
+
+etnaviv_cmd_stream_test = executable(
+  'etnaviv_cmd_stream_test',
+  files('etnaviv_cmd_stream_test.c'),
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
+
+etnaviv_bo_cache_test = executable(
+  'etnaviv_bo_cache_test',
+  files('etnaviv_bo_cache_test.c'),
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
new file mode 100644
index 0000000..940c3ce
--- /dev/null
+++ b/tests/exynos/meson.build
@@ -0,0 +1,54 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_exynos = include_directories('../../exynos')
+
+if with_libkms
+  exynos_fimg2d_test = executable(
+    'exynos_fimg2d_test',
+    files('exynos_fimg2d_test.c'),
+    c_args : warn_c_args,
+    include_directories : [inc_root, inc_drm, inc_exynos,
+                           include_directories('../../libkms')],
+    link_with : [libdrm, libkms, libdrm_exynos],
+    dependencies : dep_threads,
+    install : with_install_tests,
+  )
+endif
+
+exynos_fimg2d_perf = executable(
+  'exynos_fimg2d_perf',
+  files('exynos_fimg2d_perf.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm, inc_exynos],
+  link_with : [libdrm, libdrm_exynos],
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
+
+exynos_fimg2d_event = executable(
+  'exynos_fimg2d_event',
+  files('exynos_fimg2d_event.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm, inc_exynos],
+  link_with : [libdrm, libdrm_exynos],
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
diff --git a/tests/kms/meson.build b/tests/kms/meson.build
new file mode 100644
index 0000000..df30cc5
--- /dev/null
+++ b/tests/kms/meson.build
@@ -0,0 +1,54 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libkms_test_files = files(
+	'libkms-test.h',
+	'libkms-test-crtc.c',
+	'libkms-test-device.c',
+	'libkms-test-framebuffer.c',
+	'libkms-test-plane.c',
+	'libkms-test-screen.c',
+)
+
+libkms_test = static_library(
+  'kms-test',
+  libkms_test_files,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+kms_steal_crtc = executable(
+  'kms-steal-crtc',
+  files('kms-steal-crtc.c'),
+  dependencies : dep_cairo,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libkms_test, libutil],
+  install : with_install_tests,
+)
+
+kms_universal_planes = executable(
+  'kms-universal-planes',
+  files('kms-universal-planes.c'),
+  dependencies : dep_cairo,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libkms_test],
+  install : with_install_tests,
+)
diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
new file mode 100644
index 0000000..f713f26
--- /dev/null
+++ b/tests/kmstest/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+kmstest = executable(
+  'kmstest',
+  files('main.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, include_directories('../../libkms'), inc_drm],
+  link_with : [libutil, libkms, libdrm],
+  install : with_install_tests,
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..b97bd1f
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,86 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_tests = include_directories('.')
+
+subdir('util')
+subdir('kms')
+subdir('modeprint')
+subdir('proptest')
+subdir('modetest')
+subdir('vbltest')
+if with_libkms
+  subdir('kmstest')
+endif
+if with_radeon
+  subdir('radeon')
+endif
+if with_amdgpu and dep_cunit.found()
+  subdir('amdgpu')
+endif
+if with_exynos
+  subdir('exynos')
+endif
+if with_tegra
+  subdir('tegra')
+endif
+if with_etnaviv
+  subdir('etnaviv')
+endif
+if with_nouveau
+  subdir('nouveau')
+endif
+
+drmsl = executable(
+  'drmsl',
+  files('drmsl.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+hash = executable(
+  'hash',
+  files('hash.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+random = executable(
+  'random',
+  files('random.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+drmdevice = executable(
+  'drmdevice',
+  files('drmdevice.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+test('random', random, timeout : 240)
+test('hash', hash)
+test('drmsl', drmsl)
+test('drmdevice', drmdevice)
diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
new file mode 100644
index 0000000..5f0eb24
--- /dev/null
+++ b/tests/modeprint/meson.build
@@ -0,0 +1,29 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+modeprint = executable(
+  'modeprint',
+  files('modeprint.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
diff --git a/tests/modetest/meson.build b/tests/modetest/meson.build
new file mode 100644
index 0000000..2a08184
--- /dev/null
+++ b/tests/modetest/meson.build
@@ -0,0 +1,29 @@
+# Copyright © 2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+modetest = executable(
+  'modetest',
+  files('buffers.c', 'cursor.c', 'modetest.c'),
+  c_args : [warn_c_args, '-Wno-pointer-arith'],
+  include_directories : [inc_root, inc_tests, inc_drm],
+  dependencies : [dep_threads, dep_cairo],
+  link_with : [libdrm, libutil],
+  install : with_install_tests,
+)
diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
new file mode 100644
index 0000000..f5d73c1
--- /dev/null
+++ b/tests/nouveau/meson.build
@@ -0,0 +1,30 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+threaded = executable(
+  'threaded',
+  files('threaded.c'),
+  dependencies : [dep_dl, dep_threads],
+  include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
+  link_with : [libdrm, libdrm_nouveau],
+  c_args : warn_c_args,
+)
+
+test('threaded', threaded)
diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
new file mode 100644
index 0000000..dcd724f
--- /dev/null
+++ b/tests/proptest/meson.build
@@ -0,0 +1,30 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+proptest_files = files('proptest.c')
+
+proptest = executable(
+  'proptest',
+  files('proptest.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libdrm, libutil],
+  install : with_install_tests,
+)
diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
new file mode 100644
index 0000000..54db231
--- /dev/null
+++ b/tests/radeon/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+radeon_ttm = executable(
+  'radeon_ttm',
+  files('rbo.c', 'rbo.h', 'radeon_ttm.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
new file mode 100644
index 0000000..9c74ac4
--- /dev/null
+++ b/tests/tegra/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+openclose = executable(
+  'openclose',
+  files('openclose.c'),
+  include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
+  c_args : warn_c_args,
+  link_with : [libdrm, libdrm_tegra],
+)
diff --git a/tests/util/meson.build b/tests/util/meson.build
new file mode 100644
index 0000000..a0e1d3c
--- /dev/null
+++ b/tests/util/meson.build
@@ -0,0 +1,37 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+util_files = files(
+  'common.h',
+  'format.c',
+  'format.h',
+  'kms.c',
+  'kms.h',
+  'pattern.c',
+  'pattern.h',
+)
+
+libutil = static_library(
+  'util',
+  [util_files, config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_cairo
+)
diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
new file mode 100644
index 0000000..4fb1ad3
--- /dev/null
+++ b/tests/vbltest/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+vbltest = executable(
+  'vbltest',
+  files('vbltest.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libdrm, libutil],
+  install : with_install_tests,
+)
diff --git a/vc4/meson.build b/vc4/meson.build
new file mode 100644
index 0000000..0136987
--- /dev/null
+++ b/vc4/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_vc4',
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to vc4 kernel DRM services',
+)
-- 
git-series 0.9.1
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

* [PATCH v4 2/3] autotools: Include meson.build files in tarball
  2018-01-04 18:28 ` [PATCH v4 0/3] Meson build system Dylan Baker
  2018-01-04 18:28   ` [PATCH v4 1/3] Add meson " Dylan Baker
@ 2018-01-04 18:28   ` Dylan Baker
  2018-01-05 14:02     ` Eric Engestrom
  2018-01-04 18:28   ` [PATCH v4 3/3] README: Add note about meson Dylan Baker
  2 siblings, 1 reply; 29+ messages in thread
From: Dylan Baker @ 2018-01-04 18:28 UTC (permalink / raw)
  To: mesa-dev, dri-devel; +Cc: Dylan Baker

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
 Makefile.am | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 7b86214..66f70ca 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -135,7 +135,35 @@ if HAVE_VMWGFX
 klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
 endif
 
-EXTRA_DIST = include/drm/README
+EXTRA_DIST = \
+	include/drm/README \
+	amdgpu/meson.build \
+	etnaviv/meson.build \
+	exynos/meson.build \
+	freedreno/meson.build \
+	intel/meson.build \
+	libkms/meson.build \
+	man/meson.build \
+	nouveau/meson.build \
+	omap/meson.build \
+	radeon/meson.build \
+	tests/amdgpu/meson.build \
+	tests/etnaviv/meson.build \
+	tests/exynos/meson.build \
+	tests/kms/meson.build \
+	tests/kmstest/meson.build \
+	tests/modeprint/meson.build \
+	tests/nouveau/meson.build \
+	tests/proptest/meson.build \
+	tests/radeon/meson.build \
+	tests/tegra/meson.build \
+	tests/util/meson.build \
+	tests/vbltest/meson.build \
+	tests/meson.build \
+	vc4/meson.build \
+	data/meson.build \
+	meson.build \
+	meson_options.txt
 
 copy-headers :
 	cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v4 3/3] README: Add note about meson
  2018-01-04 18:28 ` [PATCH v4 0/3] Meson build system Dylan Baker
  2018-01-04 18:28   ` [PATCH v4 1/3] Add meson " Dylan Baker
  2018-01-04 18:28   ` [PATCH v4 2/3] autotools: Include meson.build files in tarball Dylan Baker
@ 2018-01-04 18:28   ` Dylan Baker
  2018-01-05 13:49     ` Eric Engestrom
  2 siblings, 1 reply; 29+ messages in thread
From: Dylan Baker @ 2018-01-04 18:28 UTC (permalink / raw)
  To: mesa-dev, dri-devel; +Cc: Dylan Baker

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
 README | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 26cab9d..58e55bc 100644
--- a/README
+++ b/README
@@ -15,9 +15,24 @@ with an older kernel.
 Compiling
 ---------
 
-libdrm  is  a  standard  autotools  package and  follows  the  normal
-configure, build  and install steps.   The first step is  to configure
-the package, which is done by running the configure shell script:
+libdrm has two build systems, a legacy autotools build system, and a newer
+meson build system. The meson build system is much faster, and offers a 
+slightly different interface, but otherwise provides much the same 
+feature set.
+
+To use it:
+
+    meson builddir
+
+By default this will install into /usr/local, you can change your prefix
+with --prefix=/usr (or -Dprefix=/usr to meson configure).
+
+Then use ninja to build and install:
+
+    ninja -C builddir install
+
+
+Alternatively you can invoke autotools configure:
 
 	./configure
 
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Mesa-dev] [PATCH v4 1/3] Add meson build system
  2018-01-04 18:28   ` [PATCH v4 1/3] Add meson " Dylan Baker
@ 2018-01-04 21:43     ` Igor Gnatenko
  2018-01-04 23:28       ` Dylan Baker
  0 siblings, 1 reply; 29+ messages in thread
From: Igor Gnatenko @ 2018-01-04 21:43 UTC (permalink / raw)
  To: Dylan Baker, mesa-dev, dri-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Thu, 2018-01-04 at 10:28 -0800, Dylan Baker wrote:
> This patch adds a complete meson build system, including tests and
> install. It has the necessary hooks to allow it be used as a subproject
> for other meson based builds such as mesa.

Builds fine on all architectures supported by Fedora, boots fine on my laptop
(x86_64).

All nitpicks are inline.

> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>

Reviewed-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>

> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 0000000..08c2ccd
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,143 @@
> [...]
> +option(
> +  'intel',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for Intel's KMS API.''',

Any reason to use `'''` here and there?

> [...]
> +option(
> +  'man-pages',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : 'Enable manpage generation and install.',

"installation".

> [...]
> +option(
> +  'valgrind',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : 'build libdrm with valgrind support',

"Build". And fullstop at the end of sentence.
- -- 
- -Igor Gnatenko
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEhLFO09aHZVqO+CM6aVcUvRu8X0wFAlpOoBcACgkQaVcUvRu8
X0yF9w//cgaMVkU4xTKegRJY4uuzTE3MQvMmaCoA8ivBaCWPuoX3ozlwsAgZZXaZ
Vo83tZ0u80cjgoSG4I/JcNp3UhsxtGgqcrqqcof/SGn+YS43eFKPL57dowwQ5qk3
ccAUgHtAdQXuCJFaQFsTISSEj1X07RA04mIMe7QZFh7AHsKmv+ctaTUO7uJsXJzi
aX7Z9rntTCnXvzZy7Y56XPCleXfi+yDzQPdDopZAEdLYT8hYUvebo6JGQUpg8iNd
YuvZsbkrpyV1uMY/2feSJ3Ns4ZTAj3I4F41Xbb7CqZt/BX60EnkZJXog4RSbdlri
cxMX7gPkrOXxNJbllmdN0nPdBP/atViRY7dDkE4Lv4YrmwL8oT4Mjfyb/TeINT2X
6NltSgc8+zSvQSkjWyKHzQ3ZQCQHIAheG+V2Cvnc1NIfX06AV9USRsSRzBMza+gW
cWNT2g/M0jjmLTVEoLR8MSLXAB9gfsBdRDEnvqEsZCqDh1idW1Ttuk3m/h3+BT8i
GMyCrswVgKLI7gBbdVFdLDarEIVtTJlYvPkGXxRyOzv1r5dM/MMmeay7P3WD+liE
CLF9nRVrekQA7Mh4Y61RSyFAntzBokNKL+FrSzSuseNtgYAM3Es0JgY1ndsczvVX
zUqULC0AEAEwmAIQmDlYFG+ut8nIvmk6aWHHlvLwUHgiDD+MEc4=
=dAKV
-----END PGP SIGNATURE-----

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Mesa-dev] [PATCH v4 1/3] Add meson build system
  2018-01-04 21:43     ` [Mesa-dev] " Igor Gnatenko
@ 2018-01-04 23:28       ` Dylan Baker
  0 siblings, 0 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-04 23:28 UTC (permalink / raw)
  To: Igor Gnatenko, dri-devel, mesa-dev


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

Quoting Igor Gnatenko (2018-01-04 13:43:51)
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On Thu, 2018-01-04 at 10:28 -0800, Dylan Baker wrote:
> > This patch adds a complete meson build system, including tests and
> > install. It has the necessary hooks to allow it be used as a subproject
> > for other meson based builds such as mesa.
> 
> Builds fine on all architectures supported by Fedora, boots fine on my laptop
> (x86_64).
> 
> All nitpicks are inline.
> 
> > Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
> 
> Reviewed-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
> 
> > diff --git a/meson_options.txt b/meson_options.txt
> > new file mode 100644
> > index 0000000..08c2ccd
> > --- /dev/null
> > +++ b/meson_options.txt
> > @@ -0,0 +1,143 @@
> > [...]
> > +option(
> > +  'intel',
> > +  type : 'combo',
> > +  value : 'auto',
> > +  choices : ['true', 'false', 'auto'],
> > +  description : '''Enable support for Intel's KMS API.''',
> 
> Any reason to use `'''` here and there?

to avoid escaping the ' in "Intel's". But I can change it if you prefer.

> 
> > [...]
> > +option(
> > +  'man-pages',
> > +  type : 'combo',
> > +  value : 'auto',
> > +  choices : ['true', 'false', 'auto'],
> > +  description : 'Enable manpage generation and install.',
> 
> "installation".
> 
> > [...]
> > +option(
> > +  'valgrind',
> > +  type : 'combo',
> > +  value : 'auto',
> > +  choices : ['true', 'false', 'auto'],
> > +  description : 'build libdrm with valgrind support',
> 
> "Build". And fullstop at the end of sentence.
> - -- 
> - -Igor Gnatenko
> -----BEGIN PGP SIGNATURE-----
> 
> iQIzBAEBCAAdFiEEhLFO09aHZVqO+CM6aVcUvRu8X0wFAlpOoBcACgkQaVcUvRu8
> X0yF9w//cgaMVkU4xTKegRJY4uuzTE3MQvMmaCoA8ivBaCWPuoX3ozlwsAgZZXaZ
> Vo83tZ0u80cjgoSG4I/JcNp3UhsxtGgqcrqqcof/SGn+YS43eFKPL57dowwQ5qk3
> ccAUgHtAdQXuCJFaQFsTISSEj1X07RA04mIMe7QZFh7AHsKmv+ctaTUO7uJsXJzi
> aX7Z9rntTCnXvzZy7Y56XPCleXfi+yDzQPdDopZAEdLYT8hYUvebo6JGQUpg8iNd
> YuvZsbkrpyV1uMY/2feSJ3Ns4ZTAj3I4F41Xbb7CqZt/BX60EnkZJXog4RSbdlri
> cxMX7gPkrOXxNJbllmdN0nPdBP/atViRY7dDkE4Lv4YrmwL8oT4Mjfyb/TeINT2X
> 6NltSgc8+zSvQSkjWyKHzQ3ZQCQHIAheG+V2Cvnc1NIfX06AV9USRsSRzBMza+gW
> cWNT2g/M0jjmLTVEoLR8MSLXAB9gfsBdRDEnvqEsZCqDh1idW1Ttuk3m/h3+BT8i
> GMyCrswVgKLI7gBbdVFdLDarEIVtTJlYvPkGXxRyOzv1r5dM/MMmeay7P3WD+liE
> CLF9nRVrekQA7Mh4Y61RSyFAntzBokNKL+FrSzSuseNtgYAM3Es0JgY1ndsczvVX
> zUqULC0AEAEwmAIQmDlYFG+ut8nIvmk6aWHHlvLwUHgiDD+MEc4=
> =dAKV
> -----END PGP SIGNATURE-----
> 

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlpOuKQACgkQCJ4WlhQG
iO9Y8wf9GSJGEh0DX/9BmJpauXRb0D/WB0xkT+6xzJ9U4jWAw/Hj3BlMNmFagixv
bsfJeAkjIT0CoxWcfdyNEq3wOnMJCjFbwM9zU5vvtmPI5J3f1XQ0HishOyQQ37bg
cTabuAIZNCrajSy7wGcvOqVXfFT1A72i585j1SadAZudo4duFnfV1cmTpa1YZXhg
MAL6m4T8YPMyaWmOx4vYqfFDlS9Iq8GlXacS8w2KApN+7/XtWV5tCi3mD2izJe5S
neEXm7FO+cmdzEtIYlzmfu+gMBTVHsYVFO9PthdnIt08gJPeosswuQVHLEn6FCAh
tfk6oRQVNhiFHgFWCuJvqkWSJg4mWg==
=s/e6
-----END PGP SIGNATURE-----

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/3] Add meson build system
  2018-01-03 21:31 ` [PATCH 1/3] Add meson " Dylan Baker
  2018-01-03 22:18   ` Dylan Baker
  2018-01-03 23:22   ` [Mesa-dev] " Igor Gnatenko
@ 2018-01-05 13:34   ` Eric Engestrom
  2018-01-05 13:41     ` Eric Engestrom
  2018-01-05 19:52     ` Dylan Baker
  2 siblings, 2 replies; 29+ messages in thread
From: Eric Engestrom @ 2018-01-05 13:34 UTC (permalink / raw)
  To: Dylan Baker; +Cc: mesa-dev, dri-devel

On Wednesday, 2018-01-03 13:31:28 -0800, Dylan Baker wrote:
> This patch adds a complete meson build system, including tests and
> install. It has the necessary hooks to allow it be used as a subproject
> for other meson based builds such as mesa.
> 
> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
> ---
>  .editorconfig               |   4 +-
>  amdgpu/.editorconfig        |   5 +-
>  amdgpu/meson.build          |  70 +++++++-
>  data/meson.build            |  27 +++-
>  etnaviv/meson.build         |  64 ++++++-
>  exynos/meson.build          |  53 +++++-
>  freedreno/meson.build       |  82 ++++++++-
>  intel/meson.build           | 111 +++++++++++-
>  libkms/meson.build          |  75 +++++++-
>  man/meson.build             |  66 ++++++-
>  meson.build                 | 378 +++++++++++++++++++++++++++++++++++++-
>  meson_options.txt           |  38 ++++-
>  nouveau/meson.build         |  65 ++++++-
>  omap/meson.build            |  53 +++++-
>  radeon/meson.build          |  65 ++++++-
>  tegra/meson.build           |  52 +++++-
>  tests/amdgpu/meson.build    |  40 ++++-
>  tests/etnaviv/meson.build   |  54 +++++-
>  tests/exynos/meson.build    |  54 +++++-
>  tests/kms/meson.build       |  54 +++++-
>  tests/kmstest/meson.build   |  28 +++-
>  tests/meson.build           |  85 ++++++++-
>  tests/modeprint/meson.build |  29 +++-
>  tests/nouveau/meson.build   |  30 +++-
>  tests/proptest/meson.build  |  30 +++-
>  tests/radeon/meson.build    |  27 +++-
>  tests/tegra/meson.build     |  27 +++-
>  tests/util/meson.build      |  37 ++++-
>  tests/vbltest/meson.build   |  28 +++-
>  vc4/meson.build             |  28 +++-
>  30 files changed, 1759 insertions(+)
>  create mode 100644 amdgpu/meson.build
>  create mode 100644 data/meson.build
>  create mode 100644 etnaviv/meson.build
>  create mode 100644 exynos/meson.build
>  create mode 100644 freedreno/meson.build
>  create mode 100644 intel/meson.build
>  create mode 100644 libkms/meson.build
>  create mode 100644 man/meson.build
>  create mode 100644 meson.build
>  create mode 100644 meson_options.txt
>  create mode 100644 nouveau/meson.build
>  create mode 100644 omap/meson.build
>  create mode 100644 radeon/meson.build
>  create mode 100644 tegra/meson.build
>  create mode 100644 tests/amdgpu/meson.build
>  create mode 100644 tests/etnaviv/meson.build
>  create mode 100644 tests/exynos/meson.build
>  create mode 100644 tests/kms/meson.build
>  create mode 100644 tests/kmstest/meson.build
>  create mode 100644 tests/meson.build
>  create mode 100644 tests/modeprint/meson.build
>  create mode 100644 tests/nouveau/meson.build
>  create mode 100644 tests/proptest/meson.build
>  create mode 100644 tests/radeon/meson.build
>  create mode 100644 tests/tegra/meson.build
>  create mode 100644 tests/util/meson.build
>  create mode 100644 tests/vbltest/meson.build
>  create mode 100644 vc4/meson.build
> 
> diff --git a/.editorconfig b/.editorconfig
> index 893b7be..bbad3e6 100644
> --- a/.editorconfig
> +++ b/.editorconfig
> @@ -17,3 +17,7 @@ indent_style = tab
>  [*.m4]
>  indent_style = space
>  indent_size = 2
> +
> +[meson.build,meson_options.txt]

I think this needs to be
  [{meson.build,meson_options.txt}]

> +indent_style = space
> +indent_size = 2
> diff --git a/amdgpu/.editorconfig b/amdgpu/.editorconfig
> index 2528d67..0c758d6 100644
> --- a/amdgpu/.editorconfig
> +++ b/amdgpu/.editorconfig
> @@ -7,3 +7,8 @@ indent_style = tab
>  indent_size = 8
>  tab_width = 8
>  insert_final_newline = true
> +
> +[meson.build]
> +indent_style = space
> +indent_size = 2

These two should be inherited from the .editorconfig one level above

> +insert_final_newline = false

That's weird; why?

> diff --git a/amdgpu/meson.build b/amdgpu/meson.build
> new file mode 100644
> index 0000000..13bf88b
> --- /dev/null
> +++ b/amdgpu/meson.build
> @@ -0,0 +1,70 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_amdgpu = files(
> +  'amdgpu_asic_id.c',
> +  'amdgpu_bo.c',
> +  'amdgpu_cs.c',
> +  'amdgpu_device.c',
> +  'amdgpu_gpu_info.c',
> +  'amdgpu_internal.h',
> +  'amdgpu_vamgr.c',
> +  'amdgpu_vm.c',
> +  'util_hash.c',
> +  'util_hash.h',
> +  'util_hash_table.c',
> +  'util_hash_table.h',

Should we clean up the list in libdrm (even though it's not in mesa),
and only have files that need to be in these lists?
Ie. remove all files that are included by other files in the list, such
as all the headers in this list?

> +)
> +
> +libdrm_amdgpu = shared_library(
> +  'drm_amdgpu',
> +  [files_amdgpu, config_file],
> +  c_args : [
> +    warn_c_args,
> +    '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(get_option('datadir'), 'amdgpu.ids')),

This raises the question: do we want to support android?
Also, isn't there a /libdrm/ missing here?

> +  ],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],

Nit: unnecessary brackets

> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +install_headers('amdgpu.h', subdir : 'libdrm')
> +
> +pkg.generate(
> +  name : 'libdrm_amdgpu',
> +  libraries : libdrm_amdgpu,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to kernel DRM services for amdgpu',
> +)
> +
> +ext_libdrm_amdgpu = declare_dependency(
> +  link_with : [libdrm, libdrm_amdgpu],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +test(
> +  'amdgpu-symbol-check',
> +  prog_bash,
> +  args : [files('amdgpu-symbol-check'), libdrm_amdgpu]
> +)
> diff --git a/data/meson.build b/data/meson.build
> new file mode 100644
> index 0000000..4990ca5
> --- /dev/null
> +++ b/data/meson.build
> @@ -0,0 +1,27 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +if with_amdgpu
> +  install_data(
> +    'amdgpu.ids',
> +    install_mode : 'r--r--r--',
> +    install_dir : join_paths(get_option('datadir'), 'libdrm'),

How about setting a variable in amdgpu/meson.build?

> +  )
> +endif
> diff --git a/etnaviv/meson.build b/etnaviv/meson.build
> new file mode 100644
> index 0000000..8f39775
> --- /dev/null
> +++ b/etnaviv/meson.build
> @@ -0,0 +1,64 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_etnaviv = files(
> +  'etnaviv_device.c',
> +  'etnaviv_gpu.c',
> +  'etnaviv_bo.c',
> +  'etnaviv_bo_cache.c',
> +  'etnaviv_perfmon.c',
> +  'etnaviv_pipe.c',
> +  'etnaviv_cmd_stream.c',
> +  'etnaviv_drm.h',
> +  'etnaviv_priv.h',
> +)
> +
> +libdrm_etnaviv = shared_library(
> +  'drm_etnaviv',
> +  [files_etnaviv, config_file],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +  dependencies : [dep_pthread_stubs, dep_rt],
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +install_headers('etnaviv_drmif.h', subdir : 'libdrm')
> +
> +pkg.generate(
> +  name : 'libdrm_etnaviv',
> +  libraries : libdrm_etnaviv,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to Tegra kernel DRM services',
> +)
> +
> +ext_libdrm_etnaviv = declare_dependency(
> +  link_with : [libdrm, libdrm_etnaviv],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +test(
> +  'etnaviv-symbol-check',
> +  prog_bash,
> +  args : [files('etnaviv-symbol-check'), libdrm_etnaviv]
> +)
> diff --git a/exynos/meson.build b/exynos/meson.build
> new file mode 100644
> index 0000000..7da74aa
> --- /dev/null
> +++ b/exynos/meson.build
> @@ -0,0 +1,53 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libdrm_exynos = shared_library(
> +  'drm_exynos',
> +  [files('exynos_drm.c', 'exynos_fimg2d.c', 'fimg2d_reg.h'), config_file],

Why skip files_exynos? I think I prefer the consistency, even if the var
only contains two files.

> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +install_headers('exynos_drmif.h', subdir : 'libdrm')
> +install_headers('exynos_drm.h', 'exynos_fimg2d.h', subdir : 'exynos')
> +
> +ext_libdrm_exynos = declare_dependency(
> +  link_with : [libdrm, libdrm_exynos],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_exynos',
> +  libraries : libdrm_exynos,
> +  subdirs : ['.', 'libdrm', 'exynos'],
> +  version : '0.7',
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to exynos kernel DRM services',
> +)
> +
> +test(
> +  'exynos-symbol-check',
> +  prog_bash,
> +  args : [files('exynos-symbol-check'), libdrm_exynos]
> +)
> diff --git a/freedreno/meson.build b/freedreno/meson.build
> new file mode 100644
> index 0000000..47d6e44
> --- /dev/null
> +++ b/freedreno/meson.build
> @@ -0,0 +1,82 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_freedreno = files(
> +  'freedreno_device.c',
> +  'freedreno_pipe.c',
> +  'freedreno_priv.h',
> +  'freedreno_ringbuffer.c',
> +  'freedreno_bo.c',
> +  'freedreno_bo_cache.c',
> +  'msm/msm_bo.c',
> +  'msm/msm_device.c',
> +  'msm/msm_drm.h',
> +  'msm/msm_pipe.c',
> +  'msm/msm_priv.h',
> +  'msm/msm_ringbuffer.c',
> +)
> +
> +if with_freedreno_kgsl != 'false'

(mentioned by someone already)

> +  files_freedreno += files(
> +    'kgsl/kgsl_bo.c',
> +    'kgsl/kgsl_device.c',
> +    'kgsl/kgsl_drm.h',
> +    'kgsl/kgsl_pipe.c',
> +    'kgsl/kgsl_priv.h',
> +    'kgsl/kgsl_ringbuffer.c',
> +    'kgsl/msm_kgsl.h',
> +  )
> +endif
> +
> +libdrm_freedreno = shared_library(
> +  'drm_freedreno',
> +  [files_freedreno, config_file],
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm],
> +  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
> +  link_with : libdrm,
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_freedreno = declare_dependency(
> +  link_with : [libdrm, libdrm_freedreno],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers(
> +  'freedreno_drmif.h', 'freedreno_ringbuffer.h',
> +  subdir : 'freedreno'
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_freedreno',
> +  libraries : libdrm_freedreno,
> +  subdirs : ['.', 'libdrm', 'freedreno'],
> +  version : '0.7',
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to freedreno kernel DRM services',
> +)
> +
> +test(
> +  'freedreno-symbol-check',
> +  prog_bash,
> +  args : [files('freedreno-symbol-check'), libdrm_freedreno]
> +)
> diff --git a/intel/meson.build b/intel/meson.build
> new file mode 100644
> index 0000000..18f35c0
> --- /dev/null
> +++ b/intel/meson.build
> @@ -0,0 +1,111 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_intel = files(
> +  'intel_bufmgr.c',
> +  'intel_bufmgr_priv.h',
> +  'intel_bufmgr_fake.c',
> +  'intel_bufmgr_gem.c',
> +  'intel_decode.c',
> +  'intel_chipset.h',
> +  'mm.c',
> +  'mm.h',
> +  'uthash.h',
> +)
> +
> +libdrm_intel = shared_library(
> +  'drm_intel',
> +  [files_intel, config_file],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
> +  c_args : warn_c_args,
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_intel = declare_dependency(
> +  link_with : [libdrm, libdrm_intel],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers(
> +  'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h',
> +  subdir : 'libdrm',
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_intel',
> +  libraries : libdrm_intel,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires : 'libdrm',
> +  description : 'Userspace interface to intel kernel DRM services',
> +)
> +
> +test_decode = executable(
> +  'test_decode',
> +  files('test_decode.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : [libdrm, libdrm_intel],
> +  c_args : warn_c_args,
> +)
> +
> +test(
> +  'gen4-3d.batch',
> +  prog_bash,
> +  args : files('tests/gen4-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen45-3d.batch',
> +  prog_bash,
> +  args : files('tests/gm45-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen5-3d.batch',
> +  prog_bash,
> +  args : files('tests/gen5-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen6-3d.batch',
> +  prog_bash,
> +  args : files('tests/gen6-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen7-3d.batch',
> +  prog_bash,
> +  args : files('tests/gen7-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen7-2d-copy.batch',
> +  prog_bash,
> +  args : files('tests/gen7-2d-copy.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'intel-symbol-check',
> +  prog_bash,
> +  args : [files('intel-symbol-check'), libdrm_intel]
> +)
> diff --git a/libkms/meson.build b/libkms/meson.build
> new file mode 100644
> index 0000000..80afc89
> --- /dev/null
> +++ b/libkms/meson.build
> @@ -0,0 +1,75 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libkms_include = [inc_root, inc_drm]
> +files_libkms = files(
> +  'internal.h',
> +  'linux.c',
> +  'dumb.c',
> +  'api.c',
> +)
> +if with_vmwgfx
> +  files_libkms += files('vmwgfx.c')
> +endif
> +if with_intel
> +  files_libkms += files('intel.c')
> +endif
> +if with_nouveau
> +  files_libkms += files('nouveau.c')
> +endif
> +if with_radeon
> +  files_libkms += files('radeon.c')
> +endif
> +if with_exynos
> +  files_libkms += files('exynos.c')
> +  libkms_include += include_directories('../exynos')
> +endif
> +
> +libkms = shared_library(
> +  'kms',
> +  [files_libkms, config_file],
> +  c_args : warn_c_args,
> +  include_directories : libkms_include,
> +  link_with : libdrm,
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +ext_libkms = declare_dependency(
> +  link_with : [libdrm, libkms],
> +  include_directories : [libkms_include],
> +)
> +
> +install_headers('libkms.h', subdir : 'libkms')
> +
> +pkg.generate(
> +  name : 'libkms',
> +  libraries : libkms,
> +  subdirs : ['libkms'],
> +  version : '1.0.0',
> +  requires_private : 'libdrm',
> +  description : 'Library that abstracts away the different mm interfaces for kernel drivers',
> +)
> +
> +test(
> +  'kms-symbol-check',
> +  prog_bash,
> +  args : [files('kms-symbol-check'), libkms]
> +)
> diff --git a/man/meson.build b/man/meson.build
> new file mode 100644
> index 0000000..0b2efe5
> --- /dev/null
> +++ b/man/meson.build
> @@ -0,0 +1,66 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +xsltproc_args = [
> +  '--stringparam', 'man.authors.section.enabled', '0',
> +  '--stringparam', 'man.copyright.section.enabled', '0',
> +  '--stringparam', 'funcsynopsis.style', 'ansi',
> +  '--stringparam', 'man.output.quietly', '1',
> +  '--nonet', manpage_style,
> +]
> +
> +xmls = [
> +  ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'],
> +  ['drmHandleEvent', '3'], ['drmModeGetResources', '3']
> +]
> +foreach x : xmls
> +  m = x[0]
> +  s = x[1]
> +  custom_target(
> +    m,
> +    input : files('@0@.xml'.format(m)),
> +    output : '@0@.@1@'.format(m, s),
> +    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'],
> +    install : true,
> +    install_dir : join_paths(get_option('datadir'), 'man', 'man@0@'.format(s)),

get_option('mandir')

> +    build_by_default : true,
> +  )
> +endforeach
> +
> +foreach x : ['drm-mm', 'drm-gem', 'drm-ttm']
> +  gen = custom_target(
> +    'gen-@0@'.format(x),
> +    input : 'drm-memory.xml',
> +    output : '@0@.xml'.format(x),
> +    command : [prog_sed, '-e',
> +               's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@',
> +               '@INPUT@'],
> +    capture : true,
> +  )
> +  custom_target(
> +    '@0@.7'.format(x),
> +    input : gen,
> +    output : '@0@.7'.format(x, '7'),
> +    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'],
> +    install : true,
> +    install_dir : join_paths(get_option('datadir'), 'man', 'man7'),

ditto: mandir

> +    build_by_default : true,
> +  )
> +endforeach
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 0000000..74ae222
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,378 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +project(
> +  'libdrm',
> +  ['c'],
> +  version : '2.4.89',
> +  license : 'MIT',
> +  default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],

gnu99, are you sure?

also, we should specify the version of meson we support here:
+  meson_version : '>= 0.42',

> +)
> +
> +pkg = import('pkgconfig')
> +
> +with_udev = get_option('udev')
> +with_freedreno_kgsl = get_option('freedreno-kgls')
> +with_install_tests = get_option('install_test_programs')
> +with_cairo_tests = get_option('cairo_tests')
> +with_valgrind = get_option('valgrind')
> +
> +config = configuration_data()
> +
> +# TODO: openbsd is guess, the others are correct
> +if ['freebsd', 'dragonfly', 'netbsd', 'openbsd'].contains(host_machine.system())

Let's make that *BSD until we know of a special case?
  if host_machine.system().to_upper.endswith('BSD')

> +  dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
> +else
> +  dep_pthread_stubs = []
> +endif
> +dep_threads = dependency('threads')
> +
> +cc = meson.get_compiler('c')
> +# Check for atomics
> +if cc.compiles('''
> +    int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
> +    int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
> +    ''',
> +    name : 'Intel Atomics')
> +  config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', true)

Will be unset in the other cases, instead of being set to 0

> +  with_atomics = true
> +elif cc.has_header('atomic_ops.h')
> +  config.set10('HAVE_LIB_ATOMIC_OPS', true)

Ditto.

Those can be easily fixed by setting them to false first, just before
the if chain:
  config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', false)
  config.set10('HAVE_LIB_ATOMIC_OPS', false)

> +  with_atomics = true
> +elif cc.has_function('atomic_cas_uint')
> +  with_atomics = true
> +else
> +  with_atomics = false
> +endif
> +
> +with_intel = false
> +_intel = get_option('intel')
> +if _intel != 'false'
> +  if _intel == 'true' and not with_atomics
> +    error('libdrm_intel requires atomics.')
> +  endif
> +  with_intel = _intel == 'true' or host_machine.cpu_family().startswith('x86')
> +endif
> +
> +with_radoen = false

typo

> +_radeon = get_option('radeon')
> +if _radeon != 'false'
> +  if _radeon == 'true' and not with_atomics
> +    error('libdrm_radeon requires atomics.')
> +  endif
> +  with_radeon = true
> +endif
> +
> +with_amdgpu = false
> +_amdgpu = get_option('amdgpu')
> +if _amdgpu != 'false'
> +  if _amdgpu == 'true' and not with_atomics
> +    error('libdrm_amdgpu requires atomics.')
> +  endif
> +  with_amdgpu = true
> +endif
> +
> +with_nouveau = false
> +_nouveau = get_option('nouveau')
> +if _nouveau != 'false'
> +  if _nouveau == 'true' and not with_atomics
> +    error('libdrm_nouveau requires atomics.')
> +  endif
> +  with_nouveau = true
> +endif
> +
> +with_vmwgfx = false
> +_vmwgfx = get_option('vmwgfx')
> +if _vmwgfx != 'false'
> +  with_vmwgfx = true
> +endif
> +
> +with_omap = false
> +_omap = get_option('omap')
> +if _omap != 'false'
> +  if _omap == 'true' and not with_atomics
> +    error('libdrm_omap requires atomics.')
> +  endif
> +  with_omap = _omap == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +endif
> +
> +with_freedreno = false
> +_freedreno = get_option('freedreno')
> +if _freedreno != 'false'
> +  if _freedreno == 'true' and not with_atomics
> +    error('libdrm_freedreno requires atomics.')
> +  endif
> +  with_freedreno = _freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +endif
> +
> +with_tegra = false
> +_tegra = get_option('tegra')
> +if _tegra != 'false'
> +  if _tegra == 'true' and not with_atomics
> +    error('libdrm_tegra requires atomics.')
> +  endif
> +  with_tegra = _tegra == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +endif
> +
> +with_etnaviv = false
> +_etnaviv = get_option('etnaviv')
> +if _etnaviv != 'false'
> +  if _etnaviv == 'true' and not with_atomics
> +    error('libdrm_etnaviv requires atomics.')
> +  endif
> +  with_etnaviv = _etnaviv == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +endif
> +
> +with_exynos = false
> +_exynos = get_option('exynos')
> +if _exynos != 'false'
> +  with_exynos = _exynos == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +endif
> +
> +with_vc4 = false
> +_vc4 = get_option('vc4')
> +if _vc4 != 'false'
> +  with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +endif
> +
> +# XXX: Aparently only freebsd and dragonfly bsd actually need this (and
> +# gnu/kfreebsd), not openbsd and netbsd
> +with_libkms = false
> +_libkms = get_option('libkms')
> +if _libkms != 'false'
> +  with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
> +endif
> +
> +if with_udev
> +  dep_udev = dependency('udev')
> +  config.set10('UDEV', true)
> +else
> +  dep_udev = []
> +endif
> +
> +# Among others FreeBSD does not have a separate dl library.
> +if not cc.has_function('dlsym')
> +  dep_dl = cc.find_library('dl', required : with_nouveau)
> +else
> +  dep_dl = []
> +endif
> +# clock_gettime might require -rt, or it might not. find out
> +if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
> +  # XXX: untested
> +  dep_rt = cc.find_library('rt')
> +else
> +  dep_rt = []
> +endif
> +dep_m = cc.find_library('m', required : false)
> +if cc.has_header('sys/sysctl.h')
> +  config.set10('HAVE_SYS_SYSCTL_H', true)
> +endif
> +if cc.has_header('sys/select.h')
> +  config.set10('HAVE_SYS_SELECT_H', true)
> +endif
> +if cc.has_header_symbol('sys/sysmacros.h', 'major')
> +  config.set10('MAJOR_IN_SYSMACROS', true)
> +elif cc.has_header_symbol('sys/mkdev.h', 'major')
> +  config.set10('MAJOR_IN_MKDEV', true)
> +endif
> +if cc.has_function('open_memstream')
> +  config.set10('HAVE_OPEN_MEMSTREAM', true)
> +endif
> +
> +warn_c_args = []
> +foreach a : ['-Wall', '-Wextra', '-Wsign-compare', 
> +             '-Werror-implicit-function-declaration', '-Wpointer-arith',
> +             '-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes',
> +             '-Wmissing-declarations', '-Wnested-externs', '-Wpacked',
> +             '-Wswitch-enum', '-Wmissing-format-attribute', 
> +             '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', 
> +             '-Wdeclaration-after-statement', '-Wold-style-definition']
> +  if cc.has_argument(a)
> +    warn_c_args += a
> +  endif
> +endforeach
> +# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list
> +# of options
> +foreach a : ['unused-parameter', 'attributes', 'long-long', 
> +             'missing-field-initializers']
> +  if cc.has_argument('-W@0@'.format(a))
> +    warn_c_args += '-Wno-@0@'.format(a)
> +  endif
> +endforeach
> +
> +
> +dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
> +dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
> +dep_cairo = dependency('cairo', required : with_cairo_tests == 'true')
> +dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
> +
> +with_man_pages = get_option('man_pages')
> +prog_xslt = find_program('xsltproc', required : with_man_pages == 'true')
> +prog_sed = find_program('sed', required : with_man_pages == 'true')
> +manpage_style = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
> +if prog_xslt.found()
> +  if run_command(prog_xslt, '--nonet', manpage_style).returncode() != 0
> +    if with_man_pages == 'true'
> +      error('Manpage style sheet cannot be found')
> +    endif
> +    with_man_pages = 'false'
> +  endif
> +endif
> +with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
> +
> +# Used for tets
> +prog_bash = find_program('bash')
> +
> +if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
> +               name : 'compiler supports __attribute__(("hidden"))')
> +  config.set10('HAVE_VISIBILITY', true)
> +endif
> +
> +foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'],
> +             [with_nouveau, 'NOUVEAU'], [with_omap, 'OMAP'],
> +             [with_exynos, 'EXYNOS'], [with_freedreno, 'FREEDRENO'],
> +             [with_tegra, 'TEGRA'], [with_vc4, 'VC4'],
> +             [with_etnaviv, 'ETNAVIV'], [with_install_tests, 'INSTALL_TESTS']]

HAVE_INSTALL_TESTS is not used in C files, you can remove it from this list :)

> +  e = t[0]
> +  if e

Why the temp var?

> +    config.set10('HAVE_@0@'.format(t[1]), true)

I'll add -Wundef when I have some time and go through those so we can have
  config.set10('HAVE_@0@'.format(t[1]), t[0])

Then we can eventually switch to -Werror=undef :D

> +  endif
> +endforeach
> +if with_freedreno_kgsl
> +  if not with_freedreno
> +    error('cannot enable freedreno-kgsl without freedreno support')
> +  endif
> +  config.set10('HAVE_FREEDRENO_KGSL', true)
> +endif

> +if with_amdgpu
> +  config.set10('HAVE_AMDGPU', true)
> +  if dep_cunit.found()
> +    config.set10('HAVE_CUNIT', true)
> +  endif
> +endif

These two are actually unused, and should be removed from configure.ac :)

> +if dep_cairo.found()
> +  config.set10('HAVE_CAIRO', true)
> +endif
> +if dep_valgrind.found()
> +  config.set10('HAVE_VALGRIND', true)
> +endif
> +
> +config.set10('_GNU_SOURCE', true)
> +config_file = configure_file(
> +  configuration : config,
> +  output : 'config.h',
> +)
> +add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
> +
> +inc_root = include_directories('.')
> +inc_drm = include_directories('include/drm')
> +
> +files_libdrm = files(
> +	'xf86drm.c',
> +	'xf86drmHash.c',
> +	'xf86drmHash.h',
> +	'xf86drmRandom.c',
> +	'xf86drmRandom.h',
> +	'xf86drmSL.c',
> +	'xf86drmMode.c',
> +	'xf86atomic.h',
> +	'libdrm_macros.h',
> +	'libdrm_lists.h',
> +	'util_double_list.h',
> +	'util_math.h',
> +)
> +
> +libdrm = shared_library(
> +  'drm',
> +  [files_libdrm, config_file],
> +  c_args : warn_c_args,
> +  dependencies : [dep_udev, dep_valgrind, dep_rt, dep_m],
> +  include_directories : inc_drm,
> +  version : '2.4.0',
> +  install : true,
> +)
> +
> +ext_libdrm = declare_dependency(
> +  link_with : libdrm,
> +  include_directories : inc_drm,
> +)
> +
> +install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
> +install_headers(
> +	'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
> +	'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
> +	'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
> +	'include/drm/nouveau_drm.h', 'include/drm/qxl_drm.h',
> +	'include/drm/r128_drm.h', 'include/drm/radeon_drm.h',
> +	'include/drm/amdgpu_drm.h', 'include/drm/savage_drm.h',
> +	'include/drm/sis_drm.h', 'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h',
> +	'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h',

Do we want to only install the headers for the libs that are enabled?
(Not sure what autotools does)

> +  subdir : 'libdrm',
> +)
> +if with_vmwgfx
> +  install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm')
> +endif
> +
> +pkg.generate(
> +  name : 'libdrm',
> +  libraries : libdrm,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  description : 'Userspace interface to kernel DRM services',
> +)
> + 
> +if with_libkms
> +  subdir('libkms')
> +endif
> +if with_intel
> +  subdir('intel')
> +endif
> +if with_nouveau
> +  subdir('nouveau')
> +endif
> +if with_radeon
> +  subdir('radeon')
> +endif
> +if with_amdgpu
> +  subdir('amdgpu')
> +endif
> +if with_omap
> +  subdir('omap')
> +endif
> +if with_exynos
> +  subdir('exynos')
> +endif
> +if with_freedreno
> +  subdir('freedreno')
> +endif
> +if with_tegra
> +  subdir('tegra')
> +endif
> +if with_vc4
> +  subdir('vc4')
> +endif
> +if with_etnaviv
> +  subdir('etnaviv')
> +endif
> +if with_man_pages
> +  subdir('man')
> +endif
> +subdir('data')
> +subdir('tests')
> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 0000000..7c2fa4f
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,38 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +option('libkms',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('intel',       type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('radeon',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('amdgpu',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('nouveau',     type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('vmwgfx',      type : 'combo', value : 'true',  choices : ['true', 'false', 'auto'])
> +option('omap',        type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> +option('exynos',      type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> +option('freedreno',   type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('tegra',       type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> +option('vc4',         type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('etnaviv',     type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> +option('cairo_tests', type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('man_pages',   type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('valgrind',    type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> +option('freedreno-kgls',        type : 'boolean', value : false)
> +option('install_test_programs', type : 'boolean', value : false)
> +option('udev',                  type : 'boolean', value : false)

(as mentioned, descriptions would be good; copy/pasting the ones in
configure.ac should be enough)

> diff --git a/nouveau/meson.build b/nouveau/meson.build
> new file mode 100644
> index 0000000..a50e4f7
> --- /dev/null
> +++ b/nouveau/meson.build
> @@ -0,0 +1,65 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_nouveau = files(
> +	'nouveau.c',
> +	'pushbuf.c',
> +	'bufctx.c',
> +	'abi16.c',
> +	'private.h',
> +)
> +
> +libdrm_nouveau = shared_library(
> +  'drm_nouveau',
> +  [files_nouveau, config_file],
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : dep_threads,
> +  version : '2.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_nouveau = declare_dependency(
> +  link_with : [libdrm, libdrm_nouveau],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers('nouveau.h', subdir : 'libdrm/nouveau')
> +install_headers(
> +  'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h',
> +  'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h',
> +  subdir : 'libdrm/nouveau/nvif'
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_nouveau',
> +  libraries : libdrm_nouveau,
> +  subdirs : ['.', 'nouveau'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to nouveau kernel DRM services',
> +)
> +
> +test(
> +  'nouveau-symbol-check',
> +  prog_bash,
> +  args : [files('nouveau-symbol-check'), libdrm_nouveau]
> +)
> diff --git a/omap/meson.build b/omap/meson.build
> new file mode 100644
> index 0000000..1881087
> --- /dev/null
> +++ b/omap/meson.build
> @@ -0,0 +1,53 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libdrm_omap = shared_library(
> +  'drm_omap',
> +  [files('omap_drm.c'), config_file],
> +  include_directories : [inc_root, inc_drm],
> +  c_args : warn_c_args,
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_omap = declare_dependency(
> +  link_with : [libdrm, libdrm_omap],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers('omap_drmif.h', subdir : 'libdrm')
> +install_headers('omap_drm.h', subdir : 'omap')
> +
> +pkg.generate(
> +  name : 'libdrm_omap',
> +  libraries : libdrm_omap,
> +  subdirs : ['.', 'libdrm', 'omap'],
> +  version : '0.6',
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to omap kernel DRM services',
> +)
> +
> +test(
> +  'omap-symbol-check',
> +  prog_bash,
> +  args : [files('omap-symbol-check'), libdrm_omap]
> +)
> diff --git a/radeon/meson.build b/radeon/meson.build
> new file mode 100644
> index 0000000..f41c5c4
> --- /dev/null
> +++ b/radeon/meson.build
> @@ -0,0 +1,65 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_radeon = files(
> +	'radeon_bo_gem.c',
> +	'radeon_cs_gem.c',
> +	'radeon_cs_space.c',
> +	'radeon_bo.c',
> +	'radeon_cs.c',
> +	'radeon_surface.c',
> +)
> +
> +libdrm_radeon = shared_library(
> +  'drm_radeon',
> +  [files_radeon, config_file],
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],
> +  version : '1.0.1',
> +  install : true,
> +)
> +
> +ext_libdrm_radeon = declare_dependency(
> +  link_with : [libdrm, libdrm_radeon],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers(
> +	'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h',
> +	'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h',
> +  subdir : 'libdrm'
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_radeon',
> +  libraries : libdrm_radeon,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to kernel DRM services for radeon',
> +)
> +
> +test(
> +  'radeon-symbol-check',
> +  prog_bash,
> +  args : [files('radeon-symbol-check'), libdrm_radeon]
> +)
> diff --git a/tegra/meson.build b/tegra/meson.build
> new file mode 100644
> index 0000000..568531c
> --- /dev/null
> +++ b/tegra/meson.build
> @@ -0,0 +1,52 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libdrm_tegra = shared_library(
> +  'drm_tegra',
> +  [files('private.h', 'tegra.c'), config_file],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],
> +  c_args : warn_c_args,
> +  version : '0.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_tegra = declare_dependency(
> +  link_with : [libdrm, libdrm_tegra],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers('tegra.h', subdir : 'libdrm')
> +
> +pkg.generate(
> +  name : 'libdrm_tegra',
> +  libraries : libdrm_tegra,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to Tegra kernel DRM services',
> +)
> +
> +test(
> +  'tegra-symbol-check',
> +  prog_bash,
> +  args : [files('tegra-symbol-check'), libdrm_tegra]
> +)
> diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
> new file mode 100644
> index 0000000..5a07ce2
> --- /dev/null
> +++ b/tests/amdgpu/meson.build
> @@ -0,0 +1,40 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_amdgpu_test = files(
> +  'amdgpu_test.c',
> +  'basic_tests.c',
> +  'bo_tests.c',
> +  'cs_tests.c',
> +  'vce_tests.c',
> +  'uvd_enc_tests.c',
> +  'vcn_tests.c',
> +  'deadlock_tests.c',
> +  'vm_tests.c',
> +)
> +
> +amdgpu_test = executable(
> +  'amdgpu_test',
> +  files_amdgpu_test,
> +  dependencies : [dep_cunit, dep_threads],
> +  include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')],

Not a fan of going back up the tree, but... meh

> +  link_with : [libdrm, libdrm_amdgpu],
> +  install : with_install_tests,
> +)
> diff --git a/tests/etnaviv/meson.build b/tests/etnaviv/meson.build
> new file mode 100644
> index 0000000..32c5cee
> --- /dev/null
> +++ b/tests/etnaviv/meson.build
> @@ -0,0 +1,54 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +inc_etnaviv_tests = [inc_root, inc_drm, include_directories('../../etnaviv')]
> +
> +etnaviv_2d_test_files = files(
> +  'cmdstream.xml.h',
> +  'etnaviv_2d_test.c',
> +  'state.xml.h',
> +  'state_2d.xml.h',
> +  'write_bmp.c',
> +  'write_bmp.h',
> +)
> +
> +etnaviv_2d_test = executable(
> +  'etnaviv_2d_test',
> +  etnaviv_2d_test_files,
> +  include_directories : inc_etnaviv_tests,
> +  link_with : [libdrm, libdrm_etnaviv],
> +  install : with_install_tests,
> +)
> +
> +etnaviv_cmd_stream_test = executable(
> +  'etnaviv_cmd_stream_test',
> +  files('etnaviv_cmd_stream_test.c'),
> +  include_directories : inc_etnaviv_tests,
> +  link_with : [libdrm, libdrm_etnaviv],
> +  install : with_install_tests,
> +)
> +
> +etnaviv_bo_cache_test = executable(
> +  'etnaviv_bo_cache_test',
> +  files('etnaviv_bo_cache_test.c'),
> +  include_directories : inc_etnaviv_tests,
> +  link_with : [libdrm, libdrm_etnaviv],
> +  install : with_install_tests,
> +)
> diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
> new file mode 100644
> index 0000000..940c3ce
> --- /dev/null
> +++ b/tests/exynos/meson.build
> @@ -0,0 +1,54 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +inc_exynos = include_directories('../../exynos')
> +
> +if with_libkms
> +  exynos_fimg2d_test = executable(
> +    'exynos_fimg2d_test',
> +    files('exynos_fimg2d_test.c'),
> +    c_args : warn_c_args,
> +    include_directories : [inc_root, inc_drm, inc_exynos,
> +                           include_directories('../../libkms')],
> +    link_with : [libdrm, libkms, libdrm_exynos],
> +    dependencies : dep_threads,
> +    install : with_install_tests,
> +  )
> +endif
> +
> +exynos_fimg2d_perf = executable(
> +  'exynos_fimg2d_perf',
> +  files('exynos_fimg2d_perf.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm, inc_exynos],
> +  link_with : [libdrm, libdrm_exynos],
> +  dependencies : dep_threads,
> +  install : with_install_tests,
> +)
> +
> +exynos_fimg2d_event = executable(
> +  'exynos_fimg2d_event',
> +  files('exynos_fimg2d_event.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm, inc_exynos],
> +  link_with : [libdrm, libdrm_exynos],
> +  dependencies : dep_threads,
> +  install : with_install_tests,
> +)
> diff --git a/tests/kms/meson.build b/tests/kms/meson.build
> new file mode 100644
> index 0000000..e991913
> --- /dev/null
> +++ b/tests/kms/meson.build
> @@ -0,0 +1,54 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libkms_test_files = files(
> +	'libkms-test.h',
> +	'libkms-test-crtc.c',
> +	'libkms-test-device.c',
> +	'libkms-test-framebuffer.c',
> +	'libkms-test-plane.c',
> +	'libkms-test-screen.c',
> +)
> +
> +libkms_test = static_library(
> +  'kms-test',
> +  libkms_test_files,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +kms_steal_crtc = executable(
> +  'kms-steal-crtc',
> +  files('kms-steal-crtc.c'),
> +  dependencies : dep_cairo,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : [libkms_test, libutil],
> +  install : with_install_tests,
> +)
> +
> +kms_universal_planes = executable(
> +  'kms-universal-lanes',
> +  files('kms-universal-planes.c'),
> +  dependencies : dep_cairo,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : [libkms_test],
> +  install : with_install_tests,
> +)
> diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
> new file mode 100644
> index 0000000..f713f26
> --- /dev/null
> +++ b/tests/kmstest/meson.build
> @@ -0,0 +1,28 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +kmstest = executable(
> +  'kmstest',
> +  files('main.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_tests, include_directories('../../libkms'), inc_drm],
> +  link_with : [libutil, libkms, libdrm],
> +  install : with_install_tests,
> +)
> diff --git a/tests/meson.build b/tests/meson.build
> new file mode 100644
> index 0000000..960ff7b
> --- /dev/null
> +++ b/tests/meson.build
> @@ -0,0 +1,85 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +inc_tests = include_directories('.')
> +
> +subdir('util')
> +subdir('kms')
> +subdir('modeprint')
> +subdir('proptest')
> +subdir('vbltest')
> +if with_libkms
> +  subdir('kmstest')
> +endif
> +if with_radeon
> +  subdir('radeon')
> +endif
> +if with_amdgpu and dep_cunit.found()

I feel like the dep_cunit.found() condition belongs inside
tests/amdgpu/meson.build, around the relevant test.

> +  subdir('amdgpu')
> +endif
> +if with_exynos
> +  subdir('exynos')
> +endif
> +if with_tegra
> +  subdir('tegra')
> +endif
> +if with_etnaviv
> +  subdir('etnaviv')
> +endif
> +if with_nouveau
> +  subdir('nouveau')
> +endif
> +
> +drmsl = executable(
> +  'drmsl',
> +  files('drmsl.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +hash = executable(
> +  'hash',
> +  files('hash.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +random = executable(
> +  'random',
> +  files('random.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +drmdevice = executable(
> +  'drmdevice',
> +  files('drmdevice.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +test('random', random, timeout : 240)
> +test('hash', hash)
> +test('drmsl', drmsl)
> +test('drmdevice', drmdevice)
> diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
> new file mode 100644
> index 0000000..5f0eb24
> --- /dev/null
> +++ b/tests/modeprint/meson.build
> @@ -0,0 +1,29 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +modeprint = executable(
> +  'modeprint',
> +  files('modeprint.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : libdrm,
> +  dependencies : dep_threads,
> +  install : with_install_tests,
> +)
> diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
> new file mode 100644
> index 0000000..f5d73c1
> --- /dev/null
> +++ b/tests/nouveau/meson.build
> @@ -0,0 +1,30 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +threaded = executable(
> +  'threaded',
> +  files('threaded.c'),
> +  dependencies : [dep_dl, dep_threads],
> +  include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
> +  link_with : [libdrm, libdrm_nouveau],
> +  c_args : warn_c_args,
> +)
> +
> +test('threaded', threaded)
> diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
> new file mode 100644
> index 0000000..dcd724f
> --- /dev/null
> +++ b/tests/proptest/meson.build
> @@ -0,0 +1,30 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +proptest_files = files('proptest.c')
> +
> +proptest = executable(
> +  'proptest',
> +  files('proptest.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : [libdrm, libutil],
> +  install : with_install_tests,
> +)
> diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
> new file mode 100644
> index 0000000..54db231
> --- /dev/null
> +++ b/tests/radeon/meson.build
> @@ -0,0 +1,27 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +radeon_ttm = executable(
> +  'radeon_ttm',
> +  files('rbo.c', 'rbo.h', 'radeon_ttm.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
> new file mode 100644
> index 0000000..9c74ac4
> --- /dev/null
> +++ b/tests/tegra/meson.build
> @@ -0,0 +1,27 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +openclose = executable(
> +  'openclose',
> +  files('openclose.c'),
> +  include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
> +  c_args : warn_c_args,
> +  link_with : [libdrm, libdrm_tegra],
> +)
> diff --git a/tests/util/meson.build b/tests/util/meson.build
> new file mode 100644
> index 0000000..a0e1d3c
> --- /dev/null
> +++ b/tests/util/meson.build
> @@ -0,0 +1,37 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +util_files = files(
> +  'common.h',
> +  'format.c',
> +  'format.h',
> +  'kms.c',
> +  'kms.h',
> +  'pattern.c',
> +  'pattern.h',
> +)
> +
> +libutil = static_library(
> +  'util',
> +  [util_files, config_file],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : dep_cairo
> +)
> diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
> new file mode 100644
> index 0000000..4fb1ad3
> --- /dev/null
> +++ b/tests/vbltest/meson.build
> @@ -0,0 +1,28 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +vbltest = executable(
> +  'vbltest',
> +  files('vbltest.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : [libdrm, libutil],
> +  install : with_install_tests,
> +)
> diff --git a/vc4/meson.build b/vc4/meson.build
> new file mode 100644
> index 0000000..0136987
> --- /dev/null
> +++ b/vc4/meson.build
> @@ -0,0 +1,28 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm')
> +
> +pkg.generate(
> +  name : 'libdrm_vc4',
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to vc4 kernel DRM services',
> +)
> -- 
> git-series 0.9.1

I think everything else looks good; thanks for the effort!
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/3] Add meson build system
  2018-01-05 13:34   ` Eric Engestrom
@ 2018-01-05 13:41     ` Eric Engestrom
  2018-01-05 19:52     ` Dylan Baker
  1 sibling, 0 replies; 29+ messages in thread
From: Eric Engestrom @ 2018-01-05 13:41 UTC (permalink / raw)
  To: Dylan Baker; +Cc: mesa-dev, dri-devel

Gah, I missed v4, the double-list thing made it land in the other folder
than v3...

If you tell me you had already fixed all those, I'll read v4 to actually
r-b it, otherwise I'll wait for v5 :)


On Friday, 2018-01-05 13:34:53 +0000, Eric Engestrom wrote:
> On Wednesday, 2018-01-03 13:31:28 -0800, Dylan Baker wrote:
> > This patch adds a complete meson build system, including tests and
> > install. It has the necessary hooks to allow it be used as a subproject
> > for other meson based builds such as mesa.
> > 
> > Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
> > ---
> >  .editorconfig               |   4 +-
> >  amdgpu/.editorconfig        |   5 +-
> >  amdgpu/meson.build          |  70 +++++++-
> >  data/meson.build            |  27 +++-
> >  etnaviv/meson.build         |  64 ++++++-
> >  exynos/meson.build          |  53 +++++-
> >  freedreno/meson.build       |  82 ++++++++-
> >  intel/meson.build           | 111 +++++++++++-
> >  libkms/meson.build          |  75 +++++++-
> >  man/meson.build             |  66 ++++++-
> >  meson.build                 | 378 +++++++++++++++++++++++++++++++++++++-
> >  meson_options.txt           |  38 ++++-
> >  nouveau/meson.build         |  65 ++++++-
> >  omap/meson.build            |  53 +++++-
> >  radeon/meson.build          |  65 ++++++-
> >  tegra/meson.build           |  52 +++++-
> >  tests/amdgpu/meson.build    |  40 ++++-
> >  tests/etnaviv/meson.build   |  54 +++++-
> >  tests/exynos/meson.build    |  54 +++++-
> >  tests/kms/meson.build       |  54 +++++-
> >  tests/kmstest/meson.build   |  28 +++-
> >  tests/meson.build           |  85 ++++++++-
> >  tests/modeprint/meson.build |  29 +++-
> >  tests/nouveau/meson.build   |  30 +++-
> >  tests/proptest/meson.build  |  30 +++-
> >  tests/radeon/meson.build    |  27 +++-
> >  tests/tegra/meson.build     |  27 +++-
> >  tests/util/meson.build      |  37 ++++-
> >  tests/vbltest/meson.build   |  28 +++-
> >  vc4/meson.build             |  28 +++-
> >  30 files changed, 1759 insertions(+)
> >  create mode 100644 amdgpu/meson.build
> >  create mode 100644 data/meson.build
> >  create mode 100644 etnaviv/meson.build
> >  create mode 100644 exynos/meson.build
> >  create mode 100644 freedreno/meson.build
> >  create mode 100644 intel/meson.build
> >  create mode 100644 libkms/meson.build
> >  create mode 100644 man/meson.build
> >  create mode 100644 meson.build
> >  create mode 100644 meson_options.txt
> >  create mode 100644 nouveau/meson.build
> >  create mode 100644 omap/meson.build
> >  create mode 100644 radeon/meson.build
> >  create mode 100644 tegra/meson.build
> >  create mode 100644 tests/amdgpu/meson.build
> >  create mode 100644 tests/etnaviv/meson.build
> >  create mode 100644 tests/exynos/meson.build
> >  create mode 100644 tests/kms/meson.build
> >  create mode 100644 tests/kmstest/meson.build
> >  create mode 100644 tests/meson.build
> >  create mode 100644 tests/modeprint/meson.build
> >  create mode 100644 tests/nouveau/meson.build
> >  create mode 100644 tests/proptest/meson.build
> >  create mode 100644 tests/radeon/meson.build
> >  create mode 100644 tests/tegra/meson.build
> >  create mode 100644 tests/util/meson.build
> >  create mode 100644 tests/vbltest/meson.build
> >  create mode 100644 vc4/meson.build
> > 
> > diff --git a/.editorconfig b/.editorconfig
> > index 893b7be..bbad3e6 100644
> > --- a/.editorconfig
> > +++ b/.editorconfig
> > @@ -17,3 +17,7 @@ indent_style = tab
> >  [*.m4]
> >  indent_style = space
> >  indent_size = 2
> > +
> > +[meson.build,meson_options.txt]
> 
> I think this needs to be
>   [{meson.build,meson_options.txt}]
> 
> > +indent_style = space
> > +indent_size = 2
> > diff --git a/amdgpu/.editorconfig b/amdgpu/.editorconfig
> > index 2528d67..0c758d6 100644
> > --- a/amdgpu/.editorconfig
> > +++ b/amdgpu/.editorconfig
> > @@ -7,3 +7,8 @@ indent_style = tab
> >  indent_size = 8
> >  tab_width = 8
> >  insert_final_newline = true
> > +
> > +[meson.build]
> > +indent_style = space
> > +indent_size = 2
> 
> These two should be inherited from the .editorconfig one level above
> 
> > +insert_final_newline = false
> 
> That's weird; why?
> 
> > diff --git a/amdgpu/meson.build b/amdgpu/meson.build
> > new file mode 100644
> > index 0000000..13bf88b
> > --- /dev/null
> > +++ b/amdgpu/meson.build
> > @@ -0,0 +1,70 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_amdgpu = files(
> > +  'amdgpu_asic_id.c',
> > +  'amdgpu_bo.c',
> > +  'amdgpu_cs.c',
> > +  'amdgpu_device.c',
> > +  'amdgpu_gpu_info.c',
> > +  'amdgpu_internal.h',
> > +  'amdgpu_vamgr.c',
> > +  'amdgpu_vm.c',
> > +  'util_hash.c',
> > +  'util_hash.h',
> > +  'util_hash_table.c',
> > +  'util_hash_table.h',
> 
> Should we clean up the list in libdrm (even though it's not in mesa),
> and only have files that need to be in these lists?
> Ie. remove all files that are included by other files in the list, such
> as all the headers in this list?
> 
> > +)
> > +
> > +libdrm_amdgpu = shared_library(
> > +  'drm_amdgpu',
> > +  [files_amdgpu, config_file],
> > +  c_args : [
> > +    warn_c_args,
> > +    '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(get_option('datadir'), 'amdgpu.ids')),
> 
> This raises the question: do we want to support android?
> Also, isn't there a /libdrm/ missing here?
> 
> > +  ],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> 
> Nit: unnecessary brackets
> 
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +install_headers('amdgpu.h', subdir : 'libdrm')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_amdgpu',
> > +  libraries : libdrm_amdgpu,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to kernel DRM services for amdgpu',
> > +)
> > +
> > +ext_libdrm_amdgpu = declare_dependency(
> > +  link_with : [libdrm, libdrm_amdgpu],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +test(
> > +  'amdgpu-symbol-check',
> > +  prog_bash,
> > +  args : [files('amdgpu-symbol-check'), libdrm_amdgpu]
> > +)
> > diff --git a/data/meson.build b/data/meson.build
> > new file mode 100644
> > index 0000000..4990ca5
> > --- /dev/null
> > +++ b/data/meson.build
> > @@ -0,0 +1,27 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +if with_amdgpu
> > +  install_data(
> > +    'amdgpu.ids',
> > +    install_mode : 'r--r--r--',
> > +    install_dir : join_paths(get_option('datadir'), 'libdrm'),
> 
> How about setting a variable in amdgpu/meson.build?
> 
> > +  )
> > +endif
> > diff --git a/etnaviv/meson.build b/etnaviv/meson.build
> > new file mode 100644
> > index 0000000..8f39775
> > --- /dev/null
> > +++ b/etnaviv/meson.build
> > @@ -0,0 +1,64 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_etnaviv = files(
> > +  'etnaviv_device.c',
> > +  'etnaviv_gpu.c',
> > +  'etnaviv_bo.c',
> > +  'etnaviv_bo_cache.c',
> > +  'etnaviv_perfmon.c',
> > +  'etnaviv_pipe.c',
> > +  'etnaviv_cmd_stream.c',
> > +  'etnaviv_drm.h',
> > +  'etnaviv_priv.h',
> > +)
> > +
> > +libdrm_etnaviv = shared_library(
> > +  'drm_etnaviv',
> > +  [files_etnaviv, config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +  dependencies : [dep_pthread_stubs, dep_rt],
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +install_headers('etnaviv_drmif.h', subdir : 'libdrm')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_etnaviv',
> > +  libraries : libdrm_etnaviv,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to Tegra kernel DRM services',
> > +)
> > +
> > +ext_libdrm_etnaviv = declare_dependency(
> > +  link_with : [libdrm, libdrm_etnaviv],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +test(
> > +  'etnaviv-symbol-check',
> > +  prog_bash,
> > +  args : [files('etnaviv-symbol-check'), libdrm_etnaviv]
> > +)
> > diff --git a/exynos/meson.build b/exynos/meson.build
> > new file mode 100644
> > index 0000000..7da74aa
> > --- /dev/null
> > +++ b/exynos/meson.build
> > @@ -0,0 +1,53 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libdrm_exynos = shared_library(
> > +  'drm_exynos',
> > +  [files('exynos_drm.c', 'exynos_fimg2d.c', 'fimg2d_reg.h'), config_file],
> 
> Why skip files_exynos? I think I prefer the consistency, even if the var
> only contains two files.
> 
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +install_headers('exynos_drmif.h', subdir : 'libdrm')
> > +install_headers('exynos_drm.h', 'exynos_fimg2d.h', subdir : 'exynos')
> > +
> > +ext_libdrm_exynos = declare_dependency(
> > +  link_with : [libdrm, libdrm_exynos],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_exynos',
> > +  libraries : libdrm_exynos,
> > +  subdirs : ['.', 'libdrm', 'exynos'],
> > +  version : '0.7',
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to exynos kernel DRM services',
> > +)
> > +
> > +test(
> > +  'exynos-symbol-check',
> > +  prog_bash,
> > +  args : [files('exynos-symbol-check'), libdrm_exynos]
> > +)
> > diff --git a/freedreno/meson.build b/freedreno/meson.build
> > new file mode 100644
> > index 0000000..47d6e44
> > --- /dev/null
> > +++ b/freedreno/meson.build
> > @@ -0,0 +1,82 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_freedreno = files(
> > +  'freedreno_device.c',
> > +  'freedreno_pipe.c',
> > +  'freedreno_priv.h',
> > +  'freedreno_ringbuffer.c',
> > +  'freedreno_bo.c',
> > +  'freedreno_bo_cache.c',
> > +  'msm/msm_bo.c',
> > +  'msm/msm_device.c',
> > +  'msm/msm_drm.h',
> > +  'msm/msm_pipe.c',
> > +  'msm/msm_priv.h',
> > +  'msm/msm_ringbuffer.c',
> > +)
> > +
> > +if with_freedreno_kgsl != 'false'
> 
> (mentioned by someone already)
> 
> > +  files_freedreno += files(
> > +    'kgsl/kgsl_bo.c',
> > +    'kgsl/kgsl_device.c',
> > +    'kgsl/kgsl_drm.h',
> > +    'kgsl/kgsl_pipe.c',
> > +    'kgsl/kgsl_priv.h',
> > +    'kgsl/kgsl_ringbuffer.c',
> > +    'kgsl/msm_kgsl.h',
> > +  )
> > +endif
> > +
> > +libdrm_freedreno = shared_library(
> > +  'drm_freedreno',
> > +  [files_freedreno, config_file],
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm],
> > +  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
> > +  link_with : libdrm,
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_freedreno = declare_dependency(
> > +  link_with : [libdrm, libdrm_freedreno],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers(
> > +  'freedreno_drmif.h', 'freedreno_ringbuffer.h',
> > +  subdir : 'freedreno'
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_freedreno',
> > +  libraries : libdrm_freedreno,
> > +  subdirs : ['.', 'libdrm', 'freedreno'],
> > +  version : '0.7',
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to freedreno kernel DRM services',
> > +)
> > +
> > +test(
> > +  'freedreno-symbol-check',
> > +  prog_bash,
> > +  args : [files('freedreno-symbol-check'), libdrm_freedreno]
> > +)
> > diff --git a/intel/meson.build b/intel/meson.build
> > new file mode 100644
> > index 0000000..18f35c0
> > --- /dev/null
> > +++ b/intel/meson.build
> > @@ -0,0 +1,111 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_intel = files(
> > +  'intel_bufmgr.c',
> > +  'intel_bufmgr_priv.h',
> > +  'intel_bufmgr_fake.c',
> > +  'intel_bufmgr_gem.c',
> > +  'intel_decode.c',
> > +  'intel_chipset.h',
> > +  'mm.c',
> > +  'mm.h',
> > +  'uthash.h',
> > +)
> > +
> > +libdrm_intel = shared_library(
> > +  'drm_intel',
> > +  [files_intel, config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
> > +  c_args : warn_c_args,
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_intel = declare_dependency(
> > +  link_with : [libdrm, libdrm_intel],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers(
> > +  'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h',
> > +  subdir : 'libdrm',
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_intel',
> > +  libraries : libdrm_intel,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires : 'libdrm',
> > +  description : 'Userspace interface to intel kernel DRM services',
> > +)
> > +
> > +test_decode = executable(
> > +  'test_decode',
> > +  files('test_decode.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : [libdrm, libdrm_intel],
> > +  c_args : warn_c_args,
> > +)
> > +
> > +test(
> > +  'gen4-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gen4-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen45-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gm45-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen5-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gen5-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen6-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gen6-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen7-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gen7-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen7-2d-copy.batch',
> > +  prog_bash,
> > +  args : files('tests/gen7-2d-copy.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'intel-symbol-check',
> > +  prog_bash,
> > +  args : [files('intel-symbol-check'), libdrm_intel]
> > +)
> > diff --git a/libkms/meson.build b/libkms/meson.build
> > new file mode 100644
> > index 0000000..80afc89
> > --- /dev/null
> > +++ b/libkms/meson.build
> > @@ -0,0 +1,75 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libkms_include = [inc_root, inc_drm]
> > +files_libkms = files(
> > +  'internal.h',
> > +  'linux.c',
> > +  'dumb.c',
> > +  'api.c',
> > +)
> > +if with_vmwgfx
> > +  files_libkms += files('vmwgfx.c')
> > +endif
> > +if with_intel
> > +  files_libkms += files('intel.c')
> > +endif
> > +if with_nouveau
> > +  files_libkms += files('nouveau.c')
> > +endif
> > +if with_radeon
> > +  files_libkms += files('radeon.c')
> > +endif
> > +if with_exynos
> > +  files_libkms += files('exynos.c')
> > +  libkms_include += include_directories('../exynos')
> > +endif
> > +
> > +libkms = shared_library(
> > +  'kms',
> > +  [files_libkms, config_file],
> > +  c_args : warn_c_args,
> > +  include_directories : libkms_include,
> > +  link_with : libdrm,
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libkms = declare_dependency(
> > +  link_with : [libdrm, libkms],
> > +  include_directories : [libkms_include],
> > +)
> > +
> > +install_headers('libkms.h', subdir : 'libkms')
> > +
> > +pkg.generate(
> > +  name : 'libkms',
> > +  libraries : libkms,
> > +  subdirs : ['libkms'],
> > +  version : '1.0.0',
> > +  requires_private : 'libdrm',
> > +  description : 'Library that abstracts away the different mm interfaces for kernel drivers',
> > +)
> > +
> > +test(
> > +  'kms-symbol-check',
> > +  prog_bash,
> > +  args : [files('kms-symbol-check'), libkms]
> > +)
> > diff --git a/man/meson.build b/man/meson.build
> > new file mode 100644
> > index 0000000..0b2efe5
> > --- /dev/null
> > +++ b/man/meson.build
> > @@ -0,0 +1,66 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +xsltproc_args = [
> > +  '--stringparam', 'man.authors.section.enabled', '0',
> > +  '--stringparam', 'man.copyright.section.enabled', '0',
> > +  '--stringparam', 'funcsynopsis.style', 'ansi',
> > +  '--stringparam', 'man.output.quietly', '1',
> > +  '--nonet', manpage_style,
> > +]
> > +
> > +xmls = [
> > +  ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'],
> > +  ['drmHandleEvent', '3'], ['drmModeGetResources', '3']
> > +]
> > +foreach x : xmls
> > +  m = x[0]
> > +  s = x[1]
> > +  custom_target(
> > +    m,
> > +    input : files('@0@.xml'.format(m)),
> > +    output : '@0@.@1@'.format(m, s),
> > +    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'],
> > +    install : true,
> > +    install_dir : join_paths(get_option('datadir'), 'man', 'man@0@'.format(s)),
> 
> get_option('mandir')
> 
> > +    build_by_default : true,
> > +  )
> > +endforeach
> > +
> > +foreach x : ['drm-mm', 'drm-gem', 'drm-ttm']
> > +  gen = custom_target(
> > +    'gen-@0@'.format(x),
> > +    input : 'drm-memory.xml',
> > +    output : '@0@.xml'.format(x),
> > +    command : [prog_sed, '-e',
> > +               's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@',
> > +               '@INPUT@'],
> > +    capture : true,
> > +  )
> > +  custom_target(
> > +    '@0@.7'.format(x),
> > +    input : gen,
> > +    output : '@0@.7'.format(x, '7'),
> > +    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'],
> > +    install : true,
> > +    install_dir : join_paths(get_option('datadir'), 'man', 'man7'),
> 
> ditto: mandir
> 
> > +    build_by_default : true,
> > +  )
> > +endforeach
> > diff --git a/meson.build b/meson.build
> > new file mode 100644
> > index 0000000..74ae222
> > --- /dev/null
> > +++ b/meson.build
> > @@ -0,0 +1,378 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +project(
> > +  'libdrm',
> > +  ['c'],
> > +  version : '2.4.89',
> > +  license : 'MIT',
> > +  default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],
> 
> gnu99, are you sure?
> 
> also, we should specify the version of meson we support here:
> +  meson_version : '>= 0.42',
> 
> > +)
> > +
> > +pkg = import('pkgconfig')
> > +
> > +with_udev = get_option('udev')
> > +with_freedreno_kgsl = get_option('freedreno-kgls')
> > +with_install_tests = get_option('install_test_programs')
> > +with_cairo_tests = get_option('cairo_tests')
> > +with_valgrind = get_option('valgrind')
> > +
> > +config = configuration_data()
> > +
> > +# TODO: openbsd is guess, the others are correct
> > +if ['freebsd', 'dragonfly', 'netbsd', 'openbsd'].contains(host_machine.system())
> 
> Let's make that *BSD until we know of a special case?
>   if host_machine.system().to_upper.endswith('BSD')
> 
> > +  dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
> > +else
> > +  dep_pthread_stubs = []
> > +endif
> > +dep_threads = dependency('threads')
> > +
> > +cc = meson.get_compiler('c')
> > +# Check for atomics
> > +if cc.compiles('''
> > +    int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
> > +    int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
> > +    ''',
> > +    name : 'Intel Atomics')
> > +  config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', true)
> 
> Will be unset in the other cases, instead of being set to 0
> 
> > +  with_atomics = true
> > +elif cc.has_header('atomic_ops.h')
> > +  config.set10('HAVE_LIB_ATOMIC_OPS', true)
> 
> Ditto.
> 
> Those can be easily fixed by setting them to false first, just before
> the if chain:
>   config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', false)
>   config.set10('HAVE_LIB_ATOMIC_OPS', false)
> 
> > +  with_atomics = true
> > +elif cc.has_function('atomic_cas_uint')
> > +  with_atomics = true
> > +else
> > +  with_atomics = false
> > +endif
> > +
> > +with_intel = false
> > +_intel = get_option('intel')
> > +if _intel != 'false'
> > +  if _intel == 'true' and not with_atomics
> > +    error('libdrm_intel requires atomics.')
> > +  endif
> > +  with_intel = _intel == 'true' or host_machine.cpu_family().startswith('x86')
> > +endif
> > +
> > +with_radoen = false
> 
> typo
> 
> > +_radeon = get_option('radeon')
> > +if _radeon != 'false'
> > +  if _radeon == 'true' and not with_atomics
> > +    error('libdrm_radeon requires atomics.')
> > +  endif
> > +  with_radeon = true
> > +endif
> > +
> > +with_amdgpu = false
> > +_amdgpu = get_option('amdgpu')
> > +if _amdgpu != 'false'
> > +  if _amdgpu == 'true' and not with_atomics
> > +    error('libdrm_amdgpu requires atomics.')
> > +  endif
> > +  with_amdgpu = true
> > +endif
> > +
> > +with_nouveau = false
> > +_nouveau = get_option('nouveau')
> > +if _nouveau != 'false'
> > +  if _nouveau == 'true' and not with_atomics
> > +    error('libdrm_nouveau requires atomics.')
> > +  endif
> > +  with_nouveau = true
> > +endif
> > +
> > +with_vmwgfx = false
> > +_vmwgfx = get_option('vmwgfx')
> > +if _vmwgfx != 'false'
> > +  with_vmwgfx = true
> > +endif
> > +
> > +with_omap = false
> > +_omap = get_option('omap')
> > +if _omap != 'false'
> > +  if _omap == 'true' and not with_atomics
> > +    error('libdrm_omap requires atomics.')
> > +  endif
> > +  with_omap = _omap == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_freedreno = false
> > +_freedreno = get_option('freedreno')
> > +if _freedreno != 'false'
> > +  if _freedreno == 'true' and not with_atomics
> > +    error('libdrm_freedreno requires atomics.')
> > +  endif
> > +  with_freedreno = _freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_tegra = false
> > +_tegra = get_option('tegra')
> > +if _tegra != 'false'
> > +  if _tegra == 'true' and not with_atomics
> > +    error('libdrm_tegra requires atomics.')
> > +  endif
> > +  with_tegra = _tegra == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_etnaviv = false
> > +_etnaviv = get_option('etnaviv')
> > +if _etnaviv != 'false'
> > +  if _etnaviv == 'true' and not with_atomics
> > +    error('libdrm_etnaviv requires atomics.')
> > +  endif
> > +  with_etnaviv = _etnaviv == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_exynos = false
> > +_exynos = get_option('exynos')
> > +if _exynos != 'false'
> > +  with_exynos = _exynos == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_vc4 = false
> > +_vc4 = get_option('vc4')
> > +if _vc4 != 'false'
> > +  with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +# XXX: Aparently only freebsd and dragonfly bsd actually need this (and
> > +# gnu/kfreebsd), not openbsd and netbsd
> > +with_libkms = false
> > +_libkms = get_option('libkms')
> > +if _libkms != 'false'
> > +  with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
> > +endif
> > +
> > +if with_udev
> > +  dep_udev = dependency('udev')
> > +  config.set10('UDEV', true)
> > +else
> > +  dep_udev = []
> > +endif
> > +
> > +# Among others FreeBSD does not have a separate dl library.
> > +if not cc.has_function('dlsym')
> > +  dep_dl = cc.find_library('dl', required : with_nouveau)
> > +else
> > +  dep_dl = []
> > +endif
> > +# clock_gettime might require -rt, or it might not. find out
> > +if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
> > +  # XXX: untested
> > +  dep_rt = cc.find_library('rt')
> > +else
> > +  dep_rt = []
> > +endif
> > +dep_m = cc.find_library('m', required : false)
> > +if cc.has_header('sys/sysctl.h')
> > +  config.set10('HAVE_SYS_SYSCTL_H', true)
> > +endif
> > +if cc.has_header('sys/select.h')
> > +  config.set10('HAVE_SYS_SELECT_H', true)
> > +endif
> > +if cc.has_header_symbol('sys/sysmacros.h', 'major')
> > +  config.set10('MAJOR_IN_SYSMACROS', true)
> > +elif cc.has_header_symbol('sys/mkdev.h', 'major')
> > +  config.set10('MAJOR_IN_MKDEV', true)
> > +endif
> > +if cc.has_function('open_memstream')
> > +  config.set10('HAVE_OPEN_MEMSTREAM', true)
> > +endif
> > +
> > +warn_c_args = []
> > +foreach a : ['-Wall', '-Wextra', '-Wsign-compare', 
> > +             '-Werror-implicit-function-declaration', '-Wpointer-arith',
> > +             '-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes',
> > +             '-Wmissing-declarations', '-Wnested-externs', '-Wpacked',
> > +             '-Wswitch-enum', '-Wmissing-format-attribute', 
> > +             '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', 
> > +             '-Wdeclaration-after-statement', '-Wold-style-definition']
> > +  if cc.has_argument(a)
> > +    warn_c_args += a
> > +  endif
> > +endforeach
> > +# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list
> > +# of options
> > +foreach a : ['unused-parameter', 'attributes', 'long-long', 
> > +             'missing-field-initializers']
> > +  if cc.has_argument('-W@0@'.format(a))
> > +    warn_c_args += '-Wno-@0@'.format(a)
> > +  endif
> > +endforeach
> > +
> > +
> > +dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
> > +dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
> > +dep_cairo = dependency('cairo', required : with_cairo_tests == 'true')
> > +dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
> > +
> > +with_man_pages = get_option('man_pages')
> > +prog_xslt = find_program('xsltproc', required : with_man_pages == 'true')
> > +prog_sed = find_program('sed', required : with_man_pages == 'true')
> > +manpage_style = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
> > +if prog_xslt.found()
> > +  if run_command(prog_xslt, '--nonet', manpage_style).returncode() != 0
> > +    if with_man_pages == 'true'
> > +      error('Manpage style sheet cannot be found')
> > +    endif
> > +    with_man_pages = 'false'
> > +  endif
> > +endif
> > +with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
> > +
> > +# Used for tets
> > +prog_bash = find_program('bash')
> > +
> > +if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
> > +               name : 'compiler supports __attribute__(("hidden"))')
> > +  config.set10('HAVE_VISIBILITY', true)
> > +endif
> > +
> > +foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'],
> > +             [with_nouveau, 'NOUVEAU'], [with_omap, 'OMAP'],
> > +             [with_exynos, 'EXYNOS'], [with_freedreno, 'FREEDRENO'],
> > +             [with_tegra, 'TEGRA'], [with_vc4, 'VC4'],
> > +             [with_etnaviv, 'ETNAVIV'], [with_install_tests, 'INSTALL_TESTS']]
> 
> HAVE_INSTALL_TESTS is not used in C files, you can remove it from this list :)
> 
> > +  e = t[0]
> > +  if e
> 
> Why the temp var?
> 
> > +    config.set10('HAVE_@0@'.format(t[1]), true)
> 
> I'll add -Wundef when I have some time and go through those so we can have
>   config.set10('HAVE_@0@'.format(t[1]), t[0])
> 
> Then we can eventually switch to -Werror=undef :D
> 
> > +  endif
> > +endforeach
> > +if with_freedreno_kgsl
> > +  if not with_freedreno
> > +    error('cannot enable freedreno-kgsl without freedreno support')
> > +  endif
> > +  config.set10('HAVE_FREEDRENO_KGSL', true)
> > +endif
> 
> > +if with_amdgpu
> > +  config.set10('HAVE_AMDGPU', true)
> > +  if dep_cunit.found()
> > +    config.set10('HAVE_CUNIT', true)
> > +  endif
> > +endif
> 
> These two are actually unused, and should be removed from configure.ac :)
> 
> > +if dep_cairo.found()
> > +  config.set10('HAVE_CAIRO', true)
> > +endif
> > +if dep_valgrind.found()
> > +  config.set10('HAVE_VALGRIND', true)
> > +endif
> > +
> > +config.set10('_GNU_SOURCE', true)
> > +config_file = configure_file(
> > +  configuration : config,
> > +  output : 'config.h',
> > +)
> > +add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
> > +
> > +inc_root = include_directories('.')
> > +inc_drm = include_directories('include/drm')
> > +
> > +files_libdrm = files(
> > +	'xf86drm.c',
> > +	'xf86drmHash.c',
> > +	'xf86drmHash.h',
> > +	'xf86drmRandom.c',
> > +	'xf86drmRandom.h',
> > +	'xf86drmSL.c',
> > +	'xf86drmMode.c',
> > +	'xf86atomic.h',
> > +	'libdrm_macros.h',
> > +	'libdrm_lists.h',
> > +	'util_double_list.h',
> > +	'util_math.h',
> > +)
> > +
> > +libdrm = shared_library(
> > +  'drm',
> > +  [files_libdrm, config_file],
> > +  c_args : warn_c_args,
> > +  dependencies : [dep_udev, dep_valgrind, dep_rt, dep_m],
> > +  include_directories : inc_drm,
> > +  version : '2.4.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm = declare_dependency(
> > +  link_with : libdrm,
> > +  include_directories : inc_drm,
> > +)
> > +
> > +install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
> > +install_headers(
> > +	'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
> > +	'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
> > +	'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
> > +	'include/drm/nouveau_drm.h', 'include/drm/qxl_drm.h',
> > +	'include/drm/r128_drm.h', 'include/drm/radeon_drm.h',
> > +	'include/drm/amdgpu_drm.h', 'include/drm/savage_drm.h',
> > +	'include/drm/sis_drm.h', 'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h',
> > +	'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h',
> 
> Do we want to only install the headers for the libs that are enabled?
> (Not sure what autotools does)
> 
> > +  subdir : 'libdrm',
> > +)
> > +if with_vmwgfx
> > +  install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm')
> > +endif
> > +
> > +pkg.generate(
> > +  name : 'libdrm',
> > +  libraries : libdrm,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  description : 'Userspace interface to kernel DRM services',
> > +)
> > + 
> > +if with_libkms
> > +  subdir('libkms')
> > +endif
> > +if with_intel
> > +  subdir('intel')
> > +endif
> > +if with_nouveau
> > +  subdir('nouveau')
> > +endif
> > +if with_radeon
> > +  subdir('radeon')
> > +endif
> > +if with_amdgpu
> > +  subdir('amdgpu')
> > +endif
> > +if with_omap
> > +  subdir('omap')
> > +endif
> > +if with_exynos
> > +  subdir('exynos')
> > +endif
> > +if with_freedreno
> > +  subdir('freedreno')
> > +endif
> > +if with_tegra
> > +  subdir('tegra')
> > +endif
> > +if with_vc4
> > +  subdir('vc4')
> > +endif
> > +if with_etnaviv
> > +  subdir('etnaviv')
> > +endif
> > +if with_man_pages
> > +  subdir('man')
> > +endif
> > +subdir('data')
> > +subdir('tests')
> > diff --git a/meson_options.txt b/meson_options.txt
> > new file mode 100644
> > index 0000000..7c2fa4f
> > --- /dev/null
> > +++ b/meson_options.txt
> > @@ -0,0 +1,38 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +option('libkms',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('intel',       type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('radeon',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('amdgpu',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('nouveau',     type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('vmwgfx',      type : 'combo', value : 'true',  choices : ['true', 'false', 'auto'])
> > +option('omap',        type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> > +option('exynos',      type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> > +option('freedreno',   type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('tegra',       type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> > +option('vc4',         type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('etnaviv',     type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> > +option('cairo_tests', type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('man_pages',   type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('valgrind',    type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('freedreno-kgls',        type : 'boolean', value : false)
> > +option('install_test_programs', type : 'boolean', value : false)
> > +option('udev',                  type : 'boolean', value : false)
> 
> (as mentioned, descriptions would be good; copy/pasting the ones in
> configure.ac should be enough)
> 
> > diff --git a/nouveau/meson.build b/nouveau/meson.build
> > new file mode 100644
> > index 0000000..a50e4f7
> > --- /dev/null
> > +++ b/nouveau/meson.build
> > @@ -0,0 +1,65 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_nouveau = files(
> > +	'nouveau.c',
> > +	'pushbuf.c',
> > +	'bufctx.c',
> > +	'abi16.c',
> > +	'private.h',
> > +)
> > +
> > +libdrm_nouveau = shared_library(
> > +  'drm_nouveau',
> > +  [files_nouveau, config_file],
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : dep_threads,
> > +  version : '2.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_nouveau = declare_dependency(
> > +  link_with : [libdrm, libdrm_nouveau],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers('nouveau.h', subdir : 'libdrm/nouveau')
> > +install_headers(
> > +  'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h',
> > +  'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h',
> > +  subdir : 'libdrm/nouveau/nvif'
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_nouveau',
> > +  libraries : libdrm_nouveau,
> > +  subdirs : ['.', 'nouveau'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to nouveau kernel DRM services',
> > +)
> > +
> > +test(
> > +  'nouveau-symbol-check',
> > +  prog_bash,
> > +  args : [files('nouveau-symbol-check'), libdrm_nouveau]
> > +)
> > diff --git a/omap/meson.build b/omap/meson.build
> > new file mode 100644
> > index 0000000..1881087
> > --- /dev/null
> > +++ b/omap/meson.build
> > @@ -0,0 +1,53 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libdrm_omap = shared_library(
> > +  'drm_omap',
> > +  [files('omap_drm.c'), config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  c_args : warn_c_args,
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_omap = declare_dependency(
> > +  link_with : [libdrm, libdrm_omap],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers('omap_drmif.h', subdir : 'libdrm')
> > +install_headers('omap_drm.h', subdir : 'omap')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_omap',
> > +  libraries : libdrm_omap,
> > +  subdirs : ['.', 'libdrm', 'omap'],
> > +  version : '0.6',
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to omap kernel DRM services',
> > +)
> > +
> > +test(
> > +  'omap-symbol-check',
> > +  prog_bash,
> > +  args : [files('omap-symbol-check'), libdrm_omap]
> > +)
> > diff --git a/radeon/meson.build b/radeon/meson.build
> > new file mode 100644
> > index 0000000..f41c5c4
> > --- /dev/null
> > +++ b/radeon/meson.build
> > @@ -0,0 +1,65 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_radeon = files(
> > +	'radeon_bo_gem.c',
> > +	'radeon_cs_gem.c',
> > +	'radeon_cs_space.c',
> > +	'radeon_bo.c',
> > +	'radeon_cs.c',
> > +	'radeon_surface.c',
> > +)
> > +
> > +libdrm_radeon = shared_library(
> > +  'drm_radeon',
> > +  [files_radeon, config_file],
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> > +  version : '1.0.1',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_radeon = declare_dependency(
> > +  link_with : [libdrm, libdrm_radeon],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers(
> > +	'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h',
> > +	'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h',
> > +  subdir : 'libdrm'
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_radeon',
> > +  libraries : libdrm_radeon,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to kernel DRM services for radeon',
> > +)
> > +
> > +test(
> > +  'radeon-symbol-check',
> > +  prog_bash,
> > +  args : [files('radeon-symbol-check'), libdrm_radeon]
> > +)
> > diff --git a/tegra/meson.build b/tegra/meson.build
> > new file mode 100644
> > index 0000000..568531c
> > --- /dev/null
> > +++ b/tegra/meson.build
> > @@ -0,0 +1,52 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libdrm_tegra = shared_library(
> > +  'drm_tegra',
> > +  [files('private.h', 'tegra.c'), config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> > +  c_args : warn_c_args,
> > +  version : '0.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_tegra = declare_dependency(
> > +  link_with : [libdrm, libdrm_tegra],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers('tegra.h', subdir : 'libdrm')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_tegra',
> > +  libraries : libdrm_tegra,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to Tegra kernel DRM services',
> > +)
> > +
> > +test(
> > +  'tegra-symbol-check',
> > +  prog_bash,
> > +  args : [files('tegra-symbol-check'), libdrm_tegra]
> > +)
> > diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
> > new file mode 100644
> > index 0000000..5a07ce2
> > --- /dev/null
> > +++ b/tests/amdgpu/meson.build
> > @@ -0,0 +1,40 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_amdgpu_test = files(
> > +  'amdgpu_test.c',
> > +  'basic_tests.c',
> > +  'bo_tests.c',
> > +  'cs_tests.c',
> > +  'vce_tests.c',
> > +  'uvd_enc_tests.c',
> > +  'vcn_tests.c',
> > +  'deadlock_tests.c',
> > +  'vm_tests.c',
> > +)
> > +
> > +amdgpu_test = executable(
> > +  'amdgpu_test',
> > +  files_amdgpu_test,
> > +  dependencies : [dep_cunit, dep_threads],
> > +  include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')],
> 
> Not a fan of going back up the tree, but... meh
> 
> > +  link_with : [libdrm, libdrm_amdgpu],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/etnaviv/meson.build b/tests/etnaviv/meson.build
> > new file mode 100644
> > index 0000000..32c5cee
> > --- /dev/null
> > +++ b/tests/etnaviv/meson.build
> > @@ -0,0 +1,54 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +inc_etnaviv_tests = [inc_root, inc_drm, include_directories('../../etnaviv')]
> > +
> > +etnaviv_2d_test_files = files(
> > +  'cmdstream.xml.h',
> > +  'etnaviv_2d_test.c',
> > +  'state.xml.h',
> > +  'state_2d.xml.h',
> > +  'write_bmp.c',
> > +  'write_bmp.h',
> > +)
> > +
> > +etnaviv_2d_test = executable(
> > +  'etnaviv_2d_test',
> > +  etnaviv_2d_test_files,
> > +  include_directories : inc_etnaviv_tests,
> > +  link_with : [libdrm, libdrm_etnaviv],
> > +  install : with_install_tests,
> > +)
> > +
> > +etnaviv_cmd_stream_test = executable(
> > +  'etnaviv_cmd_stream_test',
> > +  files('etnaviv_cmd_stream_test.c'),
> > +  include_directories : inc_etnaviv_tests,
> > +  link_with : [libdrm, libdrm_etnaviv],
> > +  install : with_install_tests,
> > +)
> > +
> > +etnaviv_bo_cache_test = executable(
> > +  'etnaviv_bo_cache_test',
> > +  files('etnaviv_bo_cache_test.c'),
> > +  include_directories : inc_etnaviv_tests,
> > +  link_with : [libdrm, libdrm_etnaviv],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
> > new file mode 100644
> > index 0000000..940c3ce
> > --- /dev/null
> > +++ b/tests/exynos/meson.build
> > @@ -0,0 +1,54 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +inc_exynos = include_directories('../../exynos')
> > +
> > +if with_libkms
> > +  exynos_fimg2d_test = executable(
> > +    'exynos_fimg2d_test',
> > +    files('exynos_fimg2d_test.c'),
> > +    c_args : warn_c_args,
> > +    include_directories : [inc_root, inc_drm, inc_exynos,
> > +                           include_directories('../../libkms')],
> > +    link_with : [libdrm, libkms, libdrm_exynos],
> > +    dependencies : dep_threads,
> > +    install : with_install_tests,
> > +  )
> > +endif
> > +
> > +exynos_fimg2d_perf = executable(
> > +  'exynos_fimg2d_perf',
> > +  files('exynos_fimg2d_perf.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm, inc_exynos],
> > +  link_with : [libdrm, libdrm_exynos],
> > +  dependencies : dep_threads,
> > +  install : with_install_tests,
> > +)
> > +
> > +exynos_fimg2d_event = executable(
> > +  'exynos_fimg2d_event',
> > +  files('exynos_fimg2d_event.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm, inc_exynos],
> > +  link_with : [libdrm, libdrm_exynos],
> > +  dependencies : dep_threads,
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/kms/meson.build b/tests/kms/meson.build
> > new file mode 100644
> > index 0000000..e991913
> > --- /dev/null
> > +++ b/tests/kms/meson.build
> > @@ -0,0 +1,54 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libkms_test_files = files(
> > +	'libkms-test.h',
> > +	'libkms-test-crtc.c',
> > +	'libkms-test-device.c',
> > +	'libkms-test-framebuffer.c',
> > +	'libkms-test-plane.c',
> > +	'libkms-test-screen.c',
> > +)
> > +
> > +libkms_test = static_library(
> > +  'kms-test',
> > +  libkms_test_files,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +kms_steal_crtc = executable(
> > +  'kms-steal-crtc',
> > +  files('kms-steal-crtc.c'),
> > +  dependencies : dep_cairo,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : [libkms_test, libutil],
> > +  install : with_install_tests,
> > +)
> > +
> > +kms_universal_planes = executable(
> > +  'kms-universal-lanes',
> > +  files('kms-universal-planes.c'),
> > +  dependencies : dep_cairo,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : [libkms_test],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
> > new file mode 100644
> > index 0000000..f713f26
> > --- /dev/null
> > +++ b/tests/kmstest/meson.build
> > @@ -0,0 +1,28 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +kmstest = executable(
> > +  'kmstest',
> > +  files('main.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_tests, include_directories('../../libkms'), inc_drm],
> > +  link_with : [libutil, libkms, libdrm],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/meson.build b/tests/meson.build
> > new file mode 100644
> > index 0000000..960ff7b
> > --- /dev/null
> > +++ b/tests/meson.build
> > @@ -0,0 +1,85 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +inc_tests = include_directories('.')
> > +
> > +subdir('util')
> > +subdir('kms')
> > +subdir('modeprint')
> > +subdir('proptest')
> > +subdir('vbltest')
> > +if with_libkms
> > +  subdir('kmstest')
> > +endif
> > +if with_radeon
> > +  subdir('radeon')
> > +endif
> > +if with_amdgpu and dep_cunit.found()
> 
> I feel like the dep_cunit.found() condition belongs inside
> tests/amdgpu/meson.build, around the relevant test.
> 
> > +  subdir('amdgpu')
> > +endif
> > +if with_exynos
> > +  subdir('exynos')
> > +endif
> > +if with_tegra
> > +  subdir('tegra')
> > +endif
> > +if with_etnaviv
> > +  subdir('etnaviv')
> > +endif
> > +if with_nouveau
> > +  subdir('nouveau')
> > +endif
> > +
> > +drmsl = executable(
> > +  'drmsl',
> > +  files('drmsl.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +hash = executable(
> > +  'hash',
> > +  files('hash.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +random = executable(
> > +  'random',
> > +  files('random.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +drmdevice = executable(
> > +  'drmdevice',
> > +  files('drmdevice.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +test('random', random, timeout : 240)
> > +test('hash', hash)
> > +test('drmsl', drmsl)
> > +test('drmdevice', drmdevice)
> > diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
> > new file mode 100644
> > index 0000000..5f0eb24
> > --- /dev/null
> > +++ b/tests/modeprint/meson.build
> > @@ -0,0 +1,29 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +modeprint = executable(
> > +  'modeprint',
> > +  files('modeprint.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : dep_threads,
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
> > new file mode 100644
> > index 0000000..f5d73c1
> > --- /dev/null
> > +++ b/tests/nouveau/meson.build
> > @@ -0,0 +1,30 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +threaded = executable(
> > +  'threaded',
> > +  files('threaded.c'),
> > +  dependencies : [dep_dl, dep_threads],
> > +  include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
> > +  link_with : [libdrm, libdrm_nouveau],
> > +  c_args : warn_c_args,
> > +)
> > +
> > +test('threaded', threaded)
> > diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
> > new file mode 100644
> > index 0000000..dcd724f
> > --- /dev/null
> > +++ b/tests/proptest/meson.build
> > @@ -0,0 +1,30 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +proptest_files = files('proptest.c')
> > +
> > +proptest = executable(
> > +  'proptest',
> > +  files('proptest.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : [libdrm, libutil],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
> > new file mode 100644
> > index 0000000..54db231
> > --- /dev/null
> > +++ b/tests/radeon/meson.build
> > @@ -0,0 +1,27 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +radeon_ttm = executable(
> > +  'radeon_ttm',
> > +  files('rbo.c', 'rbo.h', 'radeon_ttm.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
> > new file mode 100644
> > index 0000000..9c74ac4
> > --- /dev/null
> > +++ b/tests/tegra/meson.build
> > @@ -0,0 +1,27 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +openclose = executable(
> > +  'openclose',
> > +  files('openclose.c'),
> > +  include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
> > +  c_args : warn_c_args,
> > +  link_with : [libdrm, libdrm_tegra],
> > +)
> > diff --git a/tests/util/meson.build b/tests/util/meson.build
> > new file mode 100644
> > index 0000000..a0e1d3c
> > --- /dev/null
> > +++ b/tests/util/meson.build
> > @@ -0,0 +1,37 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +util_files = files(
> > +  'common.h',
> > +  'format.c',
> > +  'format.h',
> > +  'kms.c',
> > +  'kms.h',
> > +  'pattern.c',
> > +  'pattern.h',
> > +)
> > +
> > +libutil = static_library(
> > +  'util',
> > +  [util_files, config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : dep_cairo
> > +)
> > diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
> > new file mode 100644
> > index 0000000..4fb1ad3
> > --- /dev/null
> > +++ b/tests/vbltest/meson.build
> > @@ -0,0 +1,28 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +vbltest = executable(
> > +  'vbltest',
> > +  files('vbltest.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : [libdrm, libutil],
> > +  install : with_install_tests,
> > +)
> > diff --git a/vc4/meson.build b/vc4/meson.build
> > new file mode 100644
> > index 0000000..0136987
> > --- /dev/null
> > +++ b/vc4/meson.build
> > @@ -0,0 +1,28 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_vc4',
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to vc4 kernel DRM services',
> > +)
> > -- 
> > git-series 0.9.1
> 
> I think everything else looks good; thanks for the effort!
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v4 3/3] README: Add note about meson
  2018-01-04 18:28   ` [PATCH v4 3/3] README: Add note about meson Dylan Baker
@ 2018-01-05 13:49     ` Eric Engestrom
  2018-01-05 18:51       ` Dylan Baker
  0 siblings, 1 reply; 29+ messages in thread
From: Eric Engestrom @ 2018-01-05 13:49 UTC (permalink / raw)
  To: Dylan Baker; +Cc: mesa-dev, dri-devel

On Thursday, 2018-01-04 10:28:42 -0800, Dylan Baker wrote:
> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>

Couple nitpicks, but:
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

> ---
>  README | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/README b/README
> index 26cab9d..58e55bc 100644
> --- a/README
> +++ b/README
> @@ -15,9 +15,24 @@ with an older kernel.
>  Compiling
>  ---------
>  
> -libdrm  is  a  standard  autotools  package and  follows  the  normal
> -configure, build  and install steps.   The first step is  to configure
> -the package, which is done by running the configure shell script:
> +libdrm has two build systems, a legacy autotools build system, and a newer
> +meson build system. The meson build system is much faster, and offers a 
> +slightly different interface, but otherwise provides much the same 

s/much/pretty much/ ?

> +feature set.
> +
> +To use it:
> +
> +    meson builddir

I'd suggest `builddir/` to make it more obvious it's a dir, not
a command.

> +
> +By default this will install into /usr/local, you can change your prefix
> +with --prefix=/usr (or -Dprefix=/usr to meson configure).

"(or `meson configure builddir/ -D prefix=/usr` to change it after the
initial meson setup)."

> +
> +Then use ninja to build and install:
> +
> +    ninja -C builddir install
> +
> +
> +Alternatively you can invoke autotools configure:
>  
>  	./configure
>  
> -- 
> git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v4 2/3] autotools: Include meson.build files in tarball
  2018-01-04 18:28   ` [PATCH v4 2/3] autotools: Include meson.build files in tarball Dylan Baker
@ 2018-01-05 14:02     ` Eric Engestrom
  2018-01-05 18:53       ` Dylan Baker
  0 siblings, 1 reply; 29+ messages in thread
From: Eric Engestrom @ 2018-01-05 14:02 UTC (permalink / raw)
  To: Dylan Baker; +Cc: mesa-dev, dri-devel

On Thursday, 2018-01-04 10:28:41 -0800, Dylan Baker wrote:
> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>

Do we really want to use autotools' `dist` to package libdrm once meson
has landed?
I would've though we would switch to meson and deprecate autotools right
away.

On that note, have we talked about how long we'll keep autotools around?
Since libdrm doesn't have a stable release schedule like mesa, it might
be best to count it in months. 3 months? 6 months? A year?

Once that's decided, I think something like this should also be committed
in this series:

----8<----
diff --git a/configure.ac b/configure.ac
index 35378b3384290f8e1e26..38660e13995988f65c2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -587,3 +587,9 @@ echo "  Tegra API      $TEGRA"
 echo "  VC4 API        $VC4"
 echo "  Etnaviv API    $ETNAVIV"
 echo ""
+
+echo "libdrm's autotools build is DEPRECATED"
+echo ""
+echo "Please read the instructions in the README to start using Meson"
+echo "The autotools build system will be removed on the next release after 2018-XX-XX"
+echo ""
---->8----

> ---
>  Makefile.am | 30 +++++++++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 7b86214..66f70ca 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -135,7 +135,35 @@ if HAVE_VMWGFX
>  klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
>  endif
>  
> -EXTRA_DIST = include/drm/README
> +EXTRA_DIST = \
> +	include/drm/README \
> +	amdgpu/meson.build \
> +	etnaviv/meson.build \
> +	exynos/meson.build \
> +	freedreno/meson.build \
> +	intel/meson.build \
> +	libkms/meson.build \
> +	man/meson.build \
> +	nouveau/meson.build \
> +	omap/meson.build \
> +	radeon/meson.build \
> +	tests/amdgpu/meson.build \
> +	tests/etnaviv/meson.build \
> +	tests/exynos/meson.build \
> +	tests/kms/meson.build \
> +	tests/kmstest/meson.build \
> +	tests/modeprint/meson.build \
> +	tests/nouveau/meson.build \
> +	tests/proptest/meson.build \
> +	tests/radeon/meson.build \
> +	tests/tegra/meson.build \
> +	tests/util/meson.build \
> +	tests/vbltest/meson.build \
> +	tests/meson.build \
> +	vc4/meson.build \
> +	data/meson.build \
> +	meson.build \
> +	meson_options.txt
>  
>  copy-headers :
>  	cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/
> -- 
> git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v4 3/3] README: Add note about meson
  2018-01-05 13:49     ` Eric Engestrom
@ 2018-01-05 18:51       ` Dylan Baker
  0 siblings, 0 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-05 18:51 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: mesa-dev, dri-devel


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

Quoting Eric Engestrom (2018-01-05 05:49:25)
> On Thursday, 2018-01-04 10:28:42 -0800, Dylan Baker wrote:
> > Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
> 
> Couple nitpicks, but:
> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
> 
> > ---
> >  README | 21 ++++++++++++++++++---
> >  1 file changed, 18 insertions(+), 3 deletions(-)
> > 
> > diff --git a/README b/README
> > index 26cab9d..58e55bc 100644
> > --- a/README
> > +++ b/README
> > @@ -15,9 +15,24 @@ with an older kernel.
> >  Compiling
> >  ---------
> >  
> > -libdrm  is  a  standard  autotools  package and  follows  the  normal
> > -configure, build  and install steps.   The first step is  to configure
> > -the package, which is done by running the configure shell script:
> > +libdrm has two build systems, a legacy autotools build system, and a newer
> > +meson build system. The meson build system is much faster, and offers a 
> > +slightly different interface, but otherwise provides much the same 
> 
> s/much/pretty much/ ?

It is a valid construct, but it's a bit archaic, so how about
`s/much the same/equivalent/`?

> 
> > +feature set.
> > +
> > +To use it:
> > +
> > +    meson builddir
> 
> I'd suggest `builddir/` to make it more obvious it's a dir, not
> a command.

Makes sense.

> 
> > +
> > +By default this will install into /usr/local, you can change your prefix
> > +with --prefix=/usr (or -Dprefix=/usr to meson configure).
> 
> "(or `meson configure builddir/ -D prefix=/usr` to change it after the
> initial meson setup)."

Done.

> 
> > +
> > +Then use ninja to build and install:
> > +
> > +    ninja -C builddir install
> > +
> > +
> > +Alternatively you can invoke autotools configure:
> >  
> >       ./configure
> >  
> > -- 
> > git-series 0.9.1

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlpPyRMACgkQCJ4WlhQG
iO+Lggf/edokLr8uwKZZ36Fx7dvc4F2WTPUKH6e087YQ65OzqbNbEAuhEXKV+t+E
yxgG5THma5ITXJtr/xTBn/7vuKQPqDMk0ZRcR7bvtI4xMxXFy/2dMhy0dd7gLzkD
lprZ1IxrlykvpO6mvI7v52Vj3/qKbm96mmU2f3fAEJr40/zJ5kltx/L1VJl597g9
XH5ZiL30aWVDr+v6TM55rKW3FJhytj0cpPhrHKyf/Hq6elMYxXqv4fRqFjOgohON
wVjU7FDr9kCKViRkqtAmMyLA94kDbSorTdAo+9IxAR6+fKsvZCCTas0wSOoF8Jg6
ghZ8RCEI7nzq6pW0EG1hBMAQXX7vBA==
=CsXw
-----END PGP SIGNATURE-----

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

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

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

* Re: [PATCH v4 2/3] autotools: Include meson.build files in tarball
  2018-01-05 14:02     ` Eric Engestrom
@ 2018-01-05 18:53       ` Dylan Baker
  0 siblings, 0 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-05 18:53 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: mesa-dev, dri-devel


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

Quoting Eric Engestrom (2018-01-05 06:02:52)
> On Thursday, 2018-01-04 10:28:41 -0800, Dylan Baker wrote:
> > Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
> 
> Do we really want to use autotools' `dist` to package libdrm once meson
> has landed?
> I would've though we would switch to meson and deprecate autotools right
> away.

I think we should maintain the autotools build at least for a couple of
releases. It gives distros a little bit of time to iron out any problems they
have in their automation.

> 
> On that note, have we talked about how long we'll keep autotools around?
> Since libdrm doesn't have a stable release schedule like mesa, it might
> be best to count it in months. 3 months? 6 months? A year?

I think 3 months would probably be fine, but I'm okay with whatever people
decide is appropriate.

> 
> Once that's decided, I think something like this should also be committed
> in this series:
> 
> ----8<----
> diff --git a/configure.ac b/configure.ac
> index 35378b3384290f8e1e26..38660e13995988f65c2c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -587,3 +587,9 @@ echo "  Tegra API      $TEGRA"
>  echo "  VC4 API        $VC4"
>  echo "  Etnaviv API    $ETNAVIV"
>  echo ""
> +
> +echo "libdrm's autotools build is DEPRECATED"
> +echo ""
> +echo "Please read the instructions in the README to start using Meson"
> +echo "The autotools build system will be removed on the next release after 2018-XX-XX"
> +echo ""
> ---->8----
> 
> > ---
> >  Makefile.am | 30 +++++++++++++++++++++++++++++-
> >  1 file changed, 29 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Makefile.am b/Makefile.am
> > index 7b86214..66f70ca 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -135,7 +135,35 @@ if HAVE_VMWGFX
> >  klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
> >  endif
> >  
> > -EXTRA_DIST = include/drm/README
> > +EXTRA_DIST = \
> > +     include/drm/README \
> > +     amdgpu/meson.build \
> > +     etnaviv/meson.build \
> > +     exynos/meson.build \
> > +     freedreno/meson.build \
> > +     intel/meson.build \
> > +     libkms/meson.build \
> > +     man/meson.build \
> > +     nouveau/meson.build \
> > +     omap/meson.build \
> > +     radeon/meson.build \
> > +     tests/amdgpu/meson.build \
> > +     tests/etnaviv/meson.build \
> > +     tests/exynos/meson.build \
> > +     tests/kms/meson.build \
> > +     tests/kmstest/meson.build \
> > +     tests/modeprint/meson.build \
> > +     tests/nouveau/meson.build \
> > +     tests/proptest/meson.build \
> > +     tests/radeon/meson.build \
> > +     tests/tegra/meson.build \
> > +     tests/util/meson.build \
> > +     tests/vbltest/meson.build \
> > +     tests/meson.build \
> > +     vc4/meson.build \
> > +     data/meson.build \
> > +     meson.build \
> > +     meson_options.txt
> >  
> >  copy-headers :
> >       cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/
> > -- 
> > git-series 0.9.1

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlpPyZUACgkQCJ4WlhQG
iO9tAwf9HAQ3Xr4MC/OyoQgiyz0zjDRTX5YBYcThyg01g5uJRrjhe56twrbM8Z3H
0Ac1fXqXMyip7J3xMzYmttJDDo9aDrVrDYCvSOWhbSDWAxssPx3zA3Bol8g170ch
Ee2H6wiBJjoj6CcuqFOYhOR3PoPpRQb18TgNuzDXS7UyknNuxW/Htje3kQSk9UUk
e6dE0qrJ7ifYKJq1806UTCTBw/SJjxFVoog4T+Br2lVF5Jm88u1oVSHcgUJXWauq
x2kI4qsNCdXQ6aT1to/hvat720W2mp1ht/CLw9XE9gBJ5L2LYkKy3HGosshVW8eV
pjTx+JcvBvC565RhwlAJegBq+1m+Nw==
=FMOV
-----END PGP SIGNATURE-----

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/3] Add meson build system
  2018-01-05 13:34   ` Eric Engestrom
  2018-01-05 13:41     ` Eric Engestrom
@ 2018-01-05 19:52     ` Dylan Baker
  1 sibling, 0 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-05 19:52 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: mesa-dev, dri-devel


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

Quoting Eric Engestrom (2018-01-05 05:34:53)
> On Wednesday, 2018-01-03 13:31:28 -0800, Dylan Baker wrote:
> > This patch adds a complete meson build system, including tests and
> > install. It has the necessary hooks to allow it be used as a subproject
> > for other meson based builds such as mesa.
> > 
> > Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
> > ---
> >  .editorconfig               |   4 +-
> >  amdgpu/.editorconfig        |   5 +-
> >  amdgpu/meson.build          |  70 +++++++-
> >  data/meson.build            |  27 +++-
> >  etnaviv/meson.build         |  64 ++++++-
> >  exynos/meson.build          |  53 +++++-
> >  freedreno/meson.build       |  82 ++++++++-
> >  intel/meson.build           | 111 +++++++++++-
> >  libkms/meson.build          |  75 +++++++-
> >  man/meson.build             |  66 ++++++-
> >  meson.build                 | 378 +++++++++++++++++++++++++++++++++++++-
> >  meson_options.txt           |  38 ++++-
> >  nouveau/meson.build         |  65 ++++++-
> >  omap/meson.build            |  53 +++++-
> >  radeon/meson.build          |  65 ++++++-
> >  tegra/meson.build           |  52 +++++-
> >  tests/amdgpu/meson.build    |  40 ++++-
> >  tests/etnaviv/meson.build   |  54 +++++-
> >  tests/exynos/meson.build    |  54 +++++-
> >  tests/kms/meson.build       |  54 +++++-
> >  tests/kmstest/meson.build   |  28 +++-
> >  tests/meson.build           |  85 ++++++++-
> >  tests/modeprint/meson.build |  29 +++-
> >  tests/nouveau/meson.build   |  30 +++-
> >  tests/proptest/meson.build  |  30 +++-
> >  tests/radeon/meson.build    |  27 +++-
> >  tests/tegra/meson.build     |  27 +++-
> >  tests/util/meson.build      |  37 ++++-
> >  tests/vbltest/meson.build   |  28 +++-
> >  vc4/meson.build             |  28 +++-
> >  30 files changed, 1759 insertions(+)
> >  create mode 100644 amdgpu/meson.build
> >  create mode 100644 data/meson.build
> >  create mode 100644 etnaviv/meson.build
> >  create mode 100644 exynos/meson.build
> >  create mode 100644 freedreno/meson.build
> >  create mode 100644 intel/meson.build
> >  create mode 100644 libkms/meson.build
> >  create mode 100644 man/meson.build
> >  create mode 100644 meson.build
> >  create mode 100644 meson_options.txt
> >  create mode 100644 nouveau/meson.build
> >  create mode 100644 omap/meson.build
> >  create mode 100644 radeon/meson.build
> >  create mode 100644 tegra/meson.build
> >  create mode 100644 tests/amdgpu/meson.build
> >  create mode 100644 tests/etnaviv/meson.build
> >  create mode 100644 tests/exynos/meson.build
> >  create mode 100644 tests/kms/meson.build
> >  create mode 100644 tests/kmstest/meson.build
> >  create mode 100644 tests/meson.build
> >  create mode 100644 tests/modeprint/meson.build
> >  create mode 100644 tests/nouveau/meson.build
> >  create mode 100644 tests/proptest/meson.build
> >  create mode 100644 tests/radeon/meson.build
> >  create mode 100644 tests/tegra/meson.build
> >  create mode 100644 tests/util/meson.build
> >  create mode 100644 tests/vbltest/meson.build
> >  create mode 100644 vc4/meson.build
> > 
> > diff --git a/.editorconfig b/.editorconfig
> > index 893b7be..bbad3e6 100644
> > --- a/.editorconfig
> > +++ b/.editorconfig
> > @@ -17,3 +17,7 @@ indent_style = tab
> >  [*.m4]
> >  indent_style = space
> >  indent_size = 2
> > +
> > +[meson.build,meson_options.txt]
> 
> I think this needs to be
>   [{meson.build,meson_options.txt}]

You might be right.

> 
> > +indent_style = space
> > +indent_size = 2
> > diff --git a/amdgpu/.editorconfig b/amdgpu/.editorconfig
> > index 2528d67..0c758d6 100644
> > --- a/amdgpu/.editorconfig
> > +++ b/amdgpu/.editorconfig
> > @@ -7,3 +7,8 @@ indent_style = tab
> >  indent_size = 8
> >  tab_width = 8
> >  insert_final_newline = true
> > +
> > +[meson.build]
> > +indent_style = space
> > +indent_size = 2
> 
> These two should be inherited from the .editorconfig one level above

Nope, because the group right above this is [*], which overrides everything
above it.

> 
> > +insert_final_newline = false
> 
> That's weird; why?

I'll drop it

> 
> > diff --git a/amdgpu/meson.build b/amdgpu/meson.build
> > new file mode 100644
> > index 0000000..13bf88b
> > --- /dev/null
> > +++ b/amdgpu/meson.build
> > @@ -0,0 +1,70 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_amdgpu = files(
> > +  'amdgpu_asic_id.c',
> > +  'amdgpu_bo.c',
> > +  'amdgpu_cs.c',
> > +  'amdgpu_device.c',
> > +  'amdgpu_gpu_info.c',
> > +  'amdgpu_internal.h',
> > +  'amdgpu_vamgr.c',
> > +  'amdgpu_vm.c',
> > +  'util_hash.c',
> > +  'util_hash.h',
> > +  'util_hash_table.c',
> > +  'util_hash_table.h',
> 
> Should we clean up the list in libdrm (even though it's not in mesa),
> and only have files that need to be in these lists?
> Ie. remove all files that are included by other files in the list, such
> as all the headers in this list?
> 
> > +)
> > +
> > +libdrm_amdgpu = shared_library(
> > +  'drm_amdgpu',
> > +  [files_amdgpu, config_file],
> > +  c_args : [
> > +    warn_c_args,
> > +    '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(get_option('datadir'), 'amdgpu.ids')),
> 
> This raises the question: do we want to support android?
> Also, isn't there a /libdrm/ missing here?

Android has it's own adroid.mk build system, and I don't see any special logic
in libdrm for the ARC++ stuff used by chromeOS like mesa has.

> 
> > +  ],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> 
> Nit: unnecessary brackets
> 
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +install_headers('amdgpu.h', subdir : 'libdrm')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_amdgpu',
> > +  libraries : libdrm_amdgpu,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to kernel DRM services for amdgpu',
> > +)
> > +
> > +ext_libdrm_amdgpu = declare_dependency(
> > +  link_with : [libdrm, libdrm_amdgpu],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +test(
> > +  'amdgpu-symbol-check',
> > +  prog_bash,
> > +  args : [files('amdgpu-symbol-check'), libdrm_amdgpu]
> > +)
> > diff --git a/data/meson.build b/data/meson.build
> > new file mode 100644
> > index 0000000..4990ca5
> > --- /dev/null
> > +++ b/data/meson.build
> > @@ -0,0 +1,27 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +if with_amdgpu
> > +  install_data(
> > +    'amdgpu.ids',
> > +    install_mode : 'r--r--r--',
> > +    install_dir : join_paths(get_option('datadir'), 'libdrm'),
> 
> How about setting a variable in amdgpu/meson.build?
> 
> > +  )
> > +endif
> > diff --git a/etnaviv/meson.build b/etnaviv/meson.build
> > new file mode 100644
> > index 0000000..8f39775
> > --- /dev/null
> > +++ b/etnaviv/meson.build
> > @@ -0,0 +1,64 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_etnaviv = files(
> > +  'etnaviv_device.c',
> > +  'etnaviv_gpu.c',
> > +  'etnaviv_bo.c',
> > +  'etnaviv_bo_cache.c',
> > +  'etnaviv_perfmon.c',
> > +  'etnaviv_pipe.c',
> > +  'etnaviv_cmd_stream.c',
> > +  'etnaviv_drm.h',
> > +  'etnaviv_priv.h',
> > +)
> > +
> > +libdrm_etnaviv = shared_library(
> > +  'drm_etnaviv',
> > +  [files_etnaviv, config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +  dependencies : [dep_pthread_stubs, dep_rt],
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +install_headers('etnaviv_drmif.h', subdir : 'libdrm')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_etnaviv',
> > +  libraries : libdrm_etnaviv,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to Tegra kernel DRM services',
> > +)
> > +
> > +ext_libdrm_etnaviv = declare_dependency(
> > +  link_with : [libdrm, libdrm_etnaviv],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +test(
> > +  'etnaviv-symbol-check',
> > +  prog_bash,
> > +  args : [files('etnaviv-symbol-check'), libdrm_etnaviv]
> > +)
> > diff --git a/exynos/meson.build b/exynos/meson.build
> > new file mode 100644
> > index 0000000..7da74aa
> > --- /dev/null
> > +++ b/exynos/meson.build
> > @@ -0,0 +1,53 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libdrm_exynos = shared_library(
> > +  'drm_exynos',
> > +  [files('exynos_drm.c', 'exynos_fimg2d.c', 'fimg2d_reg.h'), config_file],
> 
> Why skip files_exynos? I think I prefer the consistency, even if the var
> only contains two files.
> 
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +install_headers('exynos_drmif.h', subdir : 'libdrm')
> > +install_headers('exynos_drm.h', 'exynos_fimg2d.h', subdir : 'exynos')
> > +
> > +ext_libdrm_exynos = declare_dependency(
> > +  link_with : [libdrm, libdrm_exynos],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_exynos',
> > +  libraries : libdrm_exynos,
> > +  subdirs : ['.', 'libdrm', 'exynos'],
> > +  version : '0.7',
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to exynos kernel DRM services',
> > +)
> > +
> > +test(
> > +  'exynos-symbol-check',
> > +  prog_bash,
> > +  args : [files('exynos-symbol-check'), libdrm_exynos]
> > +)
> > diff --git a/freedreno/meson.build b/freedreno/meson.build
> > new file mode 100644
> > index 0000000..47d6e44
> > --- /dev/null
> > +++ b/freedreno/meson.build
> > @@ -0,0 +1,82 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_freedreno = files(
> > +  'freedreno_device.c',
> > +  'freedreno_pipe.c',
> > +  'freedreno_priv.h',
> > +  'freedreno_ringbuffer.c',
> > +  'freedreno_bo.c',
> > +  'freedreno_bo_cache.c',
> > +  'msm/msm_bo.c',
> > +  'msm/msm_device.c',
> > +  'msm/msm_drm.h',
> > +  'msm/msm_pipe.c',
> > +  'msm/msm_priv.h',
> > +  'msm/msm_ringbuffer.c',
> > +)
> > +
> > +if with_freedreno_kgsl != 'false'
> 
> (mentioned by someone already)
> 
> > +  files_freedreno += files(
> > +    'kgsl/kgsl_bo.c',
> > +    'kgsl/kgsl_device.c',
> > +    'kgsl/kgsl_drm.h',
> > +    'kgsl/kgsl_pipe.c',
> > +    'kgsl/kgsl_priv.h',
> > +    'kgsl/kgsl_ringbuffer.c',
> > +    'kgsl/msm_kgsl.h',
> > +  )
> > +endif
> > +
> > +libdrm_freedreno = shared_library(
> > +  'drm_freedreno',
> > +  [files_freedreno, config_file],
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm],
> > +  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
> > +  link_with : libdrm,
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_freedreno = declare_dependency(
> > +  link_with : [libdrm, libdrm_freedreno],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers(
> > +  'freedreno_drmif.h', 'freedreno_ringbuffer.h',
> > +  subdir : 'freedreno'
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_freedreno',
> > +  libraries : libdrm_freedreno,
> > +  subdirs : ['.', 'libdrm', 'freedreno'],
> > +  version : '0.7',
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to freedreno kernel DRM services',
> > +)
> > +
> > +test(
> > +  'freedreno-symbol-check',
> > +  prog_bash,
> > +  args : [files('freedreno-symbol-check'), libdrm_freedreno]
> > +)
> > diff --git a/intel/meson.build b/intel/meson.build
> > new file mode 100644
> > index 0000000..18f35c0
> > --- /dev/null
> > +++ b/intel/meson.build
> > @@ -0,0 +1,111 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_intel = files(
> > +  'intel_bufmgr.c',
> > +  'intel_bufmgr_priv.h',
> > +  'intel_bufmgr_fake.c',
> > +  'intel_bufmgr_gem.c',
> > +  'intel_decode.c',
> > +  'intel_chipset.h',
> > +  'mm.c',
> > +  'mm.h',
> > +  'uthash.h',
> > +)
> > +
> > +libdrm_intel = shared_library(
> > +  'drm_intel',
> > +  [files_intel, config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
> > +  c_args : warn_c_args,
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_intel = declare_dependency(
> > +  link_with : [libdrm, libdrm_intel],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers(
> > +  'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h',
> > +  subdir : 'libdrm',
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_intel',
> > +  libraries : libdrm_intel,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires : 'libdrm',
> > +  description : 'Userspace interface to intel kernel DRM services',
> > +)
> > +
> > +test_decode = executable(
> > +  'test_decode',
> > +  files('test_decode.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : [libdrm, libdrm_intel],
> > +  c_args : warn_c_args,
> > +)
> > +
> > +test(
> > +  'gen4-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gen4-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen45-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gm45-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen5-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gen5-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen6-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gen6-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen7-3d.batch',
> > +  prog_bash,
> > +  args : files('tests/gen7-3d.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'gen7-2d-copy.batch',
> > +  prog_bash,
> > +  args : files('tests/gen7-2d-copy.batch.sh'),
> > +  workdir : meson.current_build_dir(),
> > +)
> > +test(
> > +  'intel-symbol-check',
> > +  prog_bash,
> > +  args : [files('intel-symbol-check'), libdrm_intel]
> > +)
> > diff --git a/libkms/meson.build b/libkms/meson.build
> > new file mode 100644
> > index 0000000..80afc89
> > --- /dev/null
> > +++ b/libkms/meson.build
> > @@ -0,0 +1,75 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libkms_include = [inc_root, inc_drm]
> > +files_libkms = files(
> > +  'internal.h',
> > +  'linux.c',
> > +  'dumb.c',
> > +  'api.c',
> > +)
> > +if with_vmwgfx
> > +  files_libkms += files('vmwgfx.c')
> > +endif
> > +if with_intel
> > +  files_libkms += files('intel.c')
> > +endif
> > +if with_nouveau
> > +  files_libkms += files('nouveau.c')
> > +endif
> > +if with_radeon
> > +  files_libkms += files('radeon.c')
> > +endif
> > +if with_exynos
> > +  files_libkms += files('exynos.c')
> > +  libkms_include += include_directories('../exynos')
> > +endif
> > +
> > +libkms = shared_library(
> > +  'kms',
> > +  [files_libkms, config_file],
> > +  c_args : warn_c_args,
> > +  include_directories : libkms_include,
> > +  link_with : libdrm,
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libkms = declare_dependency(
> > +  link_with : [libdrm, libkms],
> > +  include_directories : [libkms_include],
> > +)
> > +
> > +install_headers('libkms.h', subdir : 'libkms')
> > +
> > +pkg.generate(
> > +  name : 'libkms',
> > +  libraries : libkms,
> > +  subdirs : ['libkms'],
> > +  version : '1.0.0',
> > +  requires_private : 'libdrm',
> > +  description : 'Library that abstracts away the different mm interfaces for kernel drivers',
> > +)
> > +
> > +test(
> > +  'kms-symbol-check',
> > +  prog_bash,
> > +  args : [files('kms-symbol-check'), libkms]
> > +)
> > diff --git a/man/meson.build b/man/meson.build
> > new file mode 100644
> > index 0000000..0b2efe5
> > --- /dev/null
> > +++ b/man/meson.build
> > @@ -0,0 +1,66 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +xsltproc_args = [
> > +  '--stringparam', 'man.authors.section.enabled', '0',
> > +  '--stringparam', 'man.copyright.section.enabled', '0',
> > +  '--stringparam', 'funcsynopsis.style', 'ansi',
> > +  '--stringparam', 'man.output.quietly', '1',
> > +  '--nonet', manpage_style,
> > +]
> > +
> > +xmls = [
> > +  ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'],
> > +  ['drmHandleEvent', '3'], ['drmModeGetResources', '3']
> > +]
> > +foreach x : xmls
> > +  m = x[0]
> > +  s = x[1]
> > +  custom_target(
> > +    m,
> > +    input : files('@0@.xml'.format(m)),
> > +    output : '@0@.@1@'.format(m, s),
> > +    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'],
> > +    install : true,
> > +    install_dir : join_paths(get_option('datadir'), 'man', 'man@0@'.format(s)),
> 
> get_option('mandir')
> 
> > +    build_by_default : true,
> > +  )
> > +endforeach
> > +
> > +foreach x : ['drm-mm', 'drm-gem', 'drm-ttm']
> > +  gen = custom_target(
> > +    'gen-@0@'.format(x),
> > +    input : 'drm-memory.xml',
> > +    output : '@0@.xml'.format(x),
> > +    command : [prog_sed, '-e',
> > +               's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@',
> > +               '@INPUT@'],
> > +    capture : true,
> > +  )
> > +  custom_target(
> > +    '@0@.7'.format(x),
> > +    input : gen,
> > +    output : '@0@.7'.format(x, '7'),
> > +    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'],
> > +    install : true,
> > +    install_dir : join_paths(get_option('datadir'), 'man', 'man7'),
> 
> ditto: mandir
> 
> > +    build_by_default : true,
> > +  )
> > +endforeach
> > diff --git a/meson.build b/meson.build
> > new file mode 100644
> > index 0000000..74ae222
> > --- /dev/null
> > +++ b/meson.build
> > @@ -0,0 +1,378 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +project(
> > +  'libdrm',
> > +  ['c'],
> > +  version : '2.4.89',
> > +  license : 'MIT',
> > +  default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],
> 
> gnu99, are you sure?

libdrm makes extensive use of typeof(), which is a gnu extension. I don't think
it's ever been included in a iso C standard, has it?

> 
> also, we should specify the version of meson we support here:
> +  meson_version : '>= 0.42',
> 
> > +)
> > +
> > +pkg = import('pkgconfig')
> > +
> > +with_udev = get_option('udev')
> > +with_freedreno_kgsl = get_option('freedreno-kgls')
> > +with_install_tests = get_option('install_test_programs')
> > +with_cairo_tests = get_option('cairo_tests')
> > +with_valgrind = get_option('valgrind')
> > +
> > +config = configuration_data()
> > +
> > +# TODO: openbsd is guess, the others are correct
> > +if ['freebsd', 'dragonfly', 'netbsd', 'openbsd'].contains(host_machine.system())
> 
> Let's make that *BSD until we know of a special case?
>   if host_machine.system().to_upper.endswith('BSD')

dragonflybsd has "dragonfly" as it's identifier, which doesn't end with bsd.
Also, I've tested this on all of the bsds except openbsd, so I know those work.

> 
> > +  dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
> > +else
> > +  dep_pthread_stubs = []
> > +endif
> > +dep_threads = dependency('threads')
> > +
> > +cc = meson.get_compiler('c')
> > +# Check for atomics
> > +if cc.compiles('''
> > +    int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
> > +    int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
> > +    ''',
> > +    name : 'Intel Atomics')
> > +  config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', true)
> 
> Will be unset in the other cases, instead of being set to 0
> 
> > +  with_atomics = true
> > +elif cc.has_header('atomic_ops.h')
> > +  config.set10('HAVE_LIB_ATOMIC_OPS', true)
> 
> Ditto.
> 
> Those can be easily fixed by setting them to false first, just before
> the if chain:
>   config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', false)
>   config.set10('HAVE_LIB_ATOMIC_OPS', false)
> 
> > +  with_atomics = true
> > +elif cc.has_function('atomic_cas_uint')
> > +  with_atomics = true
> > +else
> > +  with_atomics = false
> > +endif
> > +
> > +with_intel = false
> > +_intel = get_option('intel')
> > +if _intel != 'false'
> > +  if _intel == 'true' and not with_atomics
> > +    error('libdrm_intel requires atomics.')
> > +  endif
> > +  with_intel = _intel == 'true' or host_machine.cpu_family().startswith('x86')
> > +endif
> > +
> > +with_radoen = false
> 
> typo
> 
> > +_radeon = get_option('radeon')
> > +if _radeon != 'false'
> > +  if _radeon == 'true' and not with_atomics
> > +    error('libdrm_radeon requires atomics.')
> > +  endif
> > +  with_radeon = true
> > +endif
> > +
> > +with_amdgpu = false
> > +_amdgpu = get_option('amdgpu')
> > +if _amdgpu != 'false'
> > +  if _amdgpu == 'true' and not with_atomics
> > +    error('libdrm_amdgpu requires atomics.')
> > +  endif
> > +  with_amdgpu = true
> > +endif
> > +
> > +with_nouveau = false
> > +_nouveau = get_option('nouveau')
> > +if _nouveau != 'false'
> > +  if _nouveau == 'true' and not with_atomics
> > +    error('libdrm_nouveau requires atomics.')
> > +  endif
> > +  with_nouveau = true
> > +endif
> > +
> > +with_vmwgfx = false
> > +_vmwgfx = get_option('vmwgfx')
> > +if _vmwgfx != 'false'
> > +  with_vmwgfx = true
> > +endif
> > +
> > +with_omap = false
> > +_omap = get_option('omap')
> > +if _omap != 'false'
> > +  if _omap == 'true' and not with_atomics
> > +    error('libdrm_omap requires atomics.')
> > +  endif
> > +  with_omap = _omap == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_freedreno = false
> > +_freedreno = get_option('freedreno')
> > +if _freedreno != 'false'
> > +  if _freedreno == 'true' and not with_atomics
> > +    error('libdrm_freedreno requires atomics.')
> > +  endif
> > +  with_freedreno = _freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_tegra = false
> > +_tegra = get_option('tegra')
> > +if _tegra != 'false'
> > +  if _tegra == 'true' and not with_atomics
> > +    error('libdrm_tegra requires atomics.')
> > +  endif
> > +  with_tegra = _tegra == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_etnaviv = false
> > +_etnaviv = get_option('etnaviv')
> > +if _etnaviv != 'false'
> > +  if _etnaviv == 'true' and not with_atomics
> > +    error('libdrm_etnaviv requires atomics.')
> > +  endif
> > +  with_etnaviv = _etnaviv == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_exynos = false
> > +_exynos = get_option('exynos')
> > +if _exynos != 'false'
> > +  with_exynos = _exynos == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +with_vc4 = false
> > +_vc4 = get_option('vc4')
> > +if _vc4 != 'false'
> > +  with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +endif
> > +
> > +# XXX: Aparently only freebsd and dragonfly bsd actually need this (and
> > +# gnu/kfreebsd), not openbsd and netbsd
> > +with_libkms = false
> > +_libkms = get_option('libkms')
> > +if _libkms != 'false'
> > +  with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
> > +endif
> > +
> > +if with_udev
> > +  dep_udev = dependency('udev')
> > +  config.set10('UDEV', true)
> > +else
> > +  dep_udev = []
> > +endif
> > +
> > +# Among others FreeBSD does not have a separate dl library.
> > +if not cc.has_function('dlsym')
> > +  dep_dl = cc.find_library('dl', required : with_nouveau)
> > +else
> > +  dep_dl = []
> > +endif
> > +# clock_gettime might require -rt, or it might not. find out
> > +if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
> > +  # XXX: untested
> > +  dep_rt = cc.find_library('rt')
> > +else
> > +  dep_rt = []
> > +endif
> > +dep_m = cc.find_library('m', required : false)
> > +if cc.has_header('sys/sysctl.h')
> > +  config.set10('HAVE_SYS_SYSCTL_H', true)
> > +endif
> > +if cc.has_header('sys/select.h')
> > +  config.set10('HAVE_SYS_SELECT_H', true)
> > +endif
> > +if cc.has_header_symbol('sys/sysmacros.h', 'major')
> > +  config.set10('MAJOR_IN_SYSMACROS', true)
> > +elif cc.has_header_symbol('sys/mkdev.h', 'major')
> > +  config.set10('MAJOR_IN_MKDEV', true)
> > +endif
> > +if cc.has_function('open_memstream')
> > +  config.set10('HAVE_OPEN_MEMSTREAM', true)
> > +endif
> > +
> > +warn_c_args = []
> > +foreach a : ['-Wall', '-Wextra', '-Wsign-compare', 
> > +             '-Werror-implicit-function-declaration', '-Wpointer-arith',
> > +             '-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes',
> > +             '-Wmissing-declarations', '-Wnested-externs', '-Wpacked',
> > +             '-Wswitch-enum', '-Wmissing-format-attribute', 
> > +             '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', 
> > +             '-Wdeclaration-after-statement', '-Wold-style-definition']
> > +  if cc.has_argument(a)
> > +    warn_c_args += a
> > +  endif
> > +endforeach
> > +# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list
> > +# of options
> > +foreach a : ['unused-parameter', 'attributes', 'long-long', 
> > +             'missing-field-initializers']
> > +  if cc.has_argument('-W@0@'.format(a))
> > +    warn_c_args += '-Wno-@0@'.format(a)
> > +  endif
> > +endforeach
> > +
> > +
> > +dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
> > +dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
> > +dep_cairo = dependency('cairo', required : with_cairo_tests == 'true')
> > +dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
> > +
> > +with_man_pages = get_option('man_pages')
> > +prog_xslt = find_program('xsltproc', required : with_man_pages == 'true')
> > +prog_sed = find_program('sed', required : with_man_pages == 'true')
> > +manpage_style = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
> > +if prog_xslt.found()
> > +  if run_command(prog_xslt, '--nonet', manpage_style).returncode() != 0
> > +    if with_man_pages == 'true'
> > +      error('Manpage style sheet cannot be found')
> > +    endif
> > +    with_man_pages = 'false'
> > +  endif
> > +endif
> > +with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
> > +
> > +# Used for tets
> > +prog_bash = find_program('bash')
> > +
> > +if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
> > +               name : 'compiler supports __attribute__(("hidden"))')
> > +  config.set10('HAVE_VISIBILITY', true)
> > +endif
> > +
> > +foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'],
> > +             [with_nouveau, 'NOUVEAU'], [with_omap, 'OMAP'],
> > +             [with_exynos, 'EXYNOS'], [with_freedreno, 'FREEDRENO'],
> > +             [with_tegra, 'TEGRA'], [with_vc4, 'VC4'],
> > +             [with_etnaviv, 'ETNAVIV'], [with_install_tests, 'INSTALL_TESTS']]
> 
> HAVE_INSTALL_TESTS is not used in C files, you can remove it from this list :)
> 
> > +  e = t[0]
> > +  if e
> 
> Why the temp var?
> 
> > +    config.set10('HAVE_@0@'.format(t[1]), true)
> 
> I'll add -Wundef when I have some time and go through those so we can have
>   config.set10('HAVE_@0@'.format(t[1]), t[0])
> 
> Then we can eventually switch to -Werror=undef :D
> 
> > +  endif
> > +endforeach
> > +if with_freedreno_kgsl
> > +  if not with_freedreno
> > +    error('cannot enable freedreno-kgsl without freedreno support')
> > +  endif
> > +  config.set10('HAVE_FREEDRENO_KGSL', true)
> > +endif
> 
> > +if with_amdgpu
> > +  config.set10('HAVE_AMDGPU', true)
> > +  if dep_cunit.found()
> > +    config.set10('HAVE_CUNIT', true)
> > +  endif
> > +endif
> 
> These two are actually unused, and should be removed from configure.ac :)
> 
> > +if dep_cairo.found()
> > +  config.set10('HAVE_CAIRO', true)
> > +endif
> > +if dep_valgrind.found()
> > +  config.set10('HAVE_VALGRIND', true)
> > +endif
> > +
> > +config.set10('_GNU_SOURCE', true)
> > +config_file = configure_file(
> > +  configuration : config,
> > +  output : 'config.h',
> > +)
> > +add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
> > +
> > +inc_root = include_directories('.')
> > +inc_drm = include_directories('include/drm')
> > +
> > +files_libdrm = files(
> > +     'xf86drm.c',
> > +     'xf86drmHash.c',
> > +     'xf86drmHash.h',
> > +     'xf86drmRandom.c',
> > +     'xf86drmRandom.h',
> > +     'xf86drmSL.c',
> > +     'xf86drmMode.c',
> > +     'xf86atomic.h',
> > +     'libdrm_macros.h',
> > +     'libdrm_lists.h',
> > +     'util_double_list.h',
> > +     'util_math.h',
> > +)
> > +
> > +libdrm = shared_library(
> > +  'drm',
> > +  [files_libdrm, config_file],
> > +  c_args : warn_c_args,
> > +  dependencies : [dep_udev, dep_valgrind, dep_rt, dep_m],
> > +  include_directories : inc_drm,
> > +  version : '2.4.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm = declare_dependency(
> > +  link_with : libdrm,
> > +  include_directories : inc_drm,
> > +)
> > +
> > +install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
> > +install_headers(
> > +     'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
> > +     'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
> > +     'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
> > +     'include/drm/nouveau_drm.h', 'include/drm/qxl_drm.h',
> > +     'include/drm/r128_drm.h', 'include/drm/radeon_drm.h',
> > +     'include/drm/amdgpu_drm.h', 'include/drm/savage_drm.h',
> > +     'include/drm/sis_drm.h', 'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h',
> > +     'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h',
> 
> Do we want to only install the headers for the libs that are enabled?
> (Not sure what autotools does)

This is copied exactly from autotools (which is why vmwgfx_drm.h is split. I
agree that this is less than ideal, and we should only install the headers if
we're building the associated libdrm_* library.

> 
> > +  subdir : 'libdrm',
> > +)
> > +if with_vmwgfx
> > +  install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm')
> > +endif
> > +
> > +pkg.generate(
> > +  name : 'libdrm',
> > +  libraries : libdrm,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  description : 'Userspace interface to kernel DRM services',
> > +)
> > + 
> > +if with_libkms
> > +  subdir('libkms')
> > +endif
> > +if with_intel
> > +  subdir('intel')
> > +endif
> > +if with_nouveau
> > +  subdir('nouveau')
> > +endif
> > +if with_radeon
> > +  subdir('radeon')
> > +endif
> > +if with_amdgpu
> > +  subdir('amdgpu')
> > +endif
> > +if with_omap
> > +  subdir('omap')
> > +endif
> > +if with_exynos
> > +  subdir('exynos')
> > +endif
> > +if with_freedreno
> > +  subdir('freedreno')
> > +endif
> > +if with_tegra
> > +  subdir('tegra')
> > +endif
> > +if with_vc4
> > +  subdir('vc4')
> > +endif
> > +if with_etnaviv
> > +  subdir('etnaviv')
> > +endif
> > +if with_man_pages
> > +  subdir('man')
> > +endif
> > +subdir('data')
> > +subdir('tests')
> > diff --git a/meson_options.txt b/meson_options.txt
> > new file mode 100644
> > index 0000000..7c2fa4f
> > --- /dev/null
> > +++ b/meson_options.txt
> > @@ -0,0 +1,38 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +option('libkms',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('intel',       type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('radeon',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('amdgpu',      type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('nouveau',     type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('vmwgfx',      type : 'combo', value : 'true',  choices : ['true', 'false', 'auto'])
> > +option('omap',        type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> > +option('exynos',      type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> > +option('freedreno',   type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('tegra',       type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> > +option('vc4',         type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('etnaviv',     type : 'combo', value : 'false', choices : ['true', 'false', 'auto'])
> > +option('cairo_tests', type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('man_pages',   type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('valgrind',    type : 'combo', value : 'auto',  choices : ['true', 'false', 'auto'])
> > +option('freedreno-kgls',        type : 'boolean', value : false)
> > +option('install_test_programs', type : 'boolean', value : false)
> > +option('udev',                  type : 'boolean', value : false)
> 
> (as mentioned, descriptions would be good; copy/pasting the ones in
> configure.ac should be enough)
> 
> > diff --git a/nouveau/meson.build b/nouveau/meson.build
> > new file mode 100644
> > index 0000000..a50e4f7
> > --- /dev/null
> > +++ b/nouveau/meson.build
> > @@ -0,0 +1,65 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_nouveau = files(
> > +     'nouveau.c',
> > +     'pushbuf.c',
> > +     'bufctx.c',
> > +     'abi16.c',
> > +     'private.h',
> > +)
> > +
> > +libdrm_nouveau = shared_library(
> > +  'drm_nouveau',
> > +  [files_nouveau, config_file],
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : dep_threads,
> > +  version : '2.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_nouveau = declare_dependency(
> > +  link_with : [libdrm, libdrm_nouveau],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers('nouveau.h', subdir : 'libdrm/nouveau')
> > +install_headers(
> > +  'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h',
> > +  'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h',
> > +  subdir : 'libdrm/nouveau/nvif'
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_nouveau',
> > +  libraries : libdrm_nouveau,
> > +  subdirs : ['.', 'nouveau'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to nouveau kernel DRM services',
> > +)
> > +
> > +test(
> > +  'nouveau-symbol-check',
> > +  prog_bash,
> > +  args : [files('nouveau-symbol-check'), libdrm_nouveau]
> > +)
> > diff --git a/omap/meson.build b/omap/meson.build
> > new file mode 100644
> > index 0000000..1881087
> > --- /dev/null
> > +++ b/omap/meson.build
> > @@ -0,0 +1,53 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libdrm_omap = shared_library(
> > +  'drm_omap',
> > +  [files('omap_drm.c'), config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  c_args : warn_c_args,
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> > +  version : '1.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_omap = declare_dependency(
> > +  link_with : [libdrm, libdrm_omap],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers('omap_drmif.h', subdir : 'libdrm')
> > +install_headers('omap_drm.h', subdir : 'omap')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_omap',
> > +  libraries : libdrm_omap,
> > +  subdirs : ['.', 'libdrm', 'omap'],
> > +  version : '0.6',
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to omap kernel DRM services',
> > +)
> > +
> > +test(
> > +  'omap-symbol-check',
> > +  prog_bash,
> > +  args : [files('omap-symbol-check'), libdrm_omap]
> > +)
> > diff --git a/radeon/meson.build b/radeon/meson.build
> > new file mode 100644
> > index 0000000..f41c5c4
> > --- /dev/null
> > +++ b/radeon/meson.build
> > @@ -0,0 +1,65 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_radeon = files(
> > +     'radeon_bo_gem.c',
> > +     'radeon_cs_gem.c',
> > +     'radeon_cs_space.c',
> > +     'radeon_bo.c',
> > +     'radeon_cs.c',
> > +     'radeon_surface.c',
> > +)
> > +
> > +libdrm_radeon = shared_library(
> > +  'drm_radeon',
> > +  [files_radeon, config_file],
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> > +  version : '1.0.1',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_radeon = declare_dependency(
> > +  link_with : [libdrm, libdrm_radeon],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers(
> > +     'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h',
> > +     'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h',
> > +  subdir : 'libdrm'
> > +)
> > +
> > +pkg.generate(
> > +  name : 'libdrm_radeon',
> > +  libraries : libdrm_radeon,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to kernel DRM services for radeon',
> > +)
> > +
> > +test(
> > +  'radeon-symbol-check',
> > +  prog_bash,
> > +  args : [files('radeon-symbol-check'), libdrm_radeon]
> > +)
> > diff --git a/tegra/meson.build b/tegra/meson.build
> > new file mode 100644
> > index 0000000..568531c
> > --- /dev/null
> > +++ b/tegra/meson.build
> > @@ -0,0 +1,52 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libdrm_tegra = shared_library(
> > +  'drm_tegra',
> > +  [files('private.h', 'tegra.c'), config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : [dep_pthread_stubs],
> > +  c_args : warn_c_args,
> > +  version : '0.0.0',
> > +  install : true,
> > +)
> > +
> > +ext_libdrm_tegra = declare_dependency(
> > +  link_with : [libdrm, libdrm_tegra],
> > +  include_directories : [inc_drm, include_directories('.')],
> > +)
> > +
> > +install_headers('tegra.h', subdir : 'libdrm')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_tegra',
> > +  libraries : libdrm_tegra,
> > +  subdirs : ['.', 'libdrm'],
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to Tegra kernel DRM services',
> > +)
> > +
> > +test(
> > +  'tegra-symbol-check',
> > +  prog_bash,
> > +  args : [files('tegra-symbol-check'), libdrm_tegra]
> > +)
> > diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
> > new file mode 100644
> > index 0000000..5a07ce2
> > --- /dev/null
> > +++ b/tests/amdgpu/meson.build
> > @@ -0,0 +1,40 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +files_amdgpu_test = files(
> > +  'amdgpu_test.c',
> > +  'basic_tests.c',
> > +  'bo_tests.c',
> > +  'cs_tests.c',
> > +  'vce_tests.c',
> > +  'uvd_enc_tests.c',
> > +  'vcn_tests.c',
> > +  'deadlock_tests.c',
> > +  'vm_tests.c',
> > +)
> > +
> > +amdgpu_test = executable(
> > +  'amdgpu_test',
> > +  files_amdgpu_test,
> > +  dependencies : [dep_cunit, dep_threads],
> > +  include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')],
> 
> Not a fan of going back up the tree, but... meh

I'm just not a huge fan of polluting the namespace for an include that is used
once.

> 
> > +  link_with : [libdrm, libdrm_amdgpu],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/etnaviv/meson.build b/tests/etnaviv/meson.build
> > new file mode 100644
> > index 0000000..32c5cee
> > --- /dev/null
> > +++ b/tests/etnaviv/meson.build
> > @@ -0,0 +1,54 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +inc_etnaviv_tests = [inc_root, inc_drm, include_directories('../../etnaviv')]
> > +
> > +etnaviv_2d_test_files = files(
> > +  'cmdstream.xml.h',
> > +  'etnaviv_2d_test.c',
> > +  'state.xml.h',
> > +  'state_2d.xml.h',
> > +  'write_bmp.c',
> > +  'write_bmp.h',
> > +)
> > +
> > +etnaviv_2d_test = executable(
> > +  'etnaviv_2d_test',
> > +  etnaviv_2d_test_files,
> > +  include_directories : inc_etnaviv_tests,
> > +  link_with : [libdrm, libdrm_etnaviv],
> > +  install : with_install_tests,
> > +)
> > +
> > +etnaviv_cmd_stream_test = executable(
> > +  'etnaviv_cmd_stream_test',
> > +  files('etnaviv_cmd_stream_test.c'),
> > +  include_directories : inc_etnaviv_tests,
> > +  link_with : [libdrm, libdrm_etnaviv],
> > +  install : with_install_tests,
> > +)
> > +
> > +etnaviv_bo_cache_test = executable(
> > +  'etnaviv_bo_cache_test',
> > +  files('etnaviv_bo_cache_test.c'),
> > +  include_directories : inc_etnaviv_tests,
> > +  link_with : [libdrm, libdrm_etnaviv],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
> > new file mode 100644
> > index 0000000..940c3ce
> > --- /dev/null
> > +++ b/tests/exynos/meson.build
> > @@ -0,0 +1,54 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +inc_exynos = include_directories('../../exynos')
> > +
> > +if with_libkms
> > +  exynos_fimg2d_test = executable(
> > +    'exynos_fimg2d_test',
> > +    files('exynos_fimg2d_test.c'),
> > +    c_args : warn_c_args,
> > +    include_directories : [inc_root, inc_drm, inc_exynos,
> > +                           include_directories('../../libkms')],
> > +    link_with : [libdrm, libkms, libdrm_exynos],
> > +    dependencies : dep_threads,
> > +    install : with_install_tests,
> > +  )
> > +endif
> > +
> > +exynos_fimg2d_perf = executable(
> > +  'exynos_fimg2d_perf',
> > +  files('exynos_fimg2d_perf.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm, inc_exynos],
> > +  link_with : [libdrm, libdrm_exynos],
> > +  dependencies : dep_threads,
> > +  install : with_install_tests,
> > +)
> > +
> > +exynos_fimg2d_event = executable(
> > +  'exynos_fimg2d_event',
> > +  files('exynos_fimg2d_event.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_drm, inc_exynos],
> > +  link_with : [libdrm, libdrm_exynos],
> > +  dependencies : dep_threads,
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/kms/meson.build b/tests/kms/meson.build
> > new file mode 100644
> > index 0000000..e991913
> > --- /dev/null
> > +++ b/tests/kms/meson.build
> > @@ -0,0 +1,54 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +libkms_test_files = files(
> > +     'libkms-test.h',
> > +     'libkms-test-crtc.c',
> > +     'libkms-test-device.c',
> > +     'libkms-test-framebuffer.c',
> > +     'libkms-test-plane.c',
> > +     'libkms-test-screen.c',
> > +)
> > +
> > +libkms_test = static_library(
> > +  'kms-test',
> > +  libkms_test_files,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +kms_steal_crtc = executable(
> > +  'kms-steal-crtc',
> > +  files('kms-steal-crtc.c'),
> > +  dependencies : dep_cairo,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : [libkms_test, libutil],
> > +  install : with_install_tests,
> > +)
> > +
> > +kms_universal_planes = executable(
> > +  'kms-universal-lanes',
> > +  files('kms-universal-planes.c'),
> > +  dependencies : dep_cairo,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : [libkms_test],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
> > new file mode 100644
> > index 0000000..f713f26
> > --- /dev/null
> > +++ b/tests/kmstest/meson.build
> > @@ -0,0 +1,28 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +kmstest = executable(
> > +  'kmstest',
> > +  files('main.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_tests, include_directories('../../libkms'), inc_drm],
> > +  link_with : [libutil, libkms, libdrm],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/meson.build b/tests/meson.build
> > new file mode 100644
> > index 0000000..960ff7b
> > --- /dev/null
> > +++ b/tests/meson.build
> > @@ -0,0 +1,85 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +inc_tests = include_directories('.')
> > +
> > +subdir('util')
> > +subdir('kms')
> > +subdir('modeprint')
> > +subdir('proptest')
> > +subdir('vbltest')
> > +if with_libkms
> > +  subdir('kmstest')
> > +endif
> > +if with_radeon
> > +  subdir('radeon')
> > +endif
> > +if with_amdgpu and dep_cunit.found()
> 
> I feel like the dep_cunit.found() condition belongs inside
> tests/amdgpu/meson.build, around the relevant test.

I guess. There's only one test in amdgpu anyway, but I'll change it.

> 
> > +  subdir('amdgpu')
> > +endif
> > +if with_exynos
> > +  subdir('exynos')
> > +endif
> > +if with_tegra
> > +  subdir('tegra')
> > +endif
> > +if with_etnaviv
> > +  subdir('etnaviv')
> > +endif
> > +if with_nouveau
> > +  subdir('nouveau')
> > +endif
> > +
> > +drmsl = executable(
> > +  'drmsl',
> > +  files('drmsl.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +hash = executable(
> > +  'hash',
> > +  files('hash.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +random = executable(
> > +  'random',
> > +  files('random.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +drmdevice = executable(
> > +  'drmdevice',
> > +  files('drmdevice.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > +
> > +test('random', random, timeout : 240)
> > +test('hash', hash)
> > +test('drmsl', drmsl)
> > +test('drmdevice', drmdevice)
> > diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
> > new file mode 100644
> > index 0000000..5f0eb24
> > --- /dev/null
> > +++ b/tests/modeprint/meson.build
> > @@ -0,0 +1,29 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +modeprint = executable(
> > +  'modeprint',
> > +  files('modeprint.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : dep_threads,
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
> > new file mode 100644
> > index 0000000..f5d73c1
> > --- /dev/null
> > +++ b/tests/nouveau/meson.build
> > @@ -0,0 +1,30 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +threaded = executable(
> > +  'threaded',
> > +  files('threaded.c'),
> > +  dependencies : [dep_dl, dep_threads],
> > +  include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
> > +  link_with : [libdrm, libdrm_nouveau],
> > +  c_args : warn_c_args,
> > +)
> > +
> > +test('threaded', threaded)
> > diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
> > new file mode 100644
> > index 0000000..dcd724f
> > --- /dev/null
> > +++ b/tests/proptest/meson.build
> > @@ -0,0 +1,30 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +proptest_files = files('proptest.c')
> > +
> > +proptest = executable(
> > +  'proptest',
> > +  files('proptest.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : [libdrm, libutil],
> > +  install : with_install_tests,
> > +)
> > diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
> > new file mode 100644
> > index 0000000..54db231
> > --- /dev/null
> > +++ b/tests/radeon/meson.build
> > @@ -0,0 +1,27 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +radeon_ttm = executable(
> > +  'radeon_ttm',
> > +  files('rbo.c', 'rbo.h', 'radeon_ttm.c'),
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  c_args : warn_c_args,
> > +)
> > diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
> > new file mode 100644
> > index 0000000..9c74ac4
> > --- /dev/null
> > +++ b/tests/tegra/meson.build
> > @@ -0,0 +1,27 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +openclose = executable(
> > +  'openclose',
> > +  files('openclose.c'),
> > +  include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
> > +  c_args : warn_c_args,
> > +  link_with : [libdrm, libdrm_tegra],
> > +)
> > diff --git a/tests/util/meson.build b/tests/util/meson.build
> > new file mode 100644
> > index 0000000..a0e1d3c
> > --- /dev/null
> > +++ b/tests/util/meson.build
> > @@ -0,0 +1,37 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +util_files = files(
> > +  'common.h',
> > +  'format.c',
> > +  'format.h',
> > +  'kms.c',
> > +  'kms.h',
> > +  'pattern.c',
> > +  'pattern.h',
> > +)
> > +
> > +libutil = static_library(
> > +  'util',
> > +  [util_files, config_file],
> > +  include_directories : [inc_root, inc_drm],
> > +  link_with : libdrm,
> > +  dependencies : dep_cairo
> > +)
> > diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
> > new file mode 100644
> > index 0000000..4fb1ad3
> > --- /dev/null
> > +++ b/tests/vbltest/meson.build
> > @@ -0,0 +1,28 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +vbltest = executable(
> > +  'vbltest',
> > +  files('vbltest.c'),
> > +  c_args : warn_c_args,
> > +  include_directories : [inc_root, inc_tests, inc_drm],
> > +  link_with : [libdrm, libutil],
> > +  install : with_install_tests,
> > +)
> > diff --git a/vc4/meson.build b/vc4/meson.build
> > new file mode 100644
> > index 0000000..0136987
> > --- /dev/null
> > +++ b/vc4/meson.build
> > @@ -0,0 +1,28 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
> > +# of this software and associated documentation files (the "Software"), to deal
> > +# in the Software without restriction, including without limitation the rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > +# SOFTWARE.
> > +
> > +install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm')
> > +
> > +pkg.generate(
> > +  name : 'libdrm_vc4',
> > +  version : meson.project_version(),
> > +  requires_private : 'libdrm',
> > +  description : 'Userspace interface to vc4 kernel DRM services',
> > +)
> > -- 
> > git-series 0.9.1
> 
> I think everything else looks good; thanks for the effort!

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlpP14gACgkQCJ4WlhQG
iO9tWggAjBAtH7U8uxl+q5inyeibwrvp56sIhSbZFRkKT+EpbQknydDFEZPfLGMt
NGqwETVUp3yHH0FZ19lPtgljCtCB1NONXo9vYe6XsOIKpwqg2eSgSmNj9emXkEpR
HNL5FoHFlV7j4pAofqOglwCzHNuVGKTjPoEKZ0V5MTNO5tAY9qSTt6DMTsXrV36d
2OOj7dURVBazg26NJ/nv3VbC3WZQXuXseBHIhfkuAEXj/t66md+iDTTA09l0g/+i
MztlT75e0+wgzPaBVv6Y2pW1ZAeI53jIVmpYSrXoZfDH8ybuj+aK2zgp4HzPTu3S
GpwbVGBrZ11Cm693QmXcAfPcg8pVoA==
=bwJv
-----END PGP SIGNATURE-----

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 0/3] Meson build system
  2018-01-03 21:31 [PATCH 0/3] Meson build system Dylan Baker
                   ` (3 preceding siblings ...)
  2018-01-04 18:28 ` [PATCH v4 0/3] Meson build system Dylan Baker
@ 2018-01-05 20:00 ` Dylan Baker
  2018-01-05 20:00   ` [PATCH 1/3] Add meson " Dylan Baker
                     ` (3 more replies)
  4 siblings, 4 replies; 29+ messages in thread
From: Dylan Baker @ 2018-01-05 20:00 UTC (permalink / raw)
  To: mesa-dev, dri-devel; +Cc: Dylan Baker

This is a fifth iteration of the meson build system for libdrm. This
version is significantly cleaned up from the last version and uses a
style more like the build system in mesa.

It builds all of the drivers and tests, and the tests can be run via
`ninja test`.

It has support for being used as a wrapped dependency with ext_foo
variables (I have a branch of mesa that will build this code as a wrap,
which has also been useful for testing). This means it can be used to
build a mesa that requires a newer libdrm than the system provides
(which can be especially useful if you can't install packages on that
system), or to build libdrm support that your distro doesn't ship (like
arm only drivers on x86), cross compiling, and for testing.

This has been build tested and mesa has been compiled against it, but
only minimal functional testing has been done, since I only have i965
machines, and i965 only uses libdrm lightly.

Some reviewers of the previous versions have done some additional
testing.

Changes since v3:
  - Fix freedreno kgsl check
  - Fix kgls -> kgsl typo
  - standardize meson options to use only `-` and not `_`
  - fix typo radoen -> radeon
  - add help messages to options
  - fix typo in kms-universal-planes binary
  - build and install modetest (this was missed in the first version for
    some reason)
  - install amdgpu.ids as 644 instead of 444

Changes since v4:
  - Fix minor nits in options descriptions (Igor)
  - Fix editorconfig settings
  - Fix amdgpu.ids searh path
  - Style nits for Eric E.
  - Remove more tabs
  - Ensure that 1/0 defines are always defined, instead of only when
    their value is 1
  - Don't add header files into file lists. (Meson figures out header
    dependencies automatically using graphs that the compiler generates
    during compilation)
  - Don't assign file lists to variables when possible. In a few cases
    files need to be conditionally added, but if we're not in one of
    those cases just put the lists directly in the exectuable or library
    declaration.

Dylan Baker (3):
  Add meson build system
  autotools: Include meson.build files in tarball
  README: Add note about meson

 .editorconfig               |   4 +-
 Makefile.am                 |  30 ++-
 README                      |  24 +-
 amdgpu/.editorconfig        |   4 +-
 amdgpu/meson.build          |  65 +++++++-
 data/meson.build            |  27 +++-
 etnaviv/meson.build         |  59 ++++++-
 exynos/meson.build          |  53 +++++-
 freedreno/meson.build       |  76 ++++++++-
 intel/meson.build           | 105 +++++++++++-
 libkms/meson.build          |  74 ++++++++-
 man/meson.build             |  67 +++++++-
 meson.build                 | 364 +++++++++++++++++++++++++++++++++++++-
 meson_options.txt           | 143 +++++++++++++++-
 nouveau/meson.build         |  58 ++++++-
 omap/meson.build            |  53 +++++-
 radeon/meson.build          |  63 ++++++-
 tegra/meson.build           |  52 +++++-
 tests/amdgpu/meson.build    |  34 +++-
 tests/etnaviv/meson.build   |  45 +++++-
 tests/exynos/meson.build    |  54 +++++-
 tests/kms/meson.build       |  49 +++++-
 tests/kmstest/meson.build   |  30 +++-
 tests/meson.build           |  86 +++++++++-
 tests/modeprint/meson.build |  29 +++-
 tests/modetest/meson.build  |  29 +++-
 tests/nouveau/meson.build   |  30 +++-
 tests/proptest/meson.build  |  28 +++-
 tests/radeon/meson.build    |  27 +++-
 tests/tegra/meson.build     |  27 +++-
 tests/util/meson.build      |  28 +++-
 tests/vbltest/meson.build   |  28 +++-
 vc4/meson.build             |  28 +++-
 33 files changed, 1869 insertions(+), 4 deletions(-)
 create mode 100644 amdgpu/meson.build
 create mode 100644 data/meson.build
 create mode 100644 etnaviv/meson.build
 create mode 100644 exynos/meson.build
 create mode 100644 freedreno/meson.build
 create mode 100644 intel/meson.build
 create mode 100644 libkms/meson.build
 create mode 100644 man/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 nouveau/meson.build
 create mode 100644 omap/meson.build
 create mode 100644 radeon/meson.build
 create mode 100644 tegra/meson.build
 create mode 100644 tests/amdgpu/meson.build
 create mode 100644 tests/etnaviv/meson.build
 create mode 100644 tests/exynos/meson.build
 create mode 100644 tests/kms/meson.build
 create mode 100644 tests/kmstest/meson.build
 create mode 100644 tests/meson.build
 create mode 100644 tests/modeprint/meson.build
 create mode 100644 tests/modetest/meson.build
 create mode 100644 tests/nouveau/meson.build
 create mode 100644 tests/proptest/meson.build
 create mode 100644 tests/radeon/meson.build
 create mode 100644 tests/tegra/meson.build
 create mode 100644 tests/util/meson.build
 create mode 100644 tests/vbltest/meson.build
 create mode 100644 vc4/meson.build

base-commit: 831036a6f62005da9fb4a75fe043bd96ce672d27
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 1/3] Add meson build system
  2018-01-05 20:00 ` [PATCH 0/3] Meson build system Dylan Baker
@ 2018-01-05 20:00   ` Dylan Baker
  2018-01-12 17:10     ` Eric Engestrom
  2018-01-05 20:00   ` [PATCH 2/3] autotools: Include meson.build files in tarball Dylan Baker
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 29+ messages in thread
From: Dylan Baker @ 2018-01-05 20:00 UTC (permalink / raw)
  To: mesa-dev, dri-devel; +Cc: Dylan Baker

This patch adds a complete meson build system, including tests and
install. It has the necessary hooks to allow it be used as a subproject
for other meson based builds such as mesa.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
---
 .editorconfig               |   4 +-
 amdgpu/.editorconfig        |   4 +-
 amdgpu/meson.build          |  65 +++++++-
 data/meson.build            |  27 +++-
 etnaviv/meson.build         |  59 ++++++-
 exynos/meson.build          |  53 +++++-
 freedreno/meson.build       |  76 ++++++++-
 intel/meson.build           | 105 +++++++++++-
 libkms/meson.build          |  74 ++++++++-
 man/meson.build             |  67 +++++++-
 meson.build                 | 364 +++++++++++++++++++++++++++++++++++++-
 meson_options.txt           | 143 +++++++++++++++-
 nouveau/meson.build         |  58 ++++++-
 omap/meson.build            |  53 +++++-
 radeon/meson.build          |  63 ++++++-
 tegra/meson.build           |  52 +++++-
 tests/amdgpu/meson.build    |  34 +++-
 tests/etnaviv/meson.build   |  45 +++++-
 tests/exynos/meson.build    |  54 +++++-
 tests/kms/meson.build       |  49 +++++-
 tests/kmstest/meson.build   |  30 +++-
 tests/meson.build           |  86 +++++++++-
 tests/modeprint/meson.build |  29 +++-
 tests/modetest/meson.build  |  29 +++-
 tests/nouveau/meson.build   |  30 +++-
 tests/proptest/meson.build  |  28 +++-
 tests/radeon/meson.build    |  27 +++-
 tests/tegra/meson.build     |  27 +++-
 tests/util/meson.build      |  28 +++-
 tests/vbltest/meson.build   |  28 +++-
 vc4/meson.build             |  28 +++-
 31 files changed, 1819 insertions(+)
 create mode 100644 amdgpu/meson.build
 create mode 100644 data/meson.build
 create mode 100644 etnaviv/meson.build
 create mode 100644 exynos/meson.build
 create mode 100644 freedreno/meson.build
 create mode 100644 intel/meson.build
 create mode 100644 libkms/meson.build
 create mode 100644 man/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 nouveau/meson.build
 create mode 100644 omap/meson.build
 create mode 100644 radeon/meson.build
 create mode 100644 tegra/meson.build
 create mode 100644 tests/amdgpu/meson.build
 create mode 100644 tests/etnaviv/meson.build
 create mode 100644 tests/exynos/meson.build
 create mode 100644 tests/kms/meson.build
 create mode 100644 tests/kmstest/meson.build
 create mode 100644 tests/meson.build
 create mode 100644 tests/modeprint/meson.build
 create mode 100644 tests/modetest/meson.build
 create mode 100644 tests/nouveau/meson.build
 create mode 100644 tests/proptest/meson.build
 create mode 100644 tests/radeon/meson.build
 create mode 100644 tests/tegra/meson.build
 create mode 100644 tests/util/meson.build
 create mode 100644 tests/vbltest/meson.build
 create mode 100644 vc4/meson.build

diff --git a/.editorconfig b/.editorconfig
index 893b7be..29b4f39 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -17,3 +17,7 @@ indent_style = tab
 [*.m4]
 indent_style = space
 indent_size = 2
+
+[{meson.build,meson_options.txt}]
+indent_style = space
+indent_size = 2
diff --git a/amdgpu/.editorconfig b/amdgpu/.editorconfig
index 2528d67..426273f 100644
--- a/amdgpu/.editorconfig
+++ b/amdgpu/.editorconfig
@@ -7,3 +7,7 @@ indent_style = tab
 indent_size = 8
 tab_width = 8
 insert_final_newline = true
+
+[meson.build]
+indent_style = space
+indent_size = 2
diff --git a/amdgpu/meson.build b/amdgpu/meson.build
new file mode 100644
index 0000000..55ab9d1
--- /dev/null
+++ b/amdgpu/meson.build
@@ -0,0 +1,65 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+datadir_amdgpu = join_paths(get_option('datadir'), 'libdrm', 'amdgpu.ids')
+
+libdrm_amdgpu = shared_library(
+  'drm_amdgpu',
+  [
+    files(
+      'amdgpu_asic_id.c', 'amdgpu_bo.c', 'amdgpu_cs.c', 'amdgpu_device.c',
+      'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'util_hash.c',
+      'util_hash_table.c',
+    ),
+    config_file,
+  ],
+  c_args : [
+    warn_c_args,
+    '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(datadir_amdgpu),
+  ],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_pthread_stubs,
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('amdgpu.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_amdgpu',
+  libraries : libdrm_amdgpu,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to kernel DRM services for amdgpu',
+)
+
+ext_libdrm_amdgpu = declare_dependency(
+  link_with : [libdrm, libdrm_amdgpu],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+test(
+  'amdgpu-symbol-check',
+  prog_bash,
+  args : [files('amdgpu-symbol-check'), libdrm_amdgpu]
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..9c26b66
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+if with_amdgpu
+  install_data(
+    'amdgpu.ids',
+    install_mode : 'rw-r--r--',
+    install_dir : datadir_amdgpu,
+  )
+endif
diff --git a/etnaviv/meson.build b/etnaviv/meson.build
new file mode 100644
index 0000000..1767733
--- /dev/null
+++ b/etnaviv/meson.build
@@ -0,0 +1,59 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+libdrm_etnaviv = shared_library(
+  'drm_etnaviv',
+  [
+    files(
+      'etnaviv_device.c', 'etnaviv_gpu.c', 'etnaviv_bo.c', 'etnaviv_bo_cache.c',
+      'etnaviv_perfmon.c', 'etnaviv_pipe.c', 'etnaviv_cmd_stream.c',
+    ),
+    config_file
+  ],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+  dependencies : [dep_pthread_stubs, dep_rt],
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('etnaviv_drmif.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_etnaviv',
+  libraries : libdrm_etnaviv,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to Tegra kernel DRM services',
+)
+
+ext_libdrm_etnaviv = declare_dependency(
+  link_with : [libdrm, libdrm_etnaviv],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+test(
+  'etnaviv-symbol-check',
+  prog_bash,
+  args : [files('etnaviv-symbol-check'), libdrm_etnaviv]
+)
diff --git a/exynos/meson.build b/exynos/meson.build
new file mode 100644
index 0000000..c96ad4e
--- /dev/null
+++ b/exynos/meson.build
@@ -0,0 +1,53 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_exynos = shared_library(
+  'drm_exynos',
+  [files('exynos_drm.c', 'exynos_fimg2d.c'), config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.0',
+  install : true,
+)
+
+install_headers('exynos_drmif.h', subdir : 'libdrm')
+install_headers('exynos_drm.h', 'exynos_fimg2d.h', subdir : 'exynos')
+
+ext_libdrm_exynos = declare_dependency(
+  link_with : [libdrm, libdrm_exynos],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+pkg.generate(
+  name : 'libdrm_exynos',
+  libraries : libdrm_exynos,
+  subdirs : ['.', 'libdrm', 'exynos'],
+  version : '0.7',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to exynos kernel DRM services',
+)
+
+test(
+  'exynos-symbol-check',
+  prog_bash,
+  args : [files('exynos-symbol-check'), libdrm_exynos]
+)
diff --git a/freedreno/meson.build b/freedreno/meson.build
new file mode 100644
index 0000000..b4035e1
--- /dev/null
+++ b/freedreno/meson.build
@@ -0,0 +1,76 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_freedreno = files(
+  'freedreno_device.c',
+  'freedreno_pipe.c',
+  'freedreno_ringbuffer.c',
+  'freedreno_bo.c',
+  'freedreno_bo_cache.c',
+  'msm/msm_bo.c',
+  'msm/msm_device.c',
+  'msm/msm_pipe.c',
+  'msm/msm_ringbuffer.c',
+)
+
+if with_freedreno_kgsl
+  files_freedreno += files(
+    'kgsl/kgsl_bo.c',
+    'kgsl/kgsl_device.c',
+    'kgsl/kgsl_pipe.c',
+    'kgsl/kgsl_ringbuffer.c',
+  )
+endif
+
+libdrm_freedreno = shared_library(
+  'drm_freedreno',
+  [files_freedreno, config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
+  link_with : libdrm,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_freedreno = declare_dependency(
+  link_with : [libdrm, libdrm_freedreno],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+  'freedreno_drmif.h', 'freedreno_ringbuffer.h',
+  subdir : 'freedreno'
+)
+
+pkg.generate(
+  name : 'libdrm_freedreno',
+  libraries : libdrm_freedreno,
+  subdirs : ['.', 'libdrm', 'freedreno'],
+  version : '0.7',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to freedreno kernel DRM services',
+)
+
+test(
+  'freedreno-symbol-check',
+  prog_bash,
+  args : [files('freedreno-symbol-check'), libdrm_freedreno]
+)
diff --git a/intel/meson.build b/intel/meson.build
new file mode 100644
index 0000000..ad87727
--- /dev/null
+++ b/intel/meson.build
@@ -0,0 +1,105 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_intel = shared_library(
+  'drm_intel',
+  [
+    files(
+      'intel_bufmgr.c', 'intel_bufmgr_fake.c', 'intel_bufmgr_gem.c',
+      'intel_decode.c', 'mm.c',
+    ),
+    config_file,
+  ],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
+  c_args : warn_c_args,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_intel = declare_dependency(
+  link_with : [libdrm, libdrm_intel],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+  'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h',
+  subdir : 'libdrm',
+)
+
+pkg.generate(
+  name : 'libdrm_intel',
+  libraries : libdrm_intel,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires : 'libdrm',
+  description : 'Userspace interface to intel kernel DRM services',
+)
+
+test_decode = executable(
+  'test_decode',
+  files('test_decode.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : [libdrm, libdrm_intel],
+  c_args : warn_c_args,
+)
+
+test(
+  'gen4-3d.batch',
+  prog_bash,
+  args : files('tests/gen4-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen45-3d.batch',
+  prog_bash,
+  args : files('tests/gm45-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen5-3d.batch',
+  prog_bash,
+  args : files('tests/gen5-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen6-3d.batch',
+  prog_bash,
+  args : files('tests/gen6-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen7-3d.batch',
+  prog_bash,
+  args : files('tests/gen7-3d.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'gen7-2d-copy.batch',
+  prog_bash,
+  args : files('tests/gen7-2d-copy.batch.sh'),
+  workdir : meson.current_build_dir(),
+)
+test(
+  'intel-symbol-check',
+  prog_bash,
+  args : [files('intel-symbol-check'), libdrm_intel]
+)
diff --git a/libkms/meson.build b/libkms/meson.build
new file mode 100644
index 0000000..9eff431
--- /dev/null
+++ b/libkms/meson.build
@@ -0,0 +1,74 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libkms_include = [inc_root, inc_drm]
+files_libkms = files(
+  'linux.c',
+  'dumb.c',
+  'api.c',
+)
+if with_vmwgfx
+  files_libkms += files('vmwgfx.c')
+endif
+if with_intel
+  files_libkms += files('intel.c')
+endif
+if with_nouveau
+  files_libkms += files('nouveau.c')
+endif
+if with_radeon
+  files_libkms += files('radeon.c')
+endif
+if with_exynos
+  files_libkms += files('exynos.c')
+  libkms_include += include_directories('../exynos')
+endif
+
+libkms = shared_library(
+  'kms',
+  [files_libkms, config_file],
+  c_args : warn_c_args,
+  include_directories : libkms_include,
+  link_with : libdrm,
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libkms = declare_dependency(
+  link_with : [libdrm, libkms],
+  include_directories : [libkms_include],
+)
+
+install_headers('libkms.h', subdir : 'libkms')
+
+pkg.generate(
+  name : 'libkms',
+  libraries : libkms,
+  subdirs : ['libkms'],
+  version : '1.0.0',
+  requires_private : 'libdrm',
+  description : 'Library that abstracts away the different mm interfaces for kernel drivers',
+)
+
+test(
+  'kms-symbol-check',
+  prog_bash,
+  args : [files('kms-symbol-check'), libkms]
+)
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..45eaeda
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,67 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+xsltproc_args = [
+  '--stringparam', 'man.authors.section.enabled', '0',
+  '--stringparam', 'man.copyright.section.enabled', '0',
+  '--stringparam', 'funcsynopsis.style', 'ansi',
+  '--stringparam', 'man.output.quietly', '1',
+  '--nonet', manpage_style,
+]
+
+xmls = [
+  ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'],
+  ['drmHandleEvent', '3'], ['drmModeGetResources', '3']
+]
+foreach x : xmls
+  m = x[0]
+  s = x[1]
+  custom_target(
+    m,
+    input : files('@0@.xml'.format(m)),
+    output : '@0@.@1@'.format(m, s),
+    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'],
+    install : true,
+    install_dir : join_paths(get_option('mandir'), 'man@0@'.format(s)),
+    build_by_default : true,
+  )
+endforeach
+
+foreach x : ['drm-mm', 'drm-gem', 'drm-ttm']
+  gen = custom_target(
+    'gen-@0@'.format(x),
+    input : 'drm-memory.xml',
+    output : '@0@.xml'.format(x),
+    command : [
+      prog_sed, '-e', 's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@',
+      '@INPUT@',
+    ],
+    capture : true,
+  )
+  custom_target(
+    '@0@.7'.format(x),
+    input : gen,
+    output : '@0@.7'.format(x, '7'),
+    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'],
+    install : true,
+    install_dir : join_paths(get_option('mandir'), 'man7'),
+    build_by_default : true,
+  )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..294fa90
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,364 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+project(
+  'libdrm',
+  ['c'],
+  version : '2.4.89',
+  license : 'MIT',
+  meson_version : '>= 0.42',
+  default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],
+)
+
+pkg = import('pkgconfig')
+
+with_udev = get_option('udev')
+with_freedreno_kgsl = get_option('freedreno-kgsl')
+with_install_tests = get_option('install-test-programs')
+with_cairo_tests = get_option('cairo-tests')
+with_valgrind = get_option('valgrind')
+
+config = configuration_data()
+
+# TODO: openbsd is guess, the others are correct
+if ['freebsd', 'dragonfly', 'netbsd', 'openbsd'].contains(host_machine.system())
+  dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
+else
+  dep_pthread_stubs = []
+endif
+dep_threads = dependency('threads')
+
+cc = meson.get_compiler('c')
+
+# Check for atomics
+intel_atomics = false
+lib_atomics = false
+
+if cc.compiles('''
+    int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
+    int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
+    ''',
+    name : 'Intel Atomics')
+  intel_atomics = true
+  with_atomics = true
+elif cc.has_header('atomic_ops.h')
+  lib_atomics = true
+  with_atomics = true
+elif cc.has_function('atomic_cas_uint')
+  with_atomics = true
+else
+  with_atomics = false
+endif
+
+config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', intel_atomics)
+config.set10('HAVE_LIB_ATOMIC_OPS', lib_atomics)
+
+with_intel = false
+_intel = get_option('intel')
+if _intel != 'false'
+  if _intel == 'true' and not with_atomics
+    error('libdrm_intel requires atomics.')
+  else
+    with_intel = _intel == 'true' or host_machine.cpu_family().startswith('x86')
+  endif
+endif
+
+with_radeon = false
+_radeon = get_option('radeon')
+if _radeon != 'false'
+  if _radeon == 'true' and not with_atomics
+    error('libdrm_radeon requires atomics.')
+  endif
+  with_radeon = true
+endif
+
+with_amdgpu = false
+_amdgpu = get_option('amdgpu')
+if _amdgpu != 'false'
+  if _amdgpu == 'true' and not with_atomics
+    error('libdrm_amdgpu requires atomics.')
+  endif
+  with_amdgpu = true
+endif
+
+with_nouveau = false
+_nouveau = get_option('nouveau')
+if _nouveau != 'false'
+  if _nouveau == 'true' and not with_atomics
+    error('libdrm_nouveau requires atomics.')
+  endif
+  with_nouveau = true
+endif
+
+with_vmwgfx = false
+_vmwgfx = get_option('vmwgfx')
+if _vmwgfx != 'false'
+  with_vmwgfx = true
+endif
+
+with_omap = false
+_omap = get_option('omap')
+if _omap == 'true'
+  if not with_atomics
+    error('libdrm_omap requires atomics.')
+  endif
+  with_omap = true
+endif
+
+with_freedreno = false
+_freedreno = get_option('freedreno')
+if _freedreno != 'false'
+  if _freedreno == 'true' and not with_atomics
+    error('libdrm_freedreno requires atomics.')
+  else
+    with_freedreno = _freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+  endif
+endif
+
+with_tegra = false
+_tegra = get_option('tegra')
+if _tegra == 'true'
+  if not with_atomics
+    error('libdrm_tegra requires atomics.')
+  endif
+  with_tegra = true
+endif
+
+with_etnaviv = false
+_etnaviv = get_option('etnaviv')
+if _etnaviv == 'true'
+  if not with_atomics
+    error('libdrm_etnaviv requires atomics.')
+  endif
+  with_etnaviv = true
+endif
+
+with_exynos = get_option('exynos') == 'true'
+
+with_vc4 = false
+_vc4 = get_option('vc4')
+if _vc4 != 'false'
+  with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
+endif
+
+# XXX: Aparently only freebsd and dragonfly bsd actually need this (and
+# gnu/kfreebsd), not openbsd and netbsd
+with_libkms = false
+_libkms = get_option('libkms')
+if _libkms != 'false'
+  with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
+endif
+
+if with_udev
+  dep_udev = dependency('udev')
+  config.set10('UDEV', true)
+else
+  dep_udev = []
+endif
+
+# Among others FreeBSD does not have a separate dl library.
+if not cc.has_function('dlsym')
+  dep_dl = cc.find_library('dl', required : with_nouveau)
+else
+  dep_dl = []
+endif
+# clock_gettime might require -rt, or it might not. find out
+if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
+  # XXX: untested
+  dep_rt = cc.find_library('rt')
+else
+  dep_rt = []
+endif
+dep_m = cc.find_library('m', required : false)
+if cc.has_header('sys/sysctl.h')
+  config.set10('HAVE_SYS_SYSCTL_H', true)
+endif
+if cc.has_header('sys/select.h')
+  config.set10('HAVE_SYS_SELECT_H', true)
+endif
+if cc.has_header_symbol('sys/sysmacros.h', 'major')
+  config.set10('MAJOR_IN_SYSMACROS', true)
+elif cc.has_header_symbol('sys/mkdev.h', 'major')
+  config.set10('MAJOR_IN_MKDEV', true)
+endif
+if cc.has_function('open_memstream')
+  config.set10('HAVE_OPEN_MEMSTREAM', true)
+endif
+
+warn_c_args = []
+foreach a : ['-Wall', '-Wextra', '-Wsign-compare', 
+             '-Werror-implicit-function-declaration', '-Wpointer-arith',
+             '-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes',
+             '-Wmissing-declarations', '-Wnested-externs', '-Wpacked',
+             '-Wswitch-enum', '-Wmissing-format-attribute', 
+             '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', 
+             '-Wdeclaration-after-statement', '-Wold-style-definition']
+  if cc.has_argument(a)
+    warn_c_args += a
+  endif
+endforeach
+# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list
+# of options
+foreach a : ['unused-parameter', 'attributes', 'long-long', 
+             'missing-field-initializers']
+  if cc.has_argument('-W@0@'.format(a))
+    warn_c_args += '-Wno-@0@'.format(a)
+  endif
+endforeach
+
+
+dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
+dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
+dep_cairo = dependency('cairo', required : with_cairo_tests == 'true')
+dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
+
+with_man_pages = get_option('man-pages')
+prog_xslt = find_program('xsltproc', required : with_man_pages == 'true')
+prog_sed = find_program('sed', required : with_man_pages == 'true')
+manpage_style = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
+if prog_xslt.found()
+  if run_command(prog_xslt, '--nonet', manpage_style).returncode() != 0
+    if with_man_pages == 'true'
+      error('Manpage style sheet cannot be found')
+    endif
+    with_man_pages = 'false'
+  endif
+endif
+with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
+
+# Used for tets
+prog_bash = find_program('bash')
+
+if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
+               name : 'compiler supports __attribute__(("hidden"))')
+  config.set10('HAVE_VISIBILITY', true)
+endif
+
+foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'],
+             [with_nouveau, 'NOUVEAU'], [with_omap, 'OMAP'],
+             [with_exynos, 'EXYNOS'], [with_freedreno, 'FREEDRENO'],
+             [with_tegra, 'TEGRA'], [with_vc4, 'VC4'],
+             [with_etnaviv, 'ETNAVIV']]
+  if t[0]
+    config.set10('HAVE_@0@'.format(t[1]), true)
+  endif
+endforeach
+if with_freedreno_kgsl and not with_freedreno
+  error('cannot enable freedreno-kgsl without freedreno support')
+endif
+if dep_cairo.found()
+  config.set10('HAVE_CAIRO', true)
+endif
+if dep_valgrind.found()
+  config.set10('HAVE_VALGRIND', true)
+endif
+
+config.set10('_GNU_SOURCE', true)
+config_file = configure_file(
+  configuration : config,
+  output : 'config.h',
+)
+add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
+
+inc_root = include_directories('.')
+inc_drm = include_directories('include/drm')
+
+libdrm = shared_library(
+  'drm',
+  [files(
+     'xf86drm.c', 'xf86drmHash.c', 'xf86drmRandom.c', 'xf86drmSL.c',
+     'xf86drmMode.c'
+   ),
+   config_file,
+  ],
+  c_args : warn_c_args,
+  dependencies : [dep_udev, dep_valgrind, dep_rt, dep_m],
+  include_directories : inc_drm,
+  version : '2.4.0',
+  install : true,
+)
+
+ext_libdrm = declare_dependency(
+  link_with : libdrm,
+  include_directories : inc_drm,
+)
+
+install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
+install_headers(
+  'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
+  'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
+  'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
+  'include/drm/nouveau_drm.h', 'include/drm/qxl_drm.h',
+  'include/drm/r128_drm.h', 'include/drm/radeon_drm.h',
+  'include/drm/amdgpu_drm.h', 'include/drm/savage_drm.h',
+  'include/drm/sis_drm.h', 'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h',
+  'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h',
+  subdir : 'libdrm',
+)
+if with_vmwgfx
+  install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm')
+endif
+
+pkg.generate(
+  name : 'libdrm',
+  libraries : libdrm,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  description : 'Userspace interface to kernel DRM services',
+)
+ 
+if with_libkms
+  subdir('libkms')
+endif
+if with_intel
+  subdir('intel')
+endif
+if with_nouveau
+  subdir('nouveau')
+endif
+if with_radeon
+  subdir('radeon')
+endif
+if with_amdgpu
+  subdir('amdgpu')
+endif
+if with_omap
+  subdir('omap')
+endif
+if with_exynos
+  subdir('exynos')
+endif
+if with_freedreno
+  subdir('freedreno')
+endif
+if with_tegra
+  subdir('tegra')
+endif
+if with_vc4
+  subdir('vc4')
+endif
+if with_etnaviv
+  subdir('etnaviv')
+endif
+if with_man_pages
+  subdir('man')
+endif
+subdir('data')
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..8af33f1
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,143 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+option(
+  'libkms',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : 'Build libkms mm abstraction library.',
+)
+option(
+  'intel',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for Intel's KMS API.''',
+)
+option(
+  'radeon',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for radeons's KMS API.''',
+)
+option(
+  'amdgpu',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for amdgpu's KMS API.''',
+)
+option(
+  'nouveau',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for nouveau's KMS API.''',
+)
+option(
+  'vmwgfx',
+  type : 'combo',
+  value : 'true',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for vmgfx's KMS API.''',
+)
+option(
+  'omap',
+  type : 'combo',
+  value : 'false',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for OMAP's experimental KMS API.''',
+)
+option(
+  'exynos',
+  type : 'combo',
+  value : 'false',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for EXYNOS's experimental KMS API.''',
+)
+option(
+  'freedreno',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for freedreno's KMS API.''',
+)
+option(
+  'tegra',
+  type : 'combo',
+  value : 'false',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for Tegra's experimental KMS API.''',
+)
+option(
+  'vc4',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for vc4's KMS API.''',
+)
+option(
+  'etnaviv',
+  type : 'combo',
+  value : 'false',
+  choices : ['true', 'false', 'auto'],
+  description : '''Enable support for etnaviv's experimental KMS API.''',
+)
+option(
+  'cairo-tests',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : 'Enable support for Cairo rendering in tests.',
+)
+option(
+  'man-pages',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : 'Enable manpage generation and installation.',
+)
+option(
+  'valgrind',
+  type : 'combo',
+  value : 'auto',
+  choices : ['true', 'false', 'auto'],
+  description : 'Build libdrm with valgrind support.',
+)
+option(
+  'freedreno-kgsl',
+  type : 'boolean',
+  value : false,
+  description : 'Enable support for freedreno to use downstream android kernel API.',
+)
+option(
+  'install-test-programs',
+  type : 'boolean',
+  value : false,
+  description : 'Install test programs.',
+)
+option(
+  'udev',
+  type : 'boolean',
+  value : false,
+  description : 'Enable support for using udev instead of mknod.',
+)
diff --git a/nouveau/meson.build b/nouveau/meson.build
new file mode 100644
index 0000000..bfecf84
--- /dev/null
+++ b/nouveau/meson.build
@@ -0,0 +1,58 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+libdrm_nouveau = shared_library(
+  'drm_nouveau',
+  [files( 'nouveau.c', 'pushbuf.c', 'bufctx.c', 'abi16.c'), config_file],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_threads,
+  version : '2.0.0',
+  install : true,
+)
+
+ext_libdrm_nouveau = declare_dependency(
+  link_with : [libdrm, libdrm_nouveau],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('nouveau.h', subdir : 'libdrm/nouveau')
+install_headers(
+  'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h',
+  'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h',
+  subdir : 'libdrm/nouveau/nvif'
+)
+
+pkg.generate(
+  name : 'libdrm_nouveau',
+  libraries : libdrm_nouveau,
+  subdirs : ['.', 'nouveau'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to nouveau kernel DRM services',
+)
+
+test(
+  'nouveau-symbol-check',
+  prog_bash,
+  args : [files('nouveau-symbol-check'), libdrm_nouveau]
+)
diff --git a/omap/meson.build b/omap/meson.build
new file mode 100644
index 0000000..1881087
--- /dev/null
+++ b/omap/meson.build
@@ -0,0 +1,53 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_omap = shared_library(
+  'drm_omap',
+  [files('omap_drm.c'), config_file],
+  include_directories : [inc_root, inc_drm],
+  c_args : warn_c_args,
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.0',
+  install : true,
+)
+
+ext_libdrm_omap = declare_dependency(
+  link_with : [libdrm, libdrm_omap],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('omap_drmif.h', subdir : 'libdrm')
+install_headers('omap_drm.h', subdir : 'omap')
+
+pkg.generate(
+  name : 'libdrm_omap',
+  libraries : libdrm_omap,
+  subdirs : ['.', 'libdrm', 'omap'],
+  version : '0.6',
+  requires_private : 'libdrm',
+  description : 'Userspace interface to omap kernel DRM services',
+)
+
+test(
+  'omap-symbol-check',
+  prog_bash,
+  args : [files('omap-symbol-check'), libdrm_omap]
+)
diff --git a/radeon/meson.build b/radeon/meson.build
new file mode 100644
index 0000000..b02166f
--- /dev/null
+++ b/radeon/meson.build
@@ -0,0 +1,63 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+libdrm_radeon = shared_library(
+  'drm_radeon',
+  [
+    files(
+      'radeon_bo_gem.c', 'radeon_cs_gem.c', 'radeon_cs_space.c', 'radeon_bo.c',
+      'radeon_cs.c', 'radeon_surface.c',
+    ),
+    config_file,
+  ],
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  version : '1.0.1',
+  install : true,
+)
+
+ext_libdrm_radeon = declare_dependency(
+  link_with : [libdrm, libdrm_radeon],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers(
+	'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h',
+	'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h',
+  subdir : 'libdrm'
+)
+
+pkg.generate(
+  name : 'libdrm_radeon',
+  libraries : libdrm_radeon,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to kernel DRM services for radeon',
+)
+
+test(
+  'radeon-symbol-check',
+  prog_bash,
+  args : [files('radeon-symbol-check'), libdrm_radeon]
+)
diff --git a/tegra/meson.build b/tegra/meson.build
new file mode 100644
index 0000000..99fdd19
--- /dev/null
+++ b/tegra/meson.build
@@ -0,0 +1,52 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libdrm_tegra = shared_library(
+  'drm_tegra',
+  [files('tegra.c'), config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : [dep_pthread_stubs],
+  c_args : warn_c_args,
+  version : '0.0.0',
+  install : true,
+)
+
+ext_libdrm_tegra = declare_dependency(
+  link_with : [libdrm, libdrm_tegra],
+  include_directories : [inc_drm, include_directories('.')],
+)
+
+install_headers('tegra.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_tegra',
+  libraries : libdrm_tegra,
+  subdirs : ['.', 'libdrm'],
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to Tegra kernel DRM services',
+)
+
+test(
+  'tegra-symbol-check',
+  prog_bash,
+  args : [files('tegra-symbol-check'), libdrm_tegra]
+)
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
new file mode 100644
index 0000000..4c1237c
--- /dev/null
+++ b/tests/amdgpu/meson.build
@@ -0,0 +1,34 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+if dep_cunit.found()
+  amdgpu_test = executable(
+    'amdgpu_test',
+    files(
+      'amdgpu_test.c', 'basic_tests.c', 'bo_tests.c', 'cs_tests.c',
+      'vce_tests.c', 'uvd_enc_tests.c', 'vcn_tests.c', 'deadlock_tests.c',
+      'vm_tests.c',
+    ),
+    dependencies : [dep_cunit, dep_threads],
+    include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')],
+    link_with : [libdrm, libdrm_amdgpu],
+    install : with_install_tests,
+  )
+endif
diff --git a/tests/etnaviv/meson.build b/tests/etnaviv/meson.build
new file mode 100644
index 0000000..8b4a3cf
--- /dev/null
+++ b/tests/etnaviv/meson.build
@@ -0,0 +1,45 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_etnaviv_tests = [inc_root, inc_drm, include_directories('../../etnaviv')]
+
+etnaviv_2d_test = executable(
+  'etnaviv_2d_test',
+  files('etnaviv_2d_test.c', 'write_bmp.c'),
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
+
+etnaviv_cmd_stream_test = executable(
+  'etnaviv_cmd_stream_test',
+  files('etnaviv_cmd_stream_test.c'),
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
+
+etnaviv_bo_cache_test = executable(
+  'etnaviv_bo_cache_test',
+  files('etnaviv_bo_cache_test.c'),
+  include_directories : inc_etnaviv_tests,
+  link_with : [libdrm, libdrm_etnaviv],
+  install : with_install_tests,
+)
diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
new file mode 100644
index 0000000..940c3ce
--- /dev/null
+++ b/tests/exynos/meson.build
@@ -0,0 +1,54 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_exynos = include_directories('../../exynos')
+
+if with_libkms
+  exynos_fimg2d_test = executable(
+    'exynos_fimg2d_test',
+    files('exynos_fimg2d_test.c'),
+    c_args : warn_c_args,
+    include_directories : [inc_root, inc_drm, inc_exynos,
+                           include_directories('../../libkms')],
+    link_with : [libdrm, libkms, libdrm_exynos],
+    dependencies : dep_threads,
+    install : with_install_tests,
+  )
+endif
+
+exynos_fimg2d_perf = executable(
+  'exynos_fimg2d_perf',
+  files('exynos_fimg2d_perf.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm, inc_exynos],
+  link_with : [libdrm, libdrm_exynos],
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
+
+exynos_fimg2d_event = executable(
+  'exynos_fimg2d_event',
+  files('exynos_fimg2d_event.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_drm, inc_exynos],
+  link_with : [libdrm, libdrm_exynos],
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
diff --git a/tests/kms/meson.build b/tests/kms/meson.build
new file mode 100644
index 0000000..1f7f724
--- /dev/null
+++ b/tests/kms/meson.build
@@ -0,0 +1,49 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+libkms_test = static_library(
+  'kms-test',
+  files(
+    'libkms-test-crtc.c', 'libkms-test-device.c', 'libkms-test-framebuffer.c',
+    'libkms-test-plane.c', 'libkms-test-screen.c',
+  ),
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+kms_steal_crtc = executable(
+  'kms-steal-crtc',
+  files('kms-steal-crtc.c'),
+  dependencies : dep_cairo,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libkms_test, libutil],
+  install : with_install_tests,
+)
+
+kms_universal_planes = executable(
+  'kms-universal-planes',
+  files('kms-universal-planes.c'),
+  dependencies : dep_cairo,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libkms_test],
+  install : with_install_tests,
+)
diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
new file mode 100644
index 0000000..a47d495
--- /dev/null
+++ b/tests/kmstest/meson.build
@@ -0,0 +1,30 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+kmstest = executable(
+  'kmstest',
+  files('main.c'),
+  c_args : warn_c_args,
+  include_directories : [
+    inc_root, inc_tests, include_directories('../../libkms'), inc_drm,
+  ],
+  link_with : [libutil, libkms, libdrm],
+  install : with_install_tests,
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..fdf950b
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,86 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_tests = include_directories('.')
+
+subdir('util')
+subdir('kms')
+subdir('modeprint')
+subdir('proptest')
+subdir('modetest')
+subdir('vbltest')
+if with_libkms
+  subdir('kmstest')
+endif
+if with_radeon
+  subdir('radeon')
+endif
+if with_amdgpu
+  subdir('amdgpu')
+endif
+if with_exynos
+  subdir('exynos')
+endif
+if with_tegra
+  subdir('tegra')
+endif
+if with_etnaviv
+  subdir('etnaviv')
+endif
+if with_nouveau
+  subdir('nouveau')
+endif
+
+drmsl = executable(
+  'drmsl',
+  files('drmsl.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+hash = executable(
+  'hash',
+  files('hash.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+random = executable(
+  'random',
+  files('random.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+drmdevice = executable(
+  'drmdevice',
+  files('drmdevice.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
+
+test('random', random, timeout : 240)
+test('hash', hash)
+test('drmsl', drmsl)
+test('drmdevice', drmdevice)
diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
new file mode 100644
index 0000000..5f0eb24
--- /dev/null
+++ b/tests/modeprint/meson.build
@@ -0,0 +1,29 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+modeprint = executable(
+  'modeprint',
+  files('modeprint.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_threads,
+  install : with_install_tests,
+)
diff --git a/tests/modetest/meson.build b/tests/modetest/meson.build
new file mode 100644
index 0000000..2a08184
--- /dev/null
+++ b/tests/modetest/meson.build
@@ -0,0 +1,29 @@
+# Copyright © 2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+modetest = executable(
+  'modetest',
+  files('buffers.c', 'cursor.c', 'modetest.c'),
+  c_args : [warn_c_args, '-Wno-pointer-arith'],
+  include_directories : [inc_root, inc_tests, inc_drm],
+  dependencies : [dep_threads, dep_cairo],
+  link_with : [libdrm, libutil],
+  install : with_install_tests,
+)
diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
new file mode 100644
index 0000000..f5d73c1
--- /dev/null
+++ b/tests/nouveau/meson.build
@@ -0,0 +1,30 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+threaded = executable(
+  'threaded',
+  files('threaded.c'),
+  dependencies : [dep_dl, dep_threads],
+  include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
+  link_with : [libdrm, libdrm_nouveau],
+  c_args : warn_c_args,
+)
+
+test('threaded', threaded)
diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
new file mode 100644
index 0000000..22d7473
--- /dev/null
+++ b/tests/proptest/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+proptest = executable(
+  'proptest',
+  files('proptest.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libdrm, libutil],
+  install : with_install_tests,
+)
diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
new file mode 100644
index 0000000..9e4f916
--- /dev/null
+++ b/tests/radeon/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+radeon_ttm = executable(
+  'radeon_ttm',
+  files('rbo.c', 'radeon_ttm.c'),
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  c_args : warn_c_args,
+)
diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
new file mode 100644
index 0000000..9c74ac4
--- /dev/null
+++ b/tests/tegra/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+openclose = executable(
+  'openclose',
+  files('openclose.c'),
+  include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
+  c_args : warn_c_args,
+  link_with : [libdrm, libdrm_tegra],
+)
diff --git a/tests/util/meson.build b/tests/util/meson.build
new file mode 100644
index 0000000..7fa1a4b
--- /dev/null
+++ b/tests/util/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+libutil = static_library(
+  'util',
+  [files('format.c', 'kms.c', 'pattern.c'), config_file],
+  include_directories : [inc_root, inc_drm],
+  link_with : libdrm,
+  dependencies : dep_cairo
+)
diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
new file mode 100644
index 0000000..ae52ab8
--- /dev/null
+++ b/tests/vbltest/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017-2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+vbltest = executable(
+  'vbltest',
+  files('vbltest.c'),
+  c_args : warn_c_args,
+  include_directories : [inc_root, inc_tests, inc_drm],
+  link_with : [libdrm, libutil],
+  install : with_install_tests,
+)
diff --git a/vc4/meson.build b/vc4/meson.build
new file mode 100644
index 0000000..0136987
--- /dev/null
+++ b/vc4/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm')
+
+pkg.generate(
+  name : 'libdrm_vc4',
+  version : meson.project_version(),
+  requires_private : 'libdrm',
+  description : 'Userspace interface to vc4 kernel DRM services',
+)
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 2/3] autotools: Include meson.build files in tarball
  2018-01-05 20:00 ` [PATCH 0/3] Meson build system Dylan Baker
  2018-01-05 20:00   ` [PATCH 1/3] Add meson " Dylan Baker
@ 2018-01-05 20:00   ` Dylan Baker
  2018-01-12 17:12     ` [Mesa-dev] " Eric Engestrom
  2018-01-05 20:01   ` [PATCH 3/3] README: Add note about meson Dylan Baker
  2018-01-09  0:14   ` [PATCH 0/3] Meson build system Dylan Baker
  3 siblings, 1 reply; 29+ messages in thread
From: Dylan Baker @ 2018-01-05 20:00 UTC (permalink / raw)
  To: mesa-dev, dri-devel; +Cc: Dylan Baker

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
 Makefile.am | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 7b86214..66f70ca 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -135,7 +135,35 @@ if HAVE_VMWGFX
 klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
 endif
 
-EXTRA_DIST = include/drm/README
+EXTRA_DIST = \
+	include/drm/README \
+	amdgpu/meson.build \
+	etnaviv/meson.build \
+	exynos/meson.build \
+	freedreno/meson.build \
+	intel/meson.build \
+	libkms/meson.build \
+	man/meson.build \
+	nouveau/meson.build \
+	omap/meson.build \
+	radeon/meson.build \
+	tests/amdgpu/meson.build \
+	tests/etnaviv/meson.build \
+	tests/exynos/meson.build \
+	tests/kms/meson.build \
+	tests/kmstest/meson.build \
+	tests/modeprint/meson.build \
+	tests/nouveau/meson.build \
+	tests/proptest/meson.build \
+	tests/radeon/meson.build \
+	tests/tegra/meson.build \
+	tests/util/meson.build \
+	tests/vbltest/meson.build \
+	tests/meson.build \
+	vc4/meson.build \
+	data/meson.build \
+	meson.build \
+	meson_options.txt
 
 copy-headers :
 	cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 3/3] README: Add note about meson
  2018-01-05 20:00 ` [PATCH 0/3] Meson build system Dylan Baker
  2018-01-05 20:00   ` [PATCH 1/3] Add meson " Dylan Baker
  2018-01-05 20:00   ` [PATCH 2/3] autotools: Include meson.build files in tarball Dylan Baker
@ 2018-01-05 20:01   ` Dylan Baker
  2018-01-12 17:12     ` Eric Engestrom
  2018-01-09  0:14   ` [PATCH 0/3] Meson build system Dylan Baker
  3 siblings, 1 reply; 29+ messages in thread
From: Dylan Baker @ 2018-01-05 20:01 UTC (permalink / raw)
  To: mesa-dev, dri-devel; +Cc: Dylan Baker

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
 README | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 26cab9d..f3df9ac 100644
--- a/README
+++ b/README
@@ -15,9 +15,27 @@ with an older kernel.
 Compiling
 ---------
 
-libdrm  is  a  standard  autotools  package and  follows  the  normal
-configure, build  and install steps.   The first step is  to configure
-the package, which is done by running the configure shell script:
+libdrm has two build systems, a legacy autotools build system, and a newer
+meson build system. The meson build system is much faster, and offers a
+slightly different interface, but otherwise provides an equivalent feature set.
+
+To use it:
+
+    meson builddir/
+
+By default this will install into /usr/local, you can change your prefix
+with --prefix=/usr (or `meson configure builddir/ -Dprefix=/usr` after 
+the initial meson setup).
+
+Then use ninja to build and install:
+
+    ninja -C builddir/ install
+
+If you are installing into a system location you will need to run install
+separately, and as root.
+
+
+Alternatively you can invoke autotools configure:
 
 	./configure
 
-- 
git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 0/3] Meson build system
  2018-01-05 20:00 ` [PATCH 0/3] Meson build system Dylan Baker
                     ` (2 preceding siblings ...)
  2018-01-05 20:01   ` [PATCH 3/3] README: Add note about meson Dylan Baker
@ 2018-01-09  0:14   ` Dylan Baker
  2018-01-12 17:15     ` [Mesa-dev] " Eric Engestrom
  3 siblings, 1 reply; 29+ messages in thread
From: Dylan Baker @ 2018-01-09  0:14 UTC (permalink / raw)
  To: dri-devel, mesa-dev; +Cc: Eric Engestrom


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

I forgot to CC you on this like you asked,

Dylan

Quoting Dylan Baker (2018-01-05 12:00:57)
> This is a fifth iteration of the meson build system for libdrm. This
> version is significantly cleaned up from the last version and uses a
> style more like the build system in mesa.
> 
> It builds all of the drivers and tests, and the tests can be run via
> `ninja test`.
> 
> It has support for being used as a wrapped dependency with ext_foo
> variables (I have a branch of mesa that will build this code as a wrap,
> which has also been useful for testing). This means it can be used to
> build a mesa that requires a newer libdrm than the system provides
> (which can be especially useful if you can't install packages on that
> system), or to build libdrm support that your distro doesn't ship (like
> arm only drivers on x86), cross compiling, and for testing.
> 
> This has been build tested and mesa has been compiled against it, but
> only minimal functional testing has been done, since I only have i965
> machines, and i965 only uses libdrm lightly.
> 
> Some reviewers of the previous versions have done some additional
> testing.
> 
> Changes since v3:
>   - Fix freedreno kgsl check
>   - Fix kgls -> kgsl typo
>   - standardize meson options to use only `-` and not `_`
>   - fix typo radoen -> radeon
>   - add help messages to options
>   - fix typo in kms-universal-planes binary
>   - build and install modetest (this was missed in the first version for
>     some reason)
>   - install amdgpu.ids as 644 instead of 444
> 
> Changes since v4:
>   - Fix minor nits in options descriptions (Igor)
>   - Fix editorconfig settings
>   - Fix amdgpu.ids searh path
>   - Style nits for Eric E.
>   - Remove more tabs
>   - Ensure that 1/0 defines are always defined, instead of only when
>     their value is 1
>   - Don't add header files into file lists. (Meson figures out header
>     dependencies automatically using graphs that the compiler generates
>     during compilation)
>   - Don't assign file lists to variables when possible. In a few cases
>     files need to be conditionally added, but if we're not in one of
>     those cases just put the lists directly in the exectuable or library
>     declaration.
> 
> Dylan Baker (3):
>   Add meson build system
>   autotools: Include meson.build files in tarball
>   README: Add note about meson
> 
>  .editorconfig               |   4 +-
>  Makefile.am                 |  30 ++-
>  README                      |  24 +-
>  amdgpu/.editorconfig        |   4 +-
>  amdgpu/meson.build          |  65 +++++++-
>  data/meson.build            |  27 +++-
>  etnaviv/meson.build         |  59 ++++++-
>  exynos/meson.build          |  53 +++++-
>  freedreno/meson.build       |  76 ++++++++-
>  intel/meson.build           | 105 +++++++++++-
>  libkms/meson.build          |  74 ++++++++-
>  man/meson.build             |  67 +++++++-
>  meson.build                 | 364 +++++++++++++++++++++++++++++++++++++-
>  meson_options.txt           | 143 +++++++++++++++-
>  nouveau/meson.build         |  58 ++++++-
>  omap/meson.build            |  53 +++++-
>  radeon/meson.build          |  63 ++++++-
>  tegra/meson.build           |  52 +++++-
>  tests/amdgpu/meson.build    |  34 +++-
>  tests/etnaviv/meson.build   |  45 +++++-
>  tests/exynos/meson.build    |  54 +++++-
>  tests/kms/meson.build       |  49 +++++-
>  tests/kmstest/meson.build   |  30 +++-
>  tests/meson.build           |  86 +++++++++-
>  tests/modeprint/meson.build |  29 +++-
>  tests/modetest/meson.build  |  29 +++-
>  tests/nouveau/meson.build   |  30 +++-
>  tests/proptest/meson.build  |  28 +++-
>  tests/radeon/meson.build    |  27 +++-
>  tests/tegra/meson.build     |  27 +++-
>  tests/util/meson.build      |  28 +++-
>  tests/vbltest/meson.build   |  28 +++-
>  vc4/meson.build             |  28 +++-
>  33 files changed, 1869 insertions(+), 4 deletions(-)
>  create mode 100644 amdgpu/meson.build
>  create mode 100644 data/meson.build
>  create mode 100644 etnaviv/meson.build
>  create mode 100644 exynos/meson.build
>  create mode 100644 freedreno/meson.build
>  create mode 100644 intel/meson.build
>  create mode 100644 libkms/meson.build
>  create mode 100644 man/meson.build
>  create mode 100644 meson.build
>  create mode 100644 meson_options.txt
>  create mode 100644 nouveau/meson.build
>  create mode 100644 omap/meson.build
>  create mode 100644 radeon/meson.build
>  create mode 100644 tegra/meson.build
>  create mode 100644 tests/amdgpu/meson.build
>  create mode 100644 tests/etnaviv/meson.build
>  create mode 100644 tests/exynos/meson.build
>  create mode 100644 tests/kms/meson.build
>  create mode 100644 tests/kmstest/meson.build
>  create mode 100644 tests/meson.build
>  create mode 100644 tests/modeprint/meson.build
>  create mode 100644 tests/modetest/meson.build
>  create mode 100644 tests/nouveau/meson.build
>  create mode 100644 tests/proptest/meson.build
>  create mode 100644 tests/radeon/meson.build
>  create mode 100644 tests/tegra/meson.build
>  create mode 100644 tests/util/meson.build
>  create mode 100644 tests/vbltest/meson.build
>  create mode 100644 vc4/meson.build
> 
> base-commit: 831036a6f62005da9fb4a75fe043bd96ce672d27
> -- 
> git-series 0.9.1

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlpUCXAACgkQCJ4WlhQG
iO8RXwgAnOeuYy1Rp7y5jPhf4nOlXycZfjOjzQytJAg+zWndIFiyy9f6v62qR5LA
2sdbzeCZrleMfnJpH6MlU32WGpdeLgAtUI/Ozt1r4LUZ2kinVUhksFwSMfpUS5d/
q7cOFnUGqJrgwKt/uiRafepVrp3cLkkohWmN/2Y3qOaSUw1s1DNcNW4Ow6DY3KDs
JuGOZ+qsp+Fhj1C5u/bvpZZDI0ojYLkaA8VZsoUWSxk0u+cma6bzEBv6q9mxKJMS
9DKfyLvDwfCDKo01p0x9AaiRGDfTFBEYTDPj/kTIKYZ3iaBT+G8FZ7dds7tojQMT
kL6lIcgLbT/7oPTqjYdZp0SZyee5/A==
=NAqq
-----END PGP SIGNATURE-----

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/3] Add meson build system
  2018-01-05 20:00   ` [PATCH 1/3] Add meson " Dylan Baker
@ 2018-01-12 17:10     ` Eric Engestrom
  0 siblings, 0 replies; 29+ messages in thread
From: Eric Engestrom @ 2018-01-12 17:10 UTC (permalink / raw)
  To: Dylan Baker; +Cc: mesa-dev, dri-devel

On Friday, 2018-01-05 12:00:58 -0800, Dylan Baker wrote:
> This patch adds a complete meson build system, including tests and
> install. It has the necessary hooks to allow it be used as a subproject
> for other meson based builds such as mesa.
> 
> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
> Reviewed-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
> ---
>  .editorconfig               |   4 +-
>  amdgpu/.editorconfig        |   4 +-
>  amdgpu/meson.build          |  65 +++++++-
>  data/meson.build            |  27 +++-
>  etnaviv/meson.build         |  59 ++++++-
>  exynos/meson.build          |  53 +++++-
>  freedreno/meson.build       |  76 ++++++++-
>  intel/meson.build           | 105 +++++++++++-
>  libkms/meson.build          |  74 ++++++++-
>  man/meson.build             |  67 +++++++-
>  meson.build                 | 364 +++++++++++++++++++++++++++++++++++++-
>  meson_options.txt           | 143 +++++++++++++++-
>  nouveau/meson.build         |  58 ++++++-
>  omap/meson.build            |  53 +++++-
>  radeon/meson.build          |  63 ++++++-
>  tegra/meson.build           |  52 +++++-
>  tests/amdgpu/meson.build    |  34 +++-
>  tests/etnaviv/meson.build   |  45 +++++-
>  tests/exynos/meson.build    |  54 +++++-
>  tests/kms/meson.build       |  49 +++++-
>  tests/kmstest/meson.build   |  30 +++-
>  tests/meson.build           |  86 +++++++++-
>  tests/modeprint/meson.build |  29 +++-
>  tests/modetest/meson.build  |  29 +++-
>  tests/nouveau/meson.build   |  30 +++-
>  tests/proptest/meson.build  |  28 +++-
>  tests/radeon/meson.build    |  27 +++-
>  tests/tegra/meson.build     |  27 +++-
>  tests/util/meson.build      |  28 +++-
>  tests/vbltest/meson.build   |  28 +++-
>  vc4/meson.build             |  28 +++-
>  31 files changed, 1819 insertions(+)
>  create mode 100644 amdgpu/meson.build
>  create mode 100644 data/meson.build
>  create mode 100644 etnaviv/meson.build
>  create mode 100644 exynos/meson.build
>  create mode 100644 freedreno/meson.build
>  create mode 100644 intel/meson.build
>  create mode 100644 libkms/meson.build
>  create mode 100644 man/meson.build
>  create mode 100644 meson.build
>  create mode 100644 meson_options.txt
>  create mode 100644 nouveau/meson.build
>  create mode 100644 omap/meson.build
>  create mode 100644 radeon/meson.build
>  create mode 100644 tegra/meson.build
>  create mode 100644 tests/amdgpu/meson.build
>  create mode 100644 tests/etnaviv/meson.build
>  create mode 100644 tests/exynos/meson.build
>  create mode 100644 tests/kms/meson.build
>  create mode 100644 tests/kmstest/meson.build
>  create mode 100644 tests/meson.build
>  create mode 100644 tests/modeprint/meson.build
>  create mode 100644 tests/modetest/meson.build
>  create mode 100644 tests/nouveau/meson.build
>  create mode 100644 tests/proptest/meson.build
>  create mode 100644 tests/radeon/meson.build
>  create mode 100644 tests/tegra/meson.build
>  create mode 100644 tests/util/meson.build
>  create mode 100644 tests/vbltest/meson.build
>  create mode 100644 vc4/meson.build
> 
> diff --git a/.editorconfig b/.editorconfig
> index 893b7be..29b4f39 100644
> --- a/.editorconfig
> +++ b/.editorconfig
> @@ -17,3 +17,7 @@ indent_style = tab
>  [*.m4]
>  indent_style = space
>  indent_size = 2
> +
> +[{meson.build,meson_options.txt}]
> +indent_style = space
> +indent_size = 2
> diff --git a/amdgpu/.editorconfig b/amdgpu/.editorconfig
> index 2528d67..426273f 100644
> --- a/amdgpu/.editorconfig
> +++ b/amdgpu/.editorconfig
> @@ -7,3 +7,7 @@ indent_style = tab
>  indent_size = 8
>  tab_width = 8
>  insert_final_newline = true
> +
> +[meson.build]
> +indent_style = space
> +indent_size = 2
> diff --git a/amdgpu/meson.build b/amdgpu/meson.build
> new file mode 100644
> index 0000000..55ab9d1
> --- /dev/null
> +++ b/amdgpu/meson.build
> @@ -0,0 +1,65 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +
> +datadir_amdgpu = join_paths(get_option('datadir'), 'libdrm', 'amdgpu.ids')
> +
> +libdrm_amdgpu = shared_library(
> +  'drm_amdgpu',
> +  [
> +    files(
> +      'amdgpu_asic_id.c', 'amdgpu_bo.c', 'amdgpu_cs.c', 'amdgpu_device.c',
> +      'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'util_hash.c',
> +      'util_hash_table.c',
> +    ),
> +    config_file,
> +  ],
> +  c_args : [
> +    warn_c_args,
> +    '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(datadir_amdgpu),
> +  ],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : dep_pthread_stubs,
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +install_headers('amdgpu.h', subdir : 'libdrm')
> +
> +pkg.generate(
> +  name : 'libdrm_amdgpu',
> +  libraries : libdrm_amdgpu,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to kernel DRM services for amdgpu',
> +)
> +
> +ext_libdrm_amdgpu = declare_dependency(
> +  link_with : [libdrm, libdrm_amdgpu],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +test(
> +  'amdgpu-symbol-check',
> +  prog_bash,
> +  args : [files('amdgpu-symbol-check'), libdrm_amdgpu]
> +)
> diff --git a/data/meson.build b/data/meson.build
> new file mode 100644
> index 0000000..9c26b66
> --- /dev/null
> +++ b/data/meson.build
> @@ -0,0 +1,27 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +if with_amdgpu
> +  install_data(
> +    'amdgpu.ids',
> +    install_mode : 'rw-r--r--',
> +    install_dir : datadir_amdgpu,
> +  )
> +endif
> diff --git a/etnaviv/meson.build b/etnaviv/meson.build
> new file mode 100644
> index 0000000..1767733
> --- /dev/null
> +++ b/etnaviv/meson.build
> @@ -0,0 +1,59 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +
> +libdrm_etnaviv = shared_library(
> +  'drm_etnaviv',
> +  [
> +    files(
> +      'etnaviv_device.c', 'etnaviv_gpu.c', 'etnaviv_bo.c', 'etnaviv_bo_cache.c',
> +      'etnaviv_perfmon.c', 'etnaviv_pipe.c', 'etnaviv_cmd_stream.c',
> +    ),
> +    config_file
> +  ],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +  dependencies : [dep_pthread_stubs, dep_rt],
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +install_headers('etnaviv_drmif.h', subdir : 'libdrm')
> +
> +pkg.generate(
> +  name : 'libdrm_etnaviv',
> +  libraries : libdrm_etnaviv,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to Tegra kernel DRM services',
> +)
> +
> +ext_libdrm_etnaviv = declare_dependency(
> +  link_with : [libdrm, libdrm_etnaviv],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +test(
> +  'etnaviv-symbol-check',
> +  prog_bash,
> +  args : [files('etnaviv-symbol-check'), libdrm_etnaviv]
> +)
> diff --git a/exynos/meson.build b/exynos/meson.build
> new file mode 100644
> index 0000000..c96ad4e
> --- /dev/null
> +++ b/exynos/meson.build
> @@ -0,0 +1,53 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libdrm_exynos = shared_library(
> +  'drm_exynos',
> +  [files('exynos_drm.c', 'exynos_fimg2d.c'), config_file],
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +install_headers('exynos_drmif.h', subdir : 'libdrm')
> +install_headers('exynos_drm.h', 'exynos_fimg2d.h', subdir : 'exynos')
> +
> +ext_libdrm_exynos = declare_dependency(
> +  link_with : [libdrm, libdrm_exynos],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_exynos',
> +  libraries : libdrm_exynos,
> +  subdirs : ['.', 'libdrm', 'exynos'],
> +  version : '0.7',
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to exynos kernel DRM services',
> +)
> +
> +test(
> +  'exynos-symbol-check',
> +  prog_bash,
> +  args : [files('exynos-symbol-check'), libdrm_exynos]
> +)
> diff --git a/freedreno/meson.build b/freedreno/meson.build
> new file mode 100644
> index 0000000..b4035e1
> --- /dev/null
> +++ b/freedreno/meson.build
> @@ -0,0 +1,76 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +files_freedreno = files(
> +  'freedreno_device.c',
> +  'freedreno_pipe.c',
> +  'freedreno_ringbuffer.c',
> +  'freedreno_bo.c',
> +  'freedreno_bo_cache.c',
> +  'msm/msm_bo.c',
> +  'msm/msm_device.c',
> +  'msm/msm_pipe.c',
> +  'msm/msm_ringbuffer.c',
> +)
> +
> +if with_freedreno_kgsl
> +  files_freedreno += files(
> +    'kgsl/kgsl_bo.c',
> +    'kgsl/kgsl_device.c',
> +    'kgsl/kgsl_pipe.c',
> +    'kgsl/kgsl_ringbuffer.c',
> +  )
> +endif
> +
> +libdrm_freedreno = shared_library(
> +  'drm_freedreno',
> +  [files_freedreno, config_file],
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm],
> +  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
> +  link_with : libdrm,
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_freedreno = declare_dependency(
> +  link_with : [libdrm, libdrm_freedreno],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers(
> +  'freedreno_drmif.h', 'freedreno_ringbuffer.h',
> +  subdir : 'freedreno'
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_freedreno',
> +  libraries : libdrm_freedreno,
> +  subdirs : ['.', 'libdrm', 'freedreno'],
> +  version : '0.7',
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to freedreno kernel DRM services',
> +)
> +
> +test(
> +  'freedreno-symbol-check',
> +  prog_bash,
> +  args : [files('freedreno-symbol-check'), libdrm_freedreno]
> +)
> diff --git a/intel/meson.build b/intel/meson.build
> new file mode 100644
> index 0000000..ad87727
> --- /dev/null
> +++ b/intel/meson.build
> @@ -0,0 +1,105 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libdrm_intel = shared_library(
> +  'drm_intel',
> +  [
> +    files(
> +      'intel_bufmgr.c', 'intel_bufmgr_fake.c', 'intel_bufmgr_gem.c',
> +      'intel_decode.c', 'mm.c',
> +    ),
> +    config_file,
> +  ],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
> +  c_args : warn_c_args,
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_intel = declare_dependency(
> +  link_with : [libdrm, libdrm_intel],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers(
> +  'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h',
> +  subdir : 'libdrm',
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_intel',
> +  libraries : libdrm_intel,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires : 'libdrm',
> +  description : 'Userspace interface to intel kernel DRM services',
> +)
> +
> +test_decode = executable(
> +  'test_decode',
> +  files('test_decode.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : [libdrm, libdrm_intel],
> +  c_args : warn_c_args,
> +)
> +
> +test(
> +  'gen4-3d.batch',
> +  prog_bash,
> +  args : files('tests/gen4-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen45-3d.batch',
> +  prog_bash,
> +  args : files('tests/gm45-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen5-3d.batch',
> +  prog_bash,
> +  args : files('tests/gen5-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen6-3d.batch',
> +  prog_bash,
> +  args : files('tests/gen6-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen7-3d.batch',
> +  prog_bash,
> +  args : files('tests/gen7-3d.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'gen7-2d-copy.batch',
> +  prog_bash,
> +  args : files('tests/gen7-2d-copy.batch.sh'),
> +  workdir : meson.current_build_dir(),
> +)
> +test(
> +  'intel-symbol-check',
> +  prog_bash,
> +  args : [files('intel-symbol-check'), libdrm_intel]
> +)
> diff --git a/libkms/meson.build b/libkms/meson.build
> new file mode 100644
> index 0000000..9eff431
> --- /dev/null
> +++ b/libkms/meson.build
> @@ -0,0 +1,74 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libkms_include = [inc_root, inc_drm]
> +files_libkms = files(
> +  'linux.c',
> +  'dumb.c',
> +  'api.c',
> +)
> +if with_vmwgfx
> +  files_libkms += files('vmwgfx.c')
> +endif
> +if with_intel
> +  files_libkms += files('intel.c')
> +endif
> +if with_nouveau
> +  files_libkms += files('nouveau.c')
> +endif
> +if with_radeon
> +  files_libkms += files('radeon.c')
> +endif
> +if with_exynos
> +  files_libkms += files('exynos.c')
> +  libkms_include += include_directories('../exynos')
> +endif
> +
> +libkms = shared_library(
> +  'kms',
> +  [files_libkms, config_file],
> +  c_args : warn_c_args,
> +  include_directories : libkms_include,
> +  link_with : libdrm,
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +ext_libkms = declare_dependency(
> +  link_with : [libdrm, libkms],
> +  include_directories : [libkms_include],
> +)
> +
> +install_headers('libkms.h', subdir : 'libkms')
> +
> +pkg.generate(
> +  name : 'libkms',
> +  libraries : libkms,
> +  subdirs : ['libkms'],
> +  version : '1.0.0',
> +  requires_private : 'libdrm',
> +  description : 'Library that abstracts away the different mm interfaces for kernel drivers',
> +)
> +
> +test(
> +  'kms-symbol-check',
> +  prog_bash,
> +  args : [files('kms-symbol-check'), libkms]
> +)
> diff --git a/man/meson.build b/man/meson.build
> new file mode 100644
> index 0000000..45eaeda
> --- /dev/null
> +++ b/man/meson.build
> @@ -0,0 +1,67 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +xsltproc_args = [
> +  '--stringparam', 'man.authors.section.enabled', '0',
> +  '--stringparam', 'man.copyright.section.enabled', '0',
> +  '--stringparam', 'funcsynopsis.style', 'ansi',
> +  '--stringparam', 'man.output.quietly', '1',
> +  '--nonet', manpage_style,
> +]
> +
> +xmls = [
> +  ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'],
> +  ['drmHandleEvent', '3'], ['drmModeGetResources', '3']
> +]
> +foreach x : xmls
> +  m = x[0]
> +  s = x[1]
> +  custom_target(
> +    m,
> +    input : files('@0@.xml'.format(m)),
> +    output : '@0@.@1@'.format(m, s),
> +    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'],
> +    install : true,
> +    install_dir : join_paths(get_option('mandir'), 'man@0@'.format(s)),
> +    build_by_default : true,
> +  )
> +endforeach
> +
> +foreach x : ['drm-mm', 'drm-gem', 'drm-ttm']
> +  gen = custom_target(
> +    'gen-@0@'.format(x),
> +    input : 'drm-memory.xml',
> +    output : '@0@.xml'.format(x),
> +    command : [
> +      prog_sed, '-e', 's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@',
> +      '@INPUT@',
> +    ],
> +    capture : true,
> +  )
> +  custom_target(
> +    '@0@.7'.format(x),
> +    input : gen,
> +    output : '@0@.7'.format(x, '7'),
> +    command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'],
> +    install : true,
> +    install_dir : join_paths(get_option('mandir'), 'man7'),
> +    build_by_default : true,
> +  )
> +endforeach
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 0000000..294fa90
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,364 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +project(
> +  'libdrm',
> +  ['c'],
> +  version : '2.4.89',
> +  license : 'MIT',
> +  meson_version : '>= 0.42',
> +  default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],
> +)
> +
> +pkg = import('pkgconfig')
> +
> +with_udev = get_option('udev')
> +with_freedreno_kgsl = get_option('freedreno-kgsl')
> +with_install_tests = get_option('install-test-programs')
> +with_cairo_tests = get_option('cairo-tests')
> +with_valgrind = get_option('valgrind')
> +
> +config = configuration_data()
> +
> +# TODO: openbsd is guess, the others are correct
> +if ['freebsd', 'dragonfly', 'netbsd', 'openbsd'].contains(host_machine.system())
> +  dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
> +else
> +  dep_pthread_stubs = []
> +endif
> +dep_threads = dependency('threads')
> +
> +cc = meson.get_compiler('c')
> +
> +# Check for atomics
> +intel_atomics = false
> +lib_atomics = false
> +
> +if cc.compiles('''
> +    int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
> +    int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
> +    ''',
> +    name : 'Intel Atomics')
> +  intel_atomics = true
> +  with_atomics = true
> +elif cc.has_header('atomic_ops.h')
> +  lib_atomics = true
> +  with_atomics = true
> +elif cc.has_function('atomic_cas_uint')
> +  with_atomics = true
> +else
> +  with_atomics = false
> +endif
> +
> +config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', intel_atomics)
> +config.set10('HAVE_LIB_ATOMIC_OPS', lib_atomics)
> +
> +with_intel = false
> +_intel = get_option('intel')
> +if _intel != 'false'
> +  if _intel == 'true' and not with_atomics
> +    error('libdrm_intel requires atomics.')
> +  else
> +    with_intel = _intel == 'true' or host_machine.cpu_family().startswith('x86')
> +  endif
> +endif
> +
> +with_radeon = false
> +_radeon = get_option('radeon')
> +if _radeon != 'false'
> +  if _radeon == 'true' and not with_atomics
> +    error('libdrm_radeon requires atomics.')
> +  endif
> +  with_radeon = true
> +endif
> +
> +with_amdgpu = false
> +_amdgpu = get_option('amdgpu')
> +if _amdgpu != 'false'
> +  if _amdgpu == 'true' and not with_atomics
> +    error('libdrm_amdgpu requires atomics.')
> +  endif
> +  with_amdgpu = true
> +endif
> +
> +with_nouveau = false
> +_nouveau = get_option('nouveau')
> +if _nouveau != 'false'
> +  if _nouveau == 'true' and not with_atomics
> +    error('libdrm_nouveau requires atomics.')
> +  endif
> +  with_nouveau = true
> +endif
> +
> +with_vmwgfx = false
> +_vmwgfx = get_option('vmwgfx')
> +if _vmwgfx != 'false'
> +  with_vmwgfx = true
> +endif
> +
> +with_omap = false
> +_omap = get_option('omap')
> +if _omap == 'true'
> +  if not with_atomics
> +    error('libdrm_omap requires atomics.')
> +  endif
> +  with_omap = true
> +endif
> +
> +with_freedreno = false
> +_freedreno = get_option('freedreno')
> +if _freedreno != 'false'
> +  if _freedreno == 'true' and not with_atomics
> +    error('libdrm_freedreno requires atomics.')
> +  else
> +    with_freedreno = _freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +  endif
> +endif
> +
> +with_tegra = false
> +_tegra = get_option('tegra')
> +if _tegra == 'true'
> +  if not with_atomics
> +    error('libdrm_tegra requires atomics.')
> +  endif
> +  with_tegra = true
> +endif
> +
> +with_etnaviv = false
> +_etnaviv = get_option('etnaviv')
> +if _etnaviv == 'true'
> +  if not with_atomics
> +    error('libdrm_etnaviv requires atomics.')
> +  endif
> +  with_etnaviv = true
> +endif
> +
> +with_exynos = get_option('exynos') == 'true'
> +
> +with_vc4 = false
> +_vc4 = get_option('vc4')
> +if _vc4 != 'false'
> +  with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +endif
> +
> +# XXX: Aparently only freebsd and dragonfly bsd actually need this (and
> +# gnu/kfreebsd), not openbsd and netbsd
> +with_libkms = false
> +_libkms = get_option('libkms')
> +if _libkms != 'false'
> +  with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
> +endif
> +
> +if with_udev
> +  dep_udev = dependency('udev')
> +  config.set10('UDEV', true)
> +else
> +  dep_udev = []
> +endif
> +
> +# Among others FreeBSD does not have a separate dl library.
> +if not cc.has_function('dlsym')
> +  dep_dl = cc.find_library('dl', required : with_nouveau)
> +else
> +  dep_dl = []
> +endif
> +# clock_gettime might require -rt, or it might not. find out
> +if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
> +  # XXX: untested
> +  dep_rt = cc.find_library('rt')
> +else
> +  dep_rt = []
> +endif
> +dep_m = cc.find_library('m', required : false)
> +if cc.has_header('sys/sysctl.h')
> +  config.set10('HAVE_SYS_SYSCTL_H', true)
> +endif
> +if cc.has_header('sys/select.h')
> +  config.set10('HAVE_SYS_SELECT_H', true)
> +endif
> +if cc.has_header_symbol('sys/sysmacros.h', 'major')
> +  config.set10('MAJOR_IN_SYSMACROS', true)
> +elif cc.has_header_symbol('sys/mkdev.h', 'major')
> +  config.set10('MAJOR_IN_MKDEV', true)
> +endif
> +if cc.has_function('open_memstream')
> +  config.set10('HAVE_OPEN_MEMSTREAM', true)
> +endif
> +
> +warn_c_args = []
> +foreach a : ['-Wall', '-Wextra', '-Wsign-compare', 
> +             '-Werror-implicit-function-declaration', '-Wpointer-arith',
> +             '-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes',
> +             '-Wmissing-declarations', '-Wnested-externs', '-Wpacked',
> +             '-Wswitch-enum', '-Wmissing-format-attribute', 
> +             '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', 
> +             '-Wdeclaration-after-statement', '-Wold-style-definition']
> +  if cc.has_argument(a)
> +    warn_c_args += a
> +  endif
> +endforeach
> +# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list
> +# of options
> +foreach a : ['unused-parameter', 'attributes', 'long-long', 
> +             'missing-field-initializers']
> +  if cc.has_argument('-W@0@'.format(a))
> +    warn_c_args += '-Wno-@0@'.format(a)
> +  endif
> +endforeach
> +
> +
> +dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
> +dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
> +dep_cairo = dependency('cairo', required : with_cairo_tests == 'true')
> +dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
> +
> +with_man_pages = get_option('man-pages')
> +prog_xslt = find_program('xsltproc', required : with_man_pages == 'true')
> +prog_sed = find_program('sed', required : with_man_pages == 'true')
> +manpage_style = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
> +if prog_xslt.found()
> +  if run_command(prog_xslt, '--nonet', manpage_style).returncode() != 0
> +    if with_man_pages == 'true'
> +      error('Manpage style sheet cannot be found')
> +    endif
> +    with_man_pages = 'false'
> +  endif
> +endif
> +with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
> +
> +# Used for tets
> +prog_bash = find_program('bash')
> +
> +if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
> +               name : 'compiler supports __attribute__(("hidden"))')
> +  config.set10('HAVE_VISIBILITY', true)
> +endif
> +
> +foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'],
> +             [with_nouveau, 'NOUVEAU'], [with_omap, 'OMAP'],
> +             [with_exynos, 'EXYNOS'], [with_freedreno, 'FREEDRENO'],
> +             [with_tegra, 'TEGRA'], [with_vc4, 'VC4'],
> +             [with_etnaviv, 'ETNAVIV']]
> +  if t[0]
> +    config.set10('HAVE_@0@'.format(t[1]), true)
> +  endif
> +endforeach
> +if with_freedreno_kgsl and not with_freedreno
> +  error('cannot enable freedreno-kgsl without freedreno support')
> +endif

you dropped HAVE_FREEDRENO_KGSL here?

with that fixed,
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

thanks :)

> +if dep_cairo.found()
> +  config.set10('HAVE_CAIRO', true)
> +endif
> +if dep_valgrind.found()
> +  config.set10('HAVE_VALGRIND', true)
> +endif
> +
> +config.set10('_GNU_SOURCE', true)
> +config_file = configure_file(
> +  configuration : config,
> +  output : 'config.h',
> +)
> +add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
> +
> +inc_root = include_directories('.')
> +inc_drm = include_directories('include/drm')
> +
> +libdrm = shared_library(
> +  'drm',
> +  [files(
> +     'xf86drm.c', 'xf86drmHash.c', 'xf86drmRandom.c', 'xf86drmSL.c',
> +     'xf86drmMode.c'
> +   ),
> +   config_file,
> +  ],
> +  c_args : warn_c_args,
> +  dependencies : [dep_udev, dep_valgrind, dep_rt, dep_m],
> +  include_directories : inc_drm,
> +  version : '2.4.0',
> +  install : true,
> +)
> +
> +ext_libdrm = declare_dependency(
> +  link_with : libdrm,
> +  include_directories : inc_drm,
> +)
> +
> +install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
> +install_headers(
> +  'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
> +  'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
> +  'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
> +  'include/drm/nouveau_drm.h', 'include/drm/qxl_drm.h',
> +  'include/drm/r128_drm.h', 'include/drm/radeon_drm.h',
> +  'include/drm/amdgpu_drm.h', 'include/drm/savage_drm.h',
> +  'include/drm/sis_drm.h', 'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h',
> +  'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h',
> +  subdir : 'libdrm',
> +)
> +if with_vmwgfx
> +  install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm')
> +endif
> +
> +pkg.generate(
> +  name : 'libdrm',
> +  libraries : libdrm,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  description : 'Userspace interface to kernel DRM services',
> +)
> + 
> +if with_libkms
> +  subdir('libkms')
> +endif
> +if with_intel
> +  subdir('intel')
> +endif
> +if with_nouveau
> +  subdir('nouveau')
> +endif
> +if with_radeon
> +  subdir('radeon')
> +endif
> +if with_amdgpu
> +  subdir('amdgpu')
> +endif
> +if with_omap
> +  subdir('omap')
> +endif
> +if with_exynos
> +  subdir('exynos')
> +endif
> +if with_freedreno
> +  subdir('freedreno')
> +endif
> +if with_tegra
> +  subdir('tegra')
> +endif
> +if with_vc4
> +  subdir('vc4')
> +endif
> +if with_etnaviv
> +  subdir('etnaviv')
> +endif
> +if with_man_pages
> +  subdir('man')
> +endif
> +subdir('data')
> +subdir('tests')
> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 0000000..8af33f1
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,143 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +option(
> +  'libkms',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : 'Build libkms mm abstraction library.',
> +)
> +option(
> +  'intel',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for Intel's KMS API.''',
> +)
> +option(
> +  'radeon',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for radeons's KMS API.''',
> +)
> +option(
> +  'amdgpu',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for amdgpu's KMS API.''',
> +)
> +option(
> +  'nouveau',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for nouveau's KMS API.''',
> +)
> +option(
> +  'vmwgfx',
> +  type : 'combo',
> +  value : 'true',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for vmgfx's KMS API.''',
> +)
> +option(
> +  'omap',
> +  type : 'combo',
> +  value : 'false',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for OMAP's experimental KMS API.''',
> +)
> +option(
> +  'exynos',
> +  type : 'combo',
> +  value : 'false',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for EXYNOS's experimental KMS API.''',
> +)
> +option(
> +  'freedreno',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for freedreno's KMS API.''',
> +)
> +option(
> +  'tegra',
> +  type : 'combo',
> +  value : 'false',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for Tegra's experimental KMS API.''',
> +)
> +option(
> +  'vc4',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for vc4's KMS API.''',
> +)
> +option(
> +  'etnaviv',
> +  type : 'combo',
> +  value : 'false',
> +  choices : ['true', 'false', 'auto'],
> +  description : '''Enable support for etnaviv's experimental KMS API.''',
> +)
> +option(
> +  'cairo-tests',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : 'Enable support for Cairo rendering in tests.',
> +)
> +option(
> +  'man-pages',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : 'Enable manpage generation and installation.',
> +)
> +option(
> +  'valgrind',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['true', 'false', 'auto'],
> +  description : 'Build libdrm with valgrind support.',
> +)
> +option(
> +  'freedreno-kgsl',
> +  type : 'boolean',
> +  value : false,
> +  description : 'Enable support for freedreno to use downstream android kernel API.',
> +)
> +option(
> +  'install-test-programs',
> +  type : 'boolean',
> +  value : false,
> +  description : 'Install test programs.',
> +)
> +option(
> +  'udev',
> +  type : 'boolean',
> +  value : false,
> +  description : 'Enable support for using udev instead of mknod.',
> +)
> diff --git a/nouveau/meson.build b/nouveau/meson.build
> new file mode 100644
> index 0000000..bfecf84
> --- /dev/null
> +++ b/nouveau/meson.build
> @@ -0,0 +1,58 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +
> +libdrm_nouveau = shared_library(
> +  'drm_nouveau',
> +  [files( 'nouveau.c', 'pushbuf.c', 'bufctx.c', 'abi16.c'), config_file],
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : dep_threads,
> +  version : '2.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_nouveau = declare_dependency(
> +  link_with : [libdrm, libdrm_nouveau],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers('nouveau.h', subdir : 'libdrm/nouveau')
> +install_headers(
> +  'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h',
> +  'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h',
> +  subdir : 'libdrm/nouveau/nvif'
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_nouveau',
> +  libraries : libdrm_nouveau,
> +  subdirs : ['.', 'nouveau'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to nouveau kernel DRM services',
> +)
> +
> +test(
> +  'nouveau-symbol-check',
> +  prog_bash,
> +  args : [files('nouveau-symbol-check'), libdrm_nouveau]
> +)
> diff --git a/omap/meson.build b/omap/meson.build
> new file mode 100644
> index 0000000..1881087
> --- /dev/null
> +++ b/omap/meson.build
> @@ -0,0 +1,53 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libdrm_omap = shared_library(
> +  'drm_omap',
> +  [files('omap_drm.c'), config_file],
> +  include_directories : [inc_root, inc_drm],
> +  c_args : warn_c_args,
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],
> +  version : '1.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_omap = declare_dependency(
> +  link_with : [libdrm, libdrm_omap],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers('omap_drmif.h', subdir : 'libdrm')
> +install_headers('omap_drm.h', subdir : 'omap')
> +
> +pkg.generate(
> +  name : 'libdrm_omap',
> +  libraries : libdrm_omap,
> +  subdirs : ['.', 'libdrm', 'omap'],
> +  version : '0.6',
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to omap kernel DRM services',
> +)
> +
> +test(
> +  'omap-symbol-check',
> +  prog_bash,
> +  args : [files('omap-symbol-check'), libdrm_omap]
> +)
> diff --git a/radeon/meson.build b/radeon/meson.build
> new file mode 100644
> index 0000000..b02166f
> --- /dev/null
> +++ b/radeon/meson.build
> @@ -0,0 +1,63 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +
> +libdrm_radeon = shared_library(
> +  'drm_radeon',
> +  [
> +    files(
> +      'radeon_bo_gem.c', 'radeon_cs_gem.c', 'radeon_cs_space.c', 'radeon_bo.c',
> +      'radeon_cs.c', 'radeon_surface.c',
> +    ),
> +    config_file,
> +  ],
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],
> +  version : '1.0.1',
> +  install : true,
> +)
> +
> +ext_libdrm_radeon = declare_dependency(
> +  link_with : [libdrm, libdrm_radeon],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers(
> +	'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h',
> +	'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h',
> +  subdir : 'libdrm'
> +)
> +
> +pkg.generate(
> +  name : 'libdrm_radeon',
> +  libraries : libdrm_radeon,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to kernel DRM services for radeon',
> +)
> +
> +test(
> +  'radeon-symbol-check',
> +  prog_bash,
> +  args : [files('radeon-symbol-check'), libdrm_radeon]
> +)
> diff --git a/tegra/meson.build b/tegra/meson.build
> new file mode 100644
> index 0000000..99fdd19
> --- /dev/null
> +++ b/tegra/meson.build
> @@ -0,0 +1,52 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +libdrm_tegra = shared_library(
> +  'drm_tegra',
> +  [files('tegra.c'), config_file],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : [dep_pthread_stubs],
> +  c_args : warn_c_args,
> +  version : '0.0.0',
> +  install : true,
> +)
> +
> +ext_libdrm_tegra = declare_dependency(
> +  link_with : [libdrm, libdrm_tegra],
> +  include_directories : [inc_drm, include_directories('.')],
> +)
> +
> +install_headers('tegra.h', subdir : 'libdrm')
> +
> +pkg.generate(
> +  name : 'libdrm_tegra',
> +  libraries : libdrm_tegra,
> +  subdirs : ['.', 'libdrm'],
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to Tegra kernel DRM services',
> +)
> +
> +test(
> +  'tegra-symbol-check',
> +  prog_bash,
> +  args : [files('tegra-symbol-check'), libdrm_tegra]
> +)
> diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
> new file mode 100644
> index 0000000..4c1237c
> --- /dev/null
> +++ b/tests/amdgpu/meson.build
> @@ -0,0 +1,34 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +if dep_cunit.found()
> +  amdgpu_test = executable(
> +    'amdgpu_test',
> +    files(
> +      'amdgpu_test.c', 'basic_tests.c', 'bo_tests.c', 'cs_tests.c',
> +      'vce_tests.c', 'uvd_enc_tests.c', 'vcn_tests.c', 'deadlock_tests.c',
> +      'vm_tests.c',
> +    ),
> +    dependencies : [dep_cunit, dep_threads],
> +    include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')],
> +    link_with : [libdrm, libdrm_amdgpu],
> +    install : with_install_tests,
> +  )
> +endif
> diff --git a/tests/etnaviv/meson.build b/tests/etnaviv/meson.build
> new file mode 100644
> index 0000000..8b4a3cf
> --- /dev/null
> +++ b/tests/etnaviv/meson.build
> @@ -0,0 +1,45 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +inc_etnaviv_tests = [inc_root, inc_drm, include_directories('../../etnaviv')]
> +
> +etnaviv_2d_test = executable(
> +  'etnaviv_2d_test',
> +  files('etnaviv_2d_test.c', 'write_bmp.c'),
> +  include_directories : inc_etnaviv_tests,
> +  link_with : [libdrm, libdrm_etnaviv],
> +  install : with_install_tests,
> +)
> +
> +etnaviv_cmd_stream_test = executable(
> +  'etnaviv_cmd_stream_test',
> +  files('etnaviv_cmd_stream_test.c'),
> +  include_directories : inc_etnaviv_tests,
> +  link_with : [libdrm, libdrm_etnaviv],
> +  install : with_install_tests,
> +)
> +
> +etnaviv_bo_cache_test = executable(
> +  'etnaviv_bo_cache_test',
> +  files('etnaviv_bo_cache_test.c'),
> +  include_directories : inc_etnaviv_tests,
> +  link_with : [libdrm, libdrm_etnaviv],
> +  install : with_install_tests,
> +)
> diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build
> new file mode 100644
> index 0000000..940c3ce
> --- /dev/null
> +++ b/tests/exynos/meson.build
> @@ -0,0 +1,54 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +inc_exynos = include_directories('../../exynos')
> +
> +if with_libkms
> +  exynos_fimg2d_test = executable(
> +    'exynos_fimg2d_test',
> +    files('exynos_fimg2d_test.c'),
> +    c_args : warn_c_args,
> +    include_directories : [inc_root, inc_drm, inc_exynos,
> +                           include_directories('../../libkms')],
> +    link_with : [libdrm, libkms, libdrm_exynos],
> +    dependencies : dep_threads,
> +    install : with_install_tests,
> +  )
> +endif
> +
> +exynos_fimg2d_perf = executable(
> +  'exynos_fimg2d_perf',
> +  files('exynos_fimg2d_perf.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm, inc_exynos],
> +  link_with : [libdrm, libdrm_exynos],
> +  dependencies : dep_threads,
> +  install : with_install_tests,
> +)
> +
> +exynos_fimg2d_event = executable(
> +  'exynos_fimg2d_event',
> +  files('exynos_fimg2d_event.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_drm, inc_exynos],
> +  link_with : [libdrm, libdrm_exynos],
> +  dependencies : dep_threads,
> +  install : with_install_tests,
> +)
> diff --git a/tests/kms/meson.build b/tests/kms/meson.build
> new file mode 100644
> index 0000000..1f7f724
> --- /dev/null
> +++ b/tests/kms/meson.build
> @@ -0,0 +1,49 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +
> +libkms_test = static_library(
> +  'kms-test',
> +  files(
> +    'libkms-test-crtc.c', 'libkms-test-device.c', 'libkms-test-framebuffer.c',
> +    'libkms-test-plane.c', 'libkms-test-screen.c',
> +  ),
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +kms_steal_crtc = executable(
> +  'kms-steal-crtc',
> +  files('kms-steal-crtc.c'),
> +  dependencies : dep_cairo,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : [libkms_test, libutil],
> +  install : with_install_tests,
> +)
> +
> +kms_universal_planes = executable(
> +  'kms-universal-planes',
> +  files('kms-universal-planes.c'),
> +  dependencies : dep_cairo,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : [libkms_test],
> +  install : with_install_tests,
> +)
> diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build
> new file mode 100644
> index 0000000..a47d495
> --- /dev/null
> +++ b/tests/kmstest/meson.build
> @@ -0,0 +1,30 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +kmstest = executable(
> +  'kmstest',
> +  files('main.c'),
> +  c_args : warn_c_args,
> +  include_directories : [
> +    inc_root, inc_tests, include_directories('../../libkms'), inc_drm,
> +  ],
> +  link_with : [libutil, libkms, libdrm],
> +  install : with_install_tests,
> +)
> diff --git a/tests/meson.build b/tests/meson.build
> new file mode 100644
> index 0000000..fdf950b
> --- /dev/null
> +++ b/tests/meson.build
> @@ -0,0 +1,86 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +inc_tests = include_directories('.')
> +
> +subdir('util')
> +subdir('kms')
> +subdir('modeprint')
> +subdir('proptest')
> +subdir('modetest')
> +subdir('vbltest')
> +if with_libkms
> +  subdir('kmstest')
> +endif
> +if with_radeon
> +  subdir('radeon')
> +endif
> +if with_amdgpu
> +  subdir('amdgpu')
> +endif
> +if with_exynos
> +  subdir('exynos')
> +endif
> +if with_tegra
> +  subdir('tegra')
> +endif
> +if with_etnaviv
> +  subdir('etnaviv')
> +endif
> +if with_nouveau
> +  subdir('nouveau')
> +endif
> +
> +drmsl = executable(
> +  'drmsl',
> +  files('drmsl.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +hash = executable(
> +  'hash',
> +  files('hash.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +random = executable(
> +  'random',
> +  files('random.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +drmdevice = executable(
> +  'drmdevice',
> +  files('drmdevice.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> +
> +test('random', random, timeout : 240)
> +test('hash', hash)
> +test('drmsl', drmsl)
> +test('drmdevice', drmdevice)
> diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build
> new file mode 100644
> index 0000000..5f0eb24
> --- /dev/null
> +++ b/tests/modeprint/meson.build
> @@ -0,0 +1,29 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +modeprint = executable(
> +  'modeprint',
> +  files('modeprint.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : libdrm,
> +  dependencies : dep_threads,
> +  install : with_install_tests,
> +)
> diff --git a/tests/modetest/meson.build b/tests/modetest/meson.build
> new file mode 100644
> index 0000000..2a08184
> --- /dev/null
> +++ b/tests/modetest/meson.build
> @@ -0,0 +1,29 @@
> +# Copyright © 2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +modetest = executable(
> +  'modetest',
> +  files('buffers.c', 'cursor.c', 'modetest.c'),
> +  c_args : [warn_c_args, '-Wno-pointer-arith'],
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  dependencies : [dep_threads, dep_cairo],
> +  link_with : [libdrm, libutil],
> +  install : with_install_tests,
> +)
> diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build
> new file mode 100644
> index 0000000..f5d73c1
> --- /dev/null
> +++ b/tests/nouveau/meson.build
> @@ -0,0 +1,30 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +threaded = executable(
> +  'threaded',
> +  files('threaded.c'),
> +  dependencies : [dep_dl, dep_threads],
> +  include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
> +  link_with : [libdrm, libdrm_nouveau],
> +  c_args : warn_c_args,
> +)
> +
> +test('threaded', threaded)
> diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build
> new file mode 100644
> index 0000000..22d7473
> --- /dev/null
> +++ b/tests/proptest/meson.build
> @@ -0,0 +1,28 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +proptest = executable(
> +  'proptest',
> +  files('proptest.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : [libdrm, libutil],
> +  install : with_install_tests,
> +)
> diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build
> new file mode 100644
> index 0000000..9e4f916
> --- /dev/null
> +++ b/tests/radeon/meson.build
> @@ -0,0 +1,27 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +radeon_ttm = executable(
> +  'radeon_ttm',
> +  files('rbo.c', 'radeon_ttm.c'),
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  c_args : warn_c_args,
> +)
> diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
> new file mode 100644
> index 0000000..9c74ac4
> --- /dev/null
> +++ b/tests/tegra/meson.build
> @@ -0,0 +1,27 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +openclose = executable(
> +  'openclose',
> +  files('openclose.c'),
> +  include_directories : [inc_root, inc_drm, include_directories('../../tegra')],
> +  c_args : warn_c_args,
> +  link_with : [libdrm, libdrm_tegra],
> +)
> diff --git a/tests/util/meson.build b/tests/util/meson.build
> new file mode 100644
> index 0000000..7fa1a4b
> --- /dev/null
> +++ b/tests/util/meson.build
> @@ -0,0 +1,28 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +
> +libutil = static_library(
> +  'util',
> +  [files('format.c', 'kms.c', 'pattern.c'), config_file],
> +  include_directories : [inc_root, inc_drm],
> +  link_with : libdrm,
> +  dependencies : dep_cairo
> +)
> diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build
> new file mode 100644
> index 0000000..ae52ab8
> --- /dev/null
> +++ b/tests/vbltest/meson.build
> @@ -0,0 +1,28 @@
> +# Copyright © 2017-2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +vbltest = executable(
> +  'vbltest',
> +  files('vbltest.c'),
> +  c_args : warn_c_args,
> +  include_directories : [inc_root, inc_tests, inc_drm],
> +  link_with : [libdrm, libutil],
> +  install : with_install_tests,
> +)
> diff --git a/vc4/meson.build b/vc4/meson.build
> new file mode 100644
> index 0000000..0136987
> --- /dev/null
> +++ b/vc4/meson.build
> @@ -0,0 +1,28 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm')
> +
> +pkg.generate(
> +  name : 'libdrm_vc4',
> +  version : meson.project_version(),
> +  requires_private : 'libdrm',
> +  description : 'Userspace interface to vc4 kernel DRM services',
> +)
> -- 
> git-series 0.9.1
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

* Re: [Mesa-dev] [PATCH 2/3] autotools: Include meson.build files in tarball
  2018-01-05 20:00   ` [PATCH 2/3] autotools: Include meson.build files in tarball Dylan Baker
@ 2018-01-12 17:12     ` Eric Engestrom
  0 siblings, 0 replies; 29+ messages in thread
From: Eric Engestrom @ 2018-01-12 17:12 UTC (permalink / raw)
  To: Dylan Baker; +Cc: mesa-dev, dri-devel

On Friday, 2018-01-05 12:00:59 -0800, Dylan Baker wrote:
> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
> ---
>  Makefile.am | 30 +++++++++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 7b86214..66f70ca 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -135,7 +135,35 @@ if HAVE_VMWGFX
>  klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
>  endif
>  
> -EXTRA_DIST = include/drm/README
> +EXTRA_DIST = \
> +	include/drm/README \
> +	amdgpu/meson.build \
> +	etnaviv/meson.build \
> +	exynos/meson.build \
> +	freedreno/meson.build \
> +	intel/meson.build \
> +	libkms/meson.build \
> +	man/meson.build \
> +	nouveau/meson.build \
> +	omap/meson.build \
> +	radeon/meson.build \
> +	tests/amdgpu/meson.build \
> +	tests/etnaviv/meson.build \
> +	tests/exynos/meson.build \
> +	tests/kms/meson.build \
> +	tests/kmstest/meson.build \
> +	tests/modeprint/meson.build \
> +	tests/nouveau/meson.build \
> +	tests/proptest/meson.build \
> +	tests/radeon/meson.build \
> +	tests/tegra/meson.build \
> +	tests/util/meson.build \
> +	tests/vbltest/meson.build \
> +	tests/meson.build \
> +	vc4/meson.build \
> +	data/meson.build \
> +	meson.build \
> +	meson_options.txt

You're missing a couple meson.builds:
tegra/meson.build
tests/modetest/meson.build

with those two added:
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

>  
>  copy-headers :
>  	cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/
> -- 
> git-series 0.9.1
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 3/3] README: Add note about meson
  2018-01-05 20:01   ` [PATCH 3/3] README: Add note about meson Dylan Baker
@ 2018-01-12 17:12     ` Eric Engestrom
  0 siblings, 0 replies; 29+ messages in thread
From: Eric Engestrom @ 2018-01-12 17:12 UTC (permalink / raw)
  To: Dylan Baker; +Cc: mesa-dev, dri-devel

On Friday, 2018-01-05 12:01:00 -0800, Dylan Baker wrote:
> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

> ---
>  README | 24 +++++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/README b/README
> index 26cab9d..f3df9ac 100644
> --- a/README
> +++ b/README
> @@ -15,9 +15,27 @@ with an older kernel.
>  Compiling
>  ---------
>  
> -libdrm  is  a  standard  autotools  package and  follows  the  normal
> -configure, build  and install steps.   The first step is  to configure
> -the package, which is done by running the configure shell script:
> +libdrm has two build systems, a legacy autotools build system, and a newer
> +meson build system. The meson build system is much faster, and offers a
> +slightly different interface, but otherwise provides an equivalent feature set.
> +
> +To use it:
> +
> +    meson builddir/
> +
> +By default this will install into /usr/local, you can change your prefix
> +with --prefix=/usr (or `meson configure builddir/ -Dprefix=/usr` after 
> +the initial meson setup).
> +
> +Then use ninja to build and install:
> +
> +    ninja -C builddir/ install
> +
> +If you are installing into a system location you will need to run install
> +separately, and as root.
> +
> +
> +Alternatively you can invoke autotools configure:
>  
>  	./configure
>  
> -- 
> git-series 0.9.1
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Mesa-dev] [PATCH 0/3] Meson build system
  2018-01-09  0:14   ` [PATCH 0/3] Meson build system Dylan Baker
@ 2018-01-12 17:15     ` Eric Engestrom
  0 siblings, 0 replies; 29+ messages in thread
From: Eric Engestrom @ 2018-01-12 17:15 UTC (permalink / raw)
  To: Dylan Baker; +Cc: mesa-dev, Eric Engestrom, dri-devel

On Monday, 2018-01-08 16:14:43 -0800, Dylan Baker wrote:
> I forgot to CC you on this like you asked,

Thanks for the ping :)

I noticed a couple issues on patches 1 & 2, but those are easy to fix,
and with that the series is r-b me.

Thanks for the effort of writing the whole thing!
I'll be glad to ditch autotools once this lands :P

> 
> Dylan
> 
> Quoting Dylan Baker (2018-01-05 12:00:57)
> > This is a fifth iteration of the meson build system for libdrm. This
> > version is significantly cleaned up from the last version and uses a
> > style more like the build system in mesa.
> > 
> > It builds all of the drivers and tests, and the tests can be run via
> > `ninja test`.
> > 
> > It has support for being used as a wrapped dependency with ext_foo
> > variables (I have a branch of mesa that will build this code as a wrap,
> > which has also been useful for testing). This means it can be used to
> > build a mesa that requires a newer libdrm than the system provides
> > (which can be especially useful if you can't install packages on that
> > system), or to build libdrm support that your distro doesn't ship (like
> > arm only drivers on x86), cross compiling, and for testing.
> > 
> > This has been build tested and mesa has been compiled against it, but
> > only minimal functional testing has been done, since I only have i965
> > machines, and i965 only uses libdrm lightly.
> > 
> > Some reviewers of the previous versions have done some additional
> > testing.
> > 
> > Changes since v3:
> >   - Fix freedreno kgsl check
> >   - Fix kgls -> kgsl typo
> >   - standardize meson options to use only `-` and not `_`
> >   - fix typo radoen -> radeon
> >   - add help messages to options
> >   - fix typo in kms-universal-planes binary
> >   - build and install modetest (this was missed in the first version for
> >     some reason)
> >   - install amdgpu.ids as 644 instead of 444
> > 
> > Changes since v4:
> >   - Fix minor nits in options descriptions (Igor)
> >   - Fix editorconfig settings
> >   - Fix amdgpu.ids searh path
> >   - Style nits for Eric E.
> >   - Remove more tabs
> >   - Ensure that 1/0 defines are always defined, instead of only when
> >     their value is 1
> >   - Don't add header files into file lists. (Meson figures out header
> >     dependencies automatically using graphs that the compiler generates
> >     during compilation)
> >   - Don't assign file lists to variables when possible. In a few cases
> >     files need to be conditionally added, but if we're not in one of
> >     those cases just put the lists directly in the exectuable or library
> >     declaration.
> > 
> > Dylan Baker (3):
> >   Add meson build system
> >   autotools: Include meson.build files in tarball
> >   README: Add note about meson
> > 
> >  .editorconfig               |   4 +-
> >  Makefile.am                 |  30 ++-
> >  README                      |  24 +-
> >  amdgpu/.editorconfig        |   4 +-
> >  amdgpu/meson.build          |  65 +++++++-
> >  data/meson.build            |  27 +++-
> >  etnaviv/meson.build         |  59 ++++++-
> >  exynos/meson.build          |  53 +++++-
> >  freedreno/meson.build       |  76 ++++++++-
> >  intel/meson.build           | 105 +++++++++++-
> >  libkms/meson.build          |  74 ++++++++-
> >  man/meson.build             |  67 +++++++-
> >  meson.build                 | 364 +++++++++++++++++++++++++++++++++++++-
> >  meson_options.txt           | 143 +++++++++++++++-
> >  nouveau/meson.build         |  58 ++++++-
> >  omap/meson.build            |  53 +++++-
> >  radeon/meson.build          |  63 ++++++-
> >  tegra/meson.build           |  52 +++++-
> >  tests/amdgpu/meson.build    |  34 +++-
> >  tests/etnaviv/meson.build   |  45 +++++-
> >  tests/exynos/meson.build    |  54 +++++-
> >  tests/kms/meson.build       |  49 +++++-
> >  tests/kmstest/meson.build   |  30 +++-
> >  tests/meson.build           |  86 +++++++++-
> >  tests/modeprint/meson.build |  29 +++-
> >  tests/modetest/meson.build  |  29 +++-
> >  tests/nouveau/meson.build   |  30 +++-
> >  tests/proptest/meson.build  |  28 +++-
> >  tests/radeon/meson.build    |  27 +++-
> >  tests/tegra/meson.build     |  27 +++-
> >  tests/util/meson.build      |  28 +++-
> >  tests/vbltest/meson.build   |  28 +++-
> >  vc4/meson.build             |  28 +++-
> >  33 files changed, 1869 insertions(+), 4 deletions(-)
> >  create mode 100644 amdgpu/meson.build
> >  create mode 100644 data/meson.build
> >  create mode 100644 etnaviv/meson.build
> >  create mode 100644 exynos/meson.build
> >  create mode 100644 freedreno/meson.build
> >  create mode 100644 intel/meson.build
> >  create mode 100644 libkms/meson.build
> >  create mode 100644 man/meson.build
> >  create mode 100644 meson.build
> >  create mode 100644 meson_options.txt
> >  create mode 100644 nouveau/meson.build
> >  create mode 100644 omap/meson.build
> >  create mode 100644 radeon/meson.build
> >  create mode 100644 tegra/meson.build
> >  create mode 100644 tests/amdgpu/meson.build
> >  create mode 100644 tests/etnaviv/meson.build
> >  create mode 100644 tests/exynos/meson.build
> >  create mode 100644 tests/kms/meson.build
> >  create mode 100644 tests/kmstest/meson.build
> >  create mode 100644 tests/meson.build
> >  create mode 100644 tests/modeprint/meson.build
> >  create mode 100644 tests/modetest/meson.build
> >  create mode 100644 tests/nouveau/meson.build
> >  create mode 100644 tests/proptest/meson.build
> >  create mode 100644 tests/radeon/meson.build
> >  create mode 100644 tests/tegra/meson.build
> >  create mode 100644 tests/util/meson.build
> >  create mode 100644 tests/vbltest/meson.build
> >  create mode 100644 vc4/meson.build
> > 
> > base-commit: 831036a6f62005da9fb4a75fe043bd96ce672d27
> > -- 
> > git-series 0.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-01-12 17:15 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-03 21:31 [PATCH 0/3] Meson build system Dylan Baker
2018-01-03 21:31 ` [PATCH 1/3] Add meson " Dylan Baker
2018-01-03 22:18   ` Dylan Baker
2018-01-03 23:22   ` [Mesa-dev] " Igor Gnatenko
2018-01-04  0:02     ` Dylan Baker
2018-01-05 13:34   ` Eric Engestrom
2018-01-05 13:41     ` Eric Engestrom
2018-01-05 19:52     ` Dylan Baker
2018-01-03 21:31 ` [PATCH 2/3] autotools: Include meson.build files in tarball Dylan Baker
2018-01-03 21:31 ` [PATCH 3/3] README: Add note about meson Dylan Baker
2018-01-04 18:28 ` [PATCH v4 0/3] Meson build system Dylan Baker
2018-01-04 18:28   ` [PATCH v4 1/3] Add meson " Dylan Baker
2018-01-04 21:43     ` [Mesa-dev] " Igor Gnatenko
2018-01-04 23:28       ` Dylan Baker
2018-01-04 18:28   ` [PATCH v4 2/3] autotools: Include meson.build files in tarball Dylan Baker
2018-01-05 14:02     ` Eric Engestrom
2018-01-05 18:53       ` Dylan Baker
2018-01-04 18:28   ` [PATCH v4 3/3] README: Add note about meson Dylan Baker
2018-01-05 13:49     ` Eric Engestrom
2018-01-05 18:51       ` Dylan Baker
2018-01-05 20:00 ` [PATCH 0/3] Meson build system Dylan Baker
2018-01-05 20:00   ` [PATCH 1/3] Add meson " Dylan Baker
2018-01-12 17:10     ` Eric Engestrom
2018-01-05 20:00   ` [PATCH 2/3] autotools: Include meson.build files in tarball Dylan Baker
2018-01-12 17:12     ` [Mesa-dev] " Eric Engestrom
2018-01-05 20:01   ` [PATCH 3/3] README: Add note about meson Dylan Baker
2018-01-12 17:12     ` Eric Engestrom
2018-01-09  0:14   ` [PATCH 0/3] Meson build system Dylan Baker
2018-01-12 17:15     ` [Mesa-dev] " Eric Engestrom

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