Discussion:
[Mesa-dev] [PATCH 4/6] meson: Fix LLVM requires for radeonsi
Dylan Baker
2017-11-21 00:50:36 UTC
Permalink
Signed-off-by: Dylan Baker <***@intel.com>
---
meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index c568fdb8785..52f2c1cb0d0 100644
--- a/meson.build
+++ b/meson.build
@@ -707,7 +707,7 @@ if with_gallium_freedreno
endif

llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
-if with_amd_vk
+if with_amd_vk or with_gallium_radeonsi
llvm_modules += ['amdgpu', 'bitreader', 'ipo']
endif

@@ -715,7 +715,7 @@ _llvm = get_option('llvm')
if _llvm == 'auto'
dep_llvm = dependency(
'llvm', version : '>= 3.9.0', modules : llvm_modules,
- required : with_amd_vk,
+ required : with_amd_vk or with_gallium_radeonsi,
)
with_llvm = dep_llvm.found()
elif _llvm == 'true'
--
2.15.0
Dylan Baker
2017-11-21 00:50:37 UTC
Permalink
This is still not fully correct (haiku and BSD are probably not
correct), but Linux is not regressed and this should be correct for
macOS and Windows.

Signed-off-by: Dylan Baker <***@intel.com>
---
meson.build | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 52f2c1cb0d0..e7d2afb3d0a 100644
--- a/meson.build
+++ b/meson.build
@@ -187,8 +187,19 @@ if with_dri_i915
dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
endif

-# TODO: other OSes
-with_dri_platform = 'drm'
+# TODO: gnu
+if host_machine.system() == 'darwin'
+ with_dri_platform = 'apple'
+elif host_machine.system() == 'windows'
+ with_dri_platform = 'windows'
+elif host_machine.system() == 'linux'
+ # FIXME: This should include BSD and possibly other systems
+ with_dri_platform = 'drm'
+else
+ # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
+ # assert here that one of those cases has been met.
+ with_dri_platform = 'none'
+endif

with_platform_android = false
with_platform_wayland = false
--
2.15.0
Jon Turney
2017-11-21 14:25:42 UTC
Permalink
Post by Dylan Baker
This is still not fully correct (haiku and BSD are probably not
correct), but Linux is not regressed and this should be correct for
macOS and Windows.
---
meson.build | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 52f2c1cb0d0..e7d2afb3d0a 100644
--- a/meson.build
+++ b/meson.build
@@ -187,8 +187,19 @@ if with_dri_i915
dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
endif
-# TODO: other OSes
-with_dri_platform = 'drm'
+# TODO: gnu
+if host_machine.system() == 'darwin'
+ with_dri_platform = 'apple'
+elif host_machine.system() == 'windows'
This should be:

elif ['windows', 'cygwin'].contains(host_machine.system())
Post by Dylan Baker
+ with_dri_platform = 'windows'
+elif host_machine.system() == 'linux'
+ # FIXME: This should include BSD and possibly other systems
+ with_dri_platform = 'drm'
+else
+ # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
+ # assert here that one of those cases has been met.
+ with_dri_platform = 'none'
+endif
with_platform_android = false
with_platform_wayland = false
Dylan Baker
2017-11-21 18:21:07 UTC
Permalink
This is still not fully correct (haiku and BSD is notably probably not
correct), but Linux is not regressed and this should be correct for
macOS and Windows.

v2: - set the dri_platform to windows on Cygwin as well (Jon)

Signed-off-by: Dylan Baker <***@intel.com>
---
meson.build | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 52f2c1cb0d0..4248cbcfd7e 100644
--- a/meson.build
+++ b/meson.build
@@ -187,8 +187,19 @@ if with_dri_i915
dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
endif

-# TODO: other OSes
-with_dri_platform = 'drm'
+# TODO: gnu
+if host_machine.system() == 'darwin'
+ with_dri_platform = 'apple'
+elif ['windows', 'cygwin'].contains(host_machine.system())
+ with_dri_platform = 'windows'
+elif host_machine.system() == 'linux'
+ # FIXME: This should include BSD and possibly other systems
+ with_dri_platform = 'drm'
+else
+ # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
+ # assert here that one of those cases has been met.
+ with_dri_platform = 'none'
+endif

with_platform_android = false
with_platform_wayland = false
--
2.15.0
Eric Engestrom
2017-11-21 18:38:25 UTC
Permalink
Post by Dylan Baker
This is still not fully correct (haiku and BSD is notably probably not
correct), but Linux is not regressed and this should be correct for
macOS and Windows.
v2: - set the dri_platform to windows on Cygwin as well (Jon)
R-b stands
Post by Dylan Baker
---
meson.build | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 52f2c1cb0d0..4248cbcfd7e 100644
--- a/meson.build
+++ b/meson.build
@@ -187,8 +187,19 @@ if with_dri_i915
dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
endif
-# TODO: other OSes
-with_dri_platform = 'drm'
+# TODO: gnu
I missed that comment the first time around; I don't understand what it
means?
Post by Dylan Baker
+if host_machine.system() == 'darwin'
+ with_dri_platform = 'apple'
+elif ['windows', 'cygwin'].contains(host_machine.system())
+ with_dri_platform = 'windows'
+elif host_machine.system() == 'linux'
+ # FIXME: This should include BSD and possibly other systems
+ with_dri_platform = 'drm'
+else
+ # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
+ # assert here that one of those cases has been met.
+ with_dri_platform = 'none'
+endif
with_platform_android = false
with_platform_wayland = false
--
2.15.0
Dylan Baker
2017-11-21 18:50:29 UTC
Permalink
Quoting Eric Engestrom (2017-11-21 10:38:25)
Post by Eric Engestrom
Post by Dylan Baker
This is still not fully correct (haiku and BSD is notably probably not
correct), but Linux is not regressed and this should be correct for
macOS and Windows.
v2: - set the dri_platform to windows on Cygwin as well (Jon)
R-b stands
Post by Dylan Baker
---
meson.build | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 52f2c1cb0d0..4248cbcfd7e 100644
--- a/meson.build
+++ b/meson.build
@@ -187,8 +187,19 @@ if with_dri_i915
dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
endif
-# TODO: other OSes
-with_dri_platform = 'drm'
+# TODO: gnu
I missed that comment the first time around; I don't understand what it
means?
The autotools build has a handlers for setting the dri_platform to 'none' on
gnu* (which I assume to be hurd). See configure.ac:1513

As far as I know meson doesn't support hurd ATM (though I doubt they'd turn away
patches for it).

We can drop the TODO if you'd prefer, I just like to note things in the
autotools/scons build that aren't currently supported in the meson build.

Dylan
Eric Engestrom
2017-11-22 11:16:17 UTC
Permalink
Post by Dylan Baker
Quoting Eric Engestrom (2017-11-21 10:38:25)
Post by Eric Engestrom
Post by Dylan Baker
This is still not fully correct (haiku and BSD is notably probably not
correct), but Linux is not regressed and this should be correct for
macOS and Windows.
v2: - set the dri_platform to windows on Cygwin as well (Jon)
R-b stands
Post by Dylan Baker
---
meson.build | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 52f2c1cb0d0..4248cbcfd7e 100644
--- a/meson.build
+++ b/meson.build
@@ -187,8 +187,19 @@ if with_dri_i915
dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
endif
-# TODO: other OSes
-with_dri_platform = 'drm'
+# TODO: gnu
I missed that comment the first time around; I don't understand what it
means?
The autotools build has a handlers for setting the dri_platform to 'none' on
gnu* (which I assume to be hurd). See configure.ac:1513
As far as I know meson doesn't support hurd ATM (though I doubt they'd turn away
patches for it).
We can drop the TODO if you'd prefer, I just like to note things in the
autotools/scons build that aren't currently supported in the meson build.
No, I think keeping the TODO is good to indicate something that is
handled by the other build system(s), even if they might never be
"fixed" (eg. if meson never gets ported to hurd).

I guess this case is already covered by your `else` though, so maybe
move the comment there, and make it more than 3 letters? :P

Don't let this stop you from pushing it though, it's really a nitpick ;)
Dylan Baker
2017-11-22 20:39:07 UTC
Permalink
Quoting Eric Engestrom (2017-11-22 03:16:17)
Post by Eric Engestrom
Post by Dylan Baker
Quoting Eric Engestrom (2017-11-21 10:38:25)
Post by Eric Engestrom
Post by Dylan Baker
This is still not fully correct (haiku and BSD is notably probably not
correct), but Linux is not regressed and this should be correct for
macOS and Windows.
v2: - set the dri_platform to windows on Cygwin as well (Jon)
R-b stands
Post by Dylan Baker
---
meson.build | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 52f2c1cb0d0..4248cbcfd7e 100644
--- a/meson.build
+++ b/meson.build
@@ -187,8 +187,19 @@ if with_dri_i915
dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
endif
-# TODO: other OSes
-with_dri_platform = 'drm'
+# TODO: gnu
I missed that comment the first time around; I don't understand what it
means?
The autotools build has a handlers for setting the dri_platform to 'none' on
gnu* (which I assume to be hurd). See configure.ac:1513
As far as I know meson doesn't support hurd ATM (though I doubt they'd turn away
patches for it).
We can drop the TODO if you'd prefer, I just like to note things in the
autotools/scons build that aren't currently supported in the meson build.
No, I think keeping the TODO is good to indicate something that is
handled by the other build system(s), even if they might never be
"fixed" (eg. if meson never gets ported to hurd).
I guess this case is already covered by your `else` though, so maybe
move the comment there, and make it more than 3 letters? :P
Don't let this stop you from pushing it though, it's really a nitpick ;)
I went ahead and moved the FIXME into the else block and gave a longer (and
hopefully better) comment than `gnu`

Dylan

Dylan Baker
2017-11-21 00:50:38 UTC
Permalink
This fixes the windows and macos stubs to be consistent with the *nix
path.

Signed-off-by: Dylan Baker <***@intel.com>
---
meson.build | 4 ----
src/glx/meson.build | 4 ++--
src/mapi/glapi/meson.build | 2 +-
3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index e7d2afb3d0a..bcc560217cb 100644
--- a/meson.build
+++ b/meson.build
@@ -52,10 +52,6 @@ if get_option('texture-float')
message('WARNING: Floating-point texture enabled. Please consult docs/patents.txt and your lawyer before building mesa.')
endif

-# XXX: yeah, do these
-with_appledri = false
-with_windowsdri = false
-
dri_drivers_path = get_option('dri-drivers-path')
if dri_drivers_path == ''
dri_drivers_path = join_paths(get_option('libdir'), 'dri')
diff --git a/src/glx/meson.build b/src/glx/meson.build
index 43f8fb24efd..deef3ed2235 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -95,9 +95,9 @@ if with_dri3
files_libglx += files('dri3_glx.c', 'dri3_priv.h')
endif

-if with_appledri
+if with_dri_platform == 'apple'
files_libglx += files('applegl_glx.c')
-elif with_windowsdri
+elif with_dri_platform == 'windows'
files_libglx += files('driwindows_glx.c')
# TODO
#extra_libs_libglx += [
diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build
index d2d86afd6c1..f2012644785 100644
--- a/src/mapi/glapi/meson.build
+++ b/src/mapi/glapi/meson.build
@@ -23,7 +23,7 @@ inc_glapi = include_directories('.')
static_glapi_files = []
static_glapi_args = []

-if with_appledri or with_windowsdri
+if ['apple', 'windows'].contains(with_dri_platform)
static_glapi_files += files('glapi_gentable.c')
endif
--
2.15.0
Dylan Baker
2017-11-21 00:50:34 UTC
Permalink
This is necessary to support operating systems other than the *nix
family (excluding macOS). For Linux nothing has changed, the defaults
are still the same.

Signed-off-by: Dylan Baker <***@intel.com>
---
meson.build | 7 +++++++
meson_options.txt | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index ce2c8c2c1d0..7dd6f89991b 100644
--- a/meson.build
+++ b/meson.build
@@ -198,6 +198,13 @@ with_platform_drm = false
with_platform_surfaceless = false
egl_native_platform = ''
_platforms = get_option('platforms')
+if _platforms == 'auto'
+ if ['linux'].contains(host_machine.system())
+ _platforms = 'x11,wayland,drm,surfaceless'
+ else
+ error('Unknown OS, no platforms enabled. Patches gladly accepted to fix this.')
+ endif
+endif
if _platforms != ''
_split = _platforms.split(',')
with_platform_android = _split.contains('android')
diff --git a/meson_options.txt b/meson_options.txt
index 6c9cd33998c..1134a250295 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -21,8 +21,8 @@
option(
'platforms',
type : 'string',
- value : 'x11,wayland,drm,surfaceless',
- description : 'comma separated list of window systems to support. wayland, x11, surfaceless, drm, etc.'
+ value : 'auto',
+ description : 'comma separated list of window systems to support. If this is set to auto all platforms applicable to the OS will be enabled.'
)
option(
'dri3',
--
2.15.0
Dylan Baker
2017-11-21 00:50:33 UTC
Permalink
There is one provided unconditionally, and one guarded by platform ==
linux. Remove the unconditional one.

Signed-off-by: Dylan Baker <***@intel.com>
---
meson.build | 1 -
1 file changed, 1 deletion(-)

diff --git a/meson.build b/meson.build
index 383ebb36662..ce2c8c2c1d0 100644
--- a/meson.build
+++ b/meson.build
@@ -39,7 +39,6 @@ pre_args = [
'-DVERSION="@0@"'.format(meson.project_version()),
'-DPACKAGE_VERSION=VERSION',
'-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"',
- '-D_GNU_SOURCE',
]

with_vulkan_icd_dir = get_option('vulkan-icd-dir')
--
2.15.0
Dylan Baker
2017-11-21 00:50:35 UTC
Permalink
This option has been acting as a strange sort of half-tri state anyway.

Signed-off-by: Dylan Baker <***@intel.com>
---
meson.build | 48 +++++++++++++++++++++++++-----------------------
meson_options.txt | 5 +++--
2 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/meson.build b/meson.build
index 7dd6f89991b..c568fdb8785 100644
--- a/meson.build
+++ b/meson.build
@@ -46,7 +46,6 @@ with_tests = get_option('build-tests')
with_valgrind = get_option('valgrind')
with_libunwind = get_option('libunwind')
with_asm = get_option('asm')
-with_llvm = get_option('llvm')
with_osmesa = get_option('osmesa')
if get_option('texture-float')
pre_args += '-DTEXTURE_FLOAT_ENABLED'
@@ -711,30 +710,33 @@ llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
if with_amd_vk
llvm_modules += ['amdgpu', 'bitreader', 'ipo']
endif
-dep_llvm = []
-if with_llvm
+
+_llvm = get_option('llvm')
+if _llvm == 'auto'
dep_llvm = dependency(
- 'llvm', version : '>= 3.9.0', required : with_amd_vk, modules : llvm_modules,
+ 'llvm', version : '>= 3.9.0', modules : llvm_modules,
+ required : with_amd_vk,
)
- if dep_llvm.found()
- _llvm_version = dep_llvm.version().split('.')
- # Development versions of LLVM have an 'svn' suffix, we don't want that for
- # our version checks.
- _llvm_patch = _llvm_version[2]
- if _llvm_patch.endswith('svn')
- _llvm_patch = _llvm_patch.split('s')[0]
- endif
- pre_args += [
- '-DHAVE_LLVM=***@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch),
- '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
- ]
- else
- if with_gallium_softpipe
- error('Cannot find LLVM to build LLVMPipe. If you wanted softpipe pass -Dllvm=false to meson')
- elif with_amd_vk or with_gallium_radeonsi # etc
- error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM was not found.')
- endif
- endif
+ with_llvm = dep_llvm.found()
+elif _llvm == 'true'
+ dep_llvm = dependency('llvm', version : '>= 3.9.0', modules : llvm_modules)
+ with_llvm = true
+else
+ dep_llvm = []
+ with_llvm = false
+endif
+if with_llvm
+ _llvm_version = dep_llvm.version().split('.')
+ # Development versions of LLVM have an 'svn' suffix, we don't want that for
+ # our version checks.
+ _llvm_patch = _llvm_version[2]
+ if _llvm_patch.endswith('svn')
+ _llvm_patch = _llvm_patch.split('s')[0]
+ endif
+ pre_args += [
+ '-DHAVE_LLVM=***@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], _llvm_patch),
+ '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
+ ]
elif with_amd_vk or with_gallium_radeonsi
error('The following drivers requires LLVM: Radv, RadeonSI. One of these is enabled, but LLVM is disabled.')
endif
diff --git a/meson_options.txt b/meson_options.txt
index 1134a250295..44d46fe0b32 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -132,8 +132,9 @@ option(
)
option(
'llvm',
- type : 'boolean',
- value : true,
+ type : 'combo',
+ value : 'auto',
+ choices : ['auto', 'true', 'false'],
description : 'Build with LLVM support.'
)
option(
--
2.15.0
Eric Engestrom
2017-11-21 14:21:51 UTC
Permalink
This is a rough cross section of work to get the meson build working on macOS
and on Haiku, with one radeonsi fixup added. Most of this work is pretty
straight forward, turning some options that can be assumed on Linux into
tri-states, fixing up some early windows and macos stubs that I put in during
the initial meosn pass, and removing some code duplication.
meson: Remove duplicate _GNU_SOURCE
meson: Convert platform to auto
meson: convert llvm option to tristate
meson: Fix LLVM requires for radeonsi
meson: add logic to select apple and windows dri
meson: replace with_*dri with with_dri_platform
Series is
meson.build | 77 +++++++++++++++++++++++++++-------------------
meson_options.txt | 9 +++---
src/glx/meson.build | 4 +--
src/mapi/glapi/meson.build | 2 +-
4 files changed, 54 insertions(+), 38 deletions(-)
--
2.15.0
Loading...