summaryrefslogtreecommitdiff
path: root/lib/mesa/meson.build
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-01-28 08:56:54 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-01-28 08:56:54 +0000
commitd305570c9b1fd87c4acdec589761cfa39fd04a3b (patch)
treee340315dd9d6966ccc3a48aa7a845e2213e40e62 /lib/mesa/meson.build
parent1c5c7896c1d54abd25c0f33ca996165b359eecb3 (diff)
Merge Mesa 22.3.4
Diffstat (limited to 'lib/mesa/meson.build')
-rw-r--r--lib/mesa/meson.build474
1 files changed, 286 insertions, 188 deletions
diff --git a/lib/mesa/meson.build b/lib/mesa/meson.build
index fae4e508a..a7c56e703 100644
--- a/lib/mesa/meson.build
+++ b/lib/mesa/meson.build
@@ -27,7 +27,7 @@ project(
).stdout(),
license : 'MIT',
meson_version : '>= 0.53',
- default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c11', 'cpp_std=c++14']
+ default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c11', 'cpp_std=c++17', 'rust_std=2021']
)
# In recent versions, meson can inject some extra arguments to get richer
@@ -63,6 +63,7 @@ cpp_args = []
with_moltenvk_dir = get_option('moltenvk-dir')
with_vulkan_icd_dir = get_option('vulkan-icd-dir')
with_tests = get_option('build-tests')
+with_glcpp_tests = get_option('enable-glcpp-tests')
with_aco_tests = get_option('build-aco-tests')
with_glx_read_only_text = get_option('glx-read-only-text')
with_glx_direct = get_option('glx-direct')
@@ -82,7 +83,6 @@ if with_tools.contains('all')
'lima',
'nir',
'nouveau',
- 'xvmc',
'asahi',
'imagination',
]
@@ -173,15 +173,18 @@ with_any_opengl = with_opengl or with_gles1 or with_gles2
# Only build shared_glapi if at least one OpenGL API is enabled
with_shared_glapi = with_shared_glapi and with_any_opengl
-system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos'].contains(host_machine.system())
+system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android'].contains(host_machine.system())
+
+with_freedreno_kgsl = get_option('freedreno-kgsl')
+if with_freedreno_kgsl
+ system_has_kms_drm = false
+endif
dri_drivers = get_option('dri-drivers')
if dri_drivers.length() != 0
error('Mesa\'s main branch no longer has any "classic" drivers, use the "amber" branch instead.')
endif
-with_dri = dri_drivers.length() != 0
-
gallium_drivers = get_option('gallium-drivers')
if gallium_drivers.contains('auto')
if system_has_kms_drm
@@ -193,7 +196,7 @@ if gallium_drivers.contains('auto')
]
elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
gallium_drivers = [
- 'v3d', 'vc4', 'freedreno', 'etnaviv', 'nouveau',
+ 'v3d', 'vc4', 'freedreno', 'etnaviv', 'nouveau', 'svga',
'tegra', 'virgl', 'lima', 'panfrost', 'swrast'
]
elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
@@ -236,8 +239,13 @@ foreach gallium_driver : gallium_drivers
endforeach
with_gallium = gallium_drivers.length() != 0
-with_gallium_kmsro = with_gallium_v3d or with_gallium_vc4 or with_gallium_etnaviv or with_gallium_panfrost or with_gallium_lima or with_gallium_freedreno
+with_gallium_kmsro = with_gallium_v3d or with_gallium_vc4 or with_gallium_etnaviv or with_gallium_panfrost or with_gallium_lima or with_gallium_freedreno or with_gallium_asahi
+
+if not system_has_kms_drm
+ with_gallium_kmsro = false
+endif
+with_dri = false
if with_gallium and system_has_kms_drm
_glx = get_option('glx')
_egl = get_option('egl')
@@ -250,7 +258,7 @@ _vulkan_drivers = get_option('vulkan-drivers')
if _vulkan_drivers.contains('auto')
if system_has_kms_drm
if host_machine.cpu_family().startswith('x86')
- _vulkan_drivers = ['amd', 'intel', 'swrast']
+ _vulkan_drivers = ['amd', 'intel', 'intel_hasvk', 'swrast']
elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
_vulkan_drivers = ['swrast']
elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
@@ -269,12 +277,12 @@ if _vulkan_drivers.contains('auto')
endif
with_intel_vk = _vulkan_drivers.contains('intel')
+with_intel_hasvk = _vulkan_drivers.contains('intel_hasvk')
with_amd_vk = _vulkan_drivers.contains('amd')
with_freedreno_vk = _vulkan_drivers.contains('freedreno')
with_panfrost_vk = _vulkan_drivers.contains('panfrost')
with_swrast_vk = _vulkan_drivers.contains('swrast')
with_virtio_vk = _vulkan_drivers.contains('virtio-experimental')
-with_freedreno_kgsl = get_option('freedreno-kgsl')
with_freedreno_virtio = get_option('freedreno-virtio')
with_broadcom_vk = _vulkan_drivers.contains('broadcom')
with_imagination_vk = _vulkan_drivers.contains('imagination-experimental')
@@ -283,7 +291,7 @@ with_microsoft_vk = _vulkan_drivers.contains('microsoft-experimental')
with_any_vk = _vulkan_drivers.length() != 0
with_any_broadcom = with_gallium_vc4 or with_gallium_v3d or with_broadcom_vk
-with_any_intel = with_intel_vk or with_gallium_iris or with_gallium_crocus or with_intel_tools
+with_any_intel = with_intel_vk or with_intel_hasvk or with_gallium_iris or with_gallium_crocus or with_intel_tools
if with_swrast_vk and not with_gallium_softpipe
error('swrast vulkan requires gallium swrast')
@@ -296,7 +304,13 @@ if with_aco_tests and not with_amd_vk
endif
with_microsoft_clc = get_option('microsoft-clc').enabled()
-with_intel_clc = get_option('intel-clc').enabled()
+if ['x86_64'].contains(host_machine.cpu_family())
+ with_intel_clc = get_option('intel-clc').enabled()
+ with_intel_vk_rt = with_intel_vk and with_intel_clc
+else
+ with_intel_clc = false
+ with_intel_vk_rt = false
+endif
with_clc = with_microsoft_clc or with_intel_clc
with_libclc = with_clc
with_spirv_to_dxil = get_option('spirv-to-dxil')
@@ -320,6 +334,11 @@ if with_vulkan_beta
pre_args += '-DVK_ENABLE_BETA_EXTENSIONS'
endif
+_codecs = get_option('video-codecs')
+foreach c : ['vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc']
+ pre_args += '-DVIDEO_CODEC_@0@=@1@'.format(c.to_upper(), _codecs.contains(c).to_int())
+endforeach
+
_platforms = get_option('platforms')
if _platforms.contains('auto')
if system_has_kms_drm
@@ -499,13 +518,6 @@ foreach platform : _platforms
pre_args += '-DHAVE_@0@_PLATFORM'.format(platform.to_upper())
endforeach
-if host_machine.system() == 'openbsd'
- use_elf_tls = false
-else
- use_elf_tls = true
- pre_args += '-DUSE_ELF_TLS'
-endif
-
if with_platform_android and get_option('platform-sdk-version') >= 29
# By default the NDK compiler, at least, emits emutls references instead of
# ELF TLS, even when building targeting newer API levels. Make it actually do
@@ -549,14 +561,6 @@ if not have_mtls_dialect
endif
endif
-if with_platform_windows and with_shared_glapi
- # Windows doesn't support DLL exports/imports being TLS variables. When using shared
- # glapi, libglapi.dll hosts the TLS, but other DLLs need to use them. Instead of falling
- # all the way back to using globals and manual per-thread data, keep using TLS but just
- # put accesses to it behind a function so the variable doesn't need to be exported.
- pre_args += '-DUSE_TLS_BEHIND_FUNCTIONS'
-endif
-
if with_glx != 'disabled'
if not (with_platform_x11 and with_any_opengl)
error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
@@ -624,6 +628,25 @@ if with_gallium_kmsro and (with_platform_x11 and not with_dri3)
error('kmsro requires dri3 for X11 support')
endif
+dep_dxheaders = null_dep
+if with_gallium_d3d12 or with_microsoft_clc or with_microsoft_vk
+ dep_dxheaders = dependency('directx-headers', required : false)
+ if not dep_dxheaders.found()
+ dep_dxheaders = dependency('DirectX-Headers',
+ version : '>= 1.606.4',
+ fallback : ['DirectX-Headers', 'dep_dxheaders'],
+ required : with_gallium_d3d12 or with_microsoft_vk
+ )
+ endif
+endif
+
+_with_gallium_d3d12_video = get_option('gallium-d3d12-video')
+with_gallium_d3d12_video = false
+if with_gallium_d3d12 and not _with_gallium_d3d12_video.disabled()
+ with_gallium_d3d12_video = true
+ pre_args += '-DHAVE_GALLIUM_D3D12_VIDEO'
+endif
+
_vdpau = get_option('gallium-vdpau')
if _vdpau == 'true'
_vdpau = 'enabled'
@@ -645,9 +668,9 @@ elif not with_platform_x11
_vdpau = 'disabled'
endif
elif not (with_gallium_r300 or with_gallium_r600 or with_gallium_radeonsi or
- with_gallium_nouveau)
+ with_gallium_nouveau or with_gallium_d3d12_video or with_gallium_virgl)
if _vdpau == 'enabled'
- error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau.')
+ error('VDPAU state tracker requires at least one of the following gallium drivers: r300, r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video, virgl).')
else
_vdpau = 'disabled'
endif
@@ -670,65 +693,16 @@ if vdpau_drivers_path == ''
vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')
endif
-if with_gallium_zink
- dep_vulkan = dependency('vulkan')
-endif
-
-dep_dxheaders = null_dep
-if with_gallium_d3d12 or with_microsoft_clc or with_microsoft_vk
- dep_dxheaders = dependency('directx-headers', required : false)
- if not dep_dxheaders.found()
- dep_dxheaders = dependency('DirectX-Headers', fallback : ['DirectX-Headers', 'dep_dxheaders'],
- required : with_gallium_d3d12 or with_microsoft_vk
- )
- endif
-endif
-
-if with_vulkan_overlay_layer or with_aco_tests
+if with_vulkan_overlay_layer or with_aco_tests or with_amd_vk
prog_glslang = find_program('glslangValidator')
-endif
-
-_xvmc = get_option('gallium-xvmc')
-if _xvmc == 'true'
- _xvmc = 'enabled'
- warning('gallium-xvmc option "true" deprecated, please use "enabled" instead.')
-elif _xvmc == 'false'
- _xvmc = 'disabled'
- warning('gallium-xvmc option "false" deprecated, please use "disabled" instead.')
-endif
-if not system_has_kms_drm
- if _xvmc == 'enabled'
- error('XVMC state tracker can only be build on unix-like OSes.')
+ if run_command(prog_glslang, [ '--quiet', '--version' ], check : false).returncode() == 0
+ glslang_quiet = ['--quiet']
else
- _xvmc = 'disabled'
+ glslang_quiet = []
endif
-elif not with_platform_x11
- if _xvmc == 'enabled'
- error('XVMC state tracker requires X11 support.')
- else
- _xvmc = 'disabled'
- endif
-elif not (with_gallium_r600 or with_gallium_nouveau)
- if _xvmc == 'enabled'
- error('XVMC state tracker requires at least one of the following gallium drivers: r600, nouveau.')
- else
- _xvmc = 'disabled'
- endif
-endif
-dep_xvmc = null_dep
-dep_xv = null_dep
-with_gallium_xvmc = false
-if _xvmc != 'disabled'
- dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'enabled')
- dep_xv = dependency('xv', required : _xvmc == 'enabled')
- with_gallium_xvmc = dep_xvmc.found() and dep_xv.found()
-endif
-
-xvmc_drivers_path = get_option('xvmc-libs-path')
-if xvmc_drivers_path == ''
- xvmc_drivers_path = get_option('libdir')
endif
+dep_xv = null_dep
_omx = get_option('gallium-omx')
if not system_has_kms_drm
if ['auto', 'disabled'].contains(_omx)
@@ -788,10 +762,10 @@ omx_drivers_path = get_option('omx-libs-path')
if with_gallium_omx != 'disabled'
# Figure out where to put the omx driver.
# FIXME: this could all be vastly simplified by adding a 'defined_variable'
- # argument to meson's get_pkgconfig_variable method.
+ # argument to meson's get_variable method.
if omx_drivers_path == ''
- _omx_libdir = dep_omx.get_pkgconfig_variable('libdir')
- _omx_drivers_dir = dep_omx.get_pkgconfig_variable('pluginsdir')
+ _omx_libdir = dep_omx.get_variable(pkgconfig : 'libdir')
+ _omx_drivers_dir = dep_omx.get_variable(pkgconfig : 'pluginsdir')
if _omx_libdir == get_option('libdir')
omx_drivers_path = _omx_drivers_dir
else
@@ -817,15 +791,9 @@ elif _va == 'false'
_va = 'disabled'
warning('gallium-va option "false" deprecated, please use "disabled" instead.')
endif
-if not system_has_kms_drm
+if not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau or with_gallium_d3d12_video or with_gallium_virgl)
if _va == 'enabled'
- error('VA state tracker can only be built on unix-like OSes.')
- else
- _va = 'disabled'
- endif
-elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau)
- if _va == 'enabled'
- error('VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.')
+ error('VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video), virgl.')
else
_va = 'disabled'
endif
@@ -833,7 +801,11 @@ endif
with_gallium_va = false
dep_va = null_dep
if _va != 'disabled'
- dep_va = dependency('libva', version : '>= 1.8.0', required : _va == 'enabled')
+ _dep_va_name = 'libva'
+ if host_machine.system() == 'windows'
+ _dep_va_name = 'libva-win32'
+ endif
+ dep_va = dependency(_dep_va_name, version : '>= 1.8.0', required : _va == 'enabled')
if dep_va.found()
dep_va_headers = dep_va.partial_dependency(compile_args : true)
with_gallium_va = true
@@ -952,6 +924,22 @@ else
with_opencl_icd = false
endif
+with_gallium_rusticl = get_option('gallium-rusticl')
+if with_gallium_rusticl
+ if not with_gallium
+ error('rusticl requires at least one gallium driver.')
+ endif
+
+ if meson.version().version_compare('< 0.61.4')
+ error('rusticl requires meson 0.61.4 or newer')
+ endif
+
+ add_languages('rust', required: true)
+
+ with_clc = true
+ with_libclc = true
+endif
+
dep_clc = null_dep
if with_libclc
dep_clc = dependency('libclc')
@@ -959,7 +947,7 @@ endif
gl_pkgconfig_c_flags = []
if with_platform_x11
- if with_glx == 'xlib' or with_glx == 'gallium-xlib'
+ if with_glx == 'xlib'
pre_args += '-DUSE_XSHM'
else
pre_args += '-DGLX_INDIRECT_RENDERING'
@@ -974,9 +962,6 @@ if with_platform_x11
pre_args += '-DGLX_USE_WINDOWSGL'
endif
endif
-else
- pre_args += '-DEGL_NO_X11'
- gl_pkgconfig_c_flags += '-DEGL_NO_X11'
endif
with_android_stub = get_option('android-stub')
@@ -1086,8 +1071,12 @@ if cc.compiles('__uint128_t foo(void) { return 0; }',
pre_args += '-DHAVE_UINT128'
endif
+if cc.has_function('reallocarray')
+ pre_args += '-DHAVE_REALLOCARRAY'
+endif
+
# TODO: this is very incomplete
-if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd', 'haiku'].contains(host_machine.system())
+if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd', 'haiku', 'android'].contains(host_machine.system())
pre_args += '-D_GNU_SOURCE'
elif host_machine.system() == 'sunos'
pre_args += '-D__EXTENSIONS__'
@@ -1097,7 +1086,7 @@ elif host_machine.system() == 'windows'
'-DPIPE_SUBSYSTEM_WINDOWS_USER',
'-D_USE_MATH_DEFINES', # XXX: scons didn't use this for mingw
]
- if cc.get_id() == 'msvc'
+ if cc.get_argument_syntax() == 'msvc'
pre_args += [
'-DVC_EXTRALEAN',
'-D_CRT_SECURE_NO_WARNINGS',
@@ -1130,7 +1119,7 @@ endif
c_msvc_compat_args = []
no_override_init_args = []
cpp_msvc_compat_args = []
-if cc.get_id() == 'msvc'
+if cc.get_argument_syntax() == 'msvc'
_trial = [
'/wd4018', # signed/unsigned mismatch
'/wd4056', # overflow in floating-point constant arithmetic
@@ -1170,6 +1159,7 @@ else
'-fno-common',
# Clang
'-Wno-microsoft-enum-value',
+ '-Wno-unused-function',
]
_trial_cpp = [
'-Werror=return-type',
@@ -1190,7 +1180,7 @@ else
]
# MinGW chokes on format specifiers and I can't get it all working
- if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows')
+ if not (cc.get_argument_syntax() == 'gcc' and host_machine.system() == 'windows')
_trial_c += ['-Werror=format', '-Wformat-security']
_trial_cpp += ['-Werror=format', '-Wformat-security']
endif
@@ -1209,6 +1199,14 @@ else
_trial_cpp += ['-ffunction-sections', '-fdata-sections']
endif
+ # Variables that are only used for assertions are considered unused in release
+ # builds. Don't treat this as an error, since we build with -Werror even for
+ # release in CI.
+ if get_option('buildtype') == 'release'
+ _trial_c += ['-Wno-unused-variable', '-Wno-unused-but-set-variable']
+ _trial_cpp += ['-Wno-unused-variable', '-Wno-unused-but-set-variable']
+ endif
+
c_args += cc.get_supported_arguments(_trial_c)
cpp_args += cpp.get_supported_arguments(_trial_cpp)
@@ -1219,14 +1217,14 @@ else
# Check for C and C++ arguments for MSVC compatibility. These are only used
# in parts of the mesa code base that need to compile with MSVC, mainly
# common code
- _trial_msvc = ['-Werror=pointer-arith', '-Werror=gnu-empty-initializer']
+ _trial_msvc = ['-Werror=pointer-arith', '-Werror=vla', '-Werror=gnu-empty-initializer']
c_msvc_compat_args += cc.get_supported_arguments(_trial_msvc)
cpp_msvc_compat_args += cpp.get_supported_arguments(_trial_msvc)
endif
# set linker arguments
if host_machine.system() == 'windows'
- if cc.get_id() == 'msvc'
+ if cc.get_argument_syntax() == 'msvc'
add_project_link_arguments(
'/fixed:no',
'/dynamicbase',
@@ -1261,7 +1259,7 @@ if host_machine.system() == 'windows'
endif
endif
-if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
+if host_machine.cpu_family().startswith('x86') and cc.get_argument_syntax() != 'msvc'
pre_args += '-DUSE_SSE41'
with_sse41 = true
sse41_args = ['-msse4.1']
@@ -1413,13 +1411,69 @@ foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'sys/shm.h', '
endif
endforeach
-foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create', 'random_r',
- 'flock', 'strtok_r', 'getrandom', 'qsort_r', 'qsort_s', 'arc4random_buf']
- if cc.has_function(f)
+functions_to_detect = {
+ 'strtof': '',
+ 'mkostemp': '',
+ 'timespec_get': '#include <time.h>',
+ 'memfd_create': '',
+ 'random_r': '',
+ 'arc4random_buf': '',
+ 'flock': '',
+ 'strtok_r': '',
+ 'getrandom': '',
+ 'qsort_s': '',
+}
+
+foreach f, prefix: functions_to_detect
+ if cc.has_function(f, prefix: prefix)
pre_args += '-DHAVE_@0@'.format(f.to_upper())
endif
endforeach
+if cpp.links('''
+ #define _GNU_SOURCE
+ #include <stdlib.h>
+
+ static int dcomp(const void *l, const void *r, void *t) { return 0; }
+
+ int main(int ac, char **av) {
+ int arr[] = { 1 };
+ void *t = NULL;
+ qsort_r((void*)&arr[0], 1, 1, dcomp, t);
+ return (0);
+ }''',
+ args : pre_args,
+ name : 'GNU qsort_r')
+ pre_args += '-DHAVE_GNU_QSORT_R'
+elif cpp.links('''
+ #include <stdlib.h>
+
+ static int dcomp(void *t, const void *l, const void *r) { return 0; }
+
+ int main(int ac, char **av) {
+ int arr[] = { 1 };
+ void *t = NULL;
+ qsort_r((void*)&arr[0], 1, 1, t, dcomp);
+ return (0);
+ }''',
+ args : pre_args,
+ name : 'BSD qsort_r')
+ pre_args += '-DHAVE_BSD_QSORT_R'
+endif
+
+if cc.has_header_symbol('time.h', 'struct timespec')
+ pre_args += '-DHAVE_STRUCT_TIMESPEC'
+endif
+
+with_c11_threads = false
+if cc.has_function('thrd_create', prefix: '#include <threads.h>')
+ if with_platform_android
+ # Current only Android's c11 <threads.h> are verified
+ pre_args += '-DHAVE_THRD_CREATE'
+ with_c11_threads = true
+ endif
+endif
+
if cc.has_header_symbol('errno.h', 'program_invocation_name',
args : '-D_GNU_SOURCE')
pre_args += '-DHAVE_PROGRAM_INVOCATION_NAME'
@@ -1427,6 +1481,11 @@ elif with_tools.contains('intel')
error('Intel tools require the program_invocation_name variable')
endif
+if cc.has_header_symbol('math.h', 'issignaling',
+ args : '-D_GNU_SOURCE')
+ pre_args += '-DHAVE_ISSIGNALING'
+endif
+
# MinGW provides a __builtin_posix_memalign function, but not a posix_memalign.
# This means that this check will succeed, but then compilation will later
# fail. MSVC doesn't have this function at all, so only check for it on
@@ -1477,14 +1536,14 @@ endif
with_ld_version_script = false
if cc.links('int main() { return 0; }',
args : '-Wl,--version-script=@0@'.format(
- join_paths(meson.source_root(), 'build-support/conftest.map')),
+ join_paths(meson.current_source_dir(), 'build-support/conftest.map')),
name : 'version-script')
with_ld_version_script = true
endif
with_ld_dynamic_list = false
if cc.links('int main() { return 0; }',
args : '-Wl,--dynamic-list=@0@'.format(
- join_paths(meson.source_root(), 'build-support/conftest.dyn')),
+ join_paths(meson.current_source_dir(), 'build-support/conftest.dyn')),
name : 'dynamic-list')
with_ld_dynamic_list = true
endif
@@ -1496,17 +1555,19 @@ endif
# check for dl support
dep_dl = null_dep
-if not cc.has_function('dlopen')
- dep_dl = cc.find_library('dl', required : host_machine.system() != 'windows')
-endif
-if cc.has_function('dladdr', dependencies : dep_dl)
- # This is really only required for util/disk_cache.h
- pre_args += '-DHAVE_DLADDR'
+if host_machine.system() != 'windows'
+ if not cc.has_function('dlopen')
+ dep_dl = cc.find_library('dl', required : true)
+ endif
+ if cc.has_function('dladdr', dependencies : dep_dl)
+ # This is really only required for util/disk_cache.h
+ pre_args += '-DHAVE_DLADDR'
+ endif
endif
if cc.has_function('dl_iterate_phdr')
pre_args += '-DHAVE_DL_ITERATE_PHDR'
-elif with_intel_vk
+elif with_intel_vk or with_intel_hasvk
error('Intel "Anvil" Vulkan driver requires the dl_iterate_phdr function')
endif
@@ -1548,8 +1609,15 @@ elif with_shader_cache
error('Shader Cache requires compression')
endif
-dep_thread = dependency('threads')
-if dep_thread.found() and host_machine.system() != 'windows'
+if host_machine.system() == 'windows'
+ # For MSVC and MinGW we aren't using pthreads, and dependency('threads') will add linkage
+ # to pthread for MinGW, so leave the dependency null_dep for Windows. For Windows linking to
+ # kernel32 is enough for c11/threads.h and it's already linked by meson by default
+ dep_thread = null_dep
+else
+ dep_thread = dependency('threads')
+endif
+if dep_thread.found()
pre_args += '-DHAVE_PTHREAD'
if host_machine.system() != 'netbsd' and cc.has_function(
'pthread_setaffinity_np',
@@ -1567,6 +1635,10 @@ elif host_machine.system() != 'windows'
else
dep_expat = null_dep
endif
+# Predefined macros for windows
+if host_machine.system() == 'windows'
+ pre_args += '-DWIN32_LEAN_AND_MEAN' # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx
+endif
# this only exists on linux so either this is linux and it will be found, or
# it's not linux and wont
dep_m = cc.find_library('m', required : false)
@@ -1584,6 +1656,15 @@ if with_platform_haiku
dep_network = cc.find_library('network')
endif
+dep_futex = null_dep
+if host_machine.system() == 'windows'
+ if (get_option('min-windows-version') < 8)
+ pre_args += '-DWINDOWS_NO_FUTEX'
+ else
+ dep_futex = cc.find_library('synchronization', required : true)
+ endif
+endif
+
# Check for libdrm. Various drivers have different libdrm version requirements,
# but we always want to use the same version for all libdrm modules. That means
# even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and
@@ -1651,7 +1732,7 @@ endif
llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit', 'core', 'executionengine', 'scalaropts', 'transformutils', 'instcombine']
llvm_optional_modules = ['coroutines']
if with_amd_vk or with_gallium_radeonsi or with_gallium_r600
- llvm_modules += ['amdgpu', 'native', 'bitreader', 'ipo']
+ llvm_modules += ['amdgpu', 'bitreader', 'ipo']
if with_gallium_r600
llvm_modules += 'asmparser'
endif
@@ -1661,24 +1742,31 @@ if with_gallium_opencl
'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
'lto', 'option', 'objcarcopts', 'profiledata'
]
- llvm_optional_modules += ['all-targets', 'frontendopenmp']
+ # all-targets is needed to support static linking LLVM build with multiple targets
+ # windowsdriver is needded with LLVM>=15, but we don't know what LLVM verrsion we are using yet
+ llvm_optional_modules += ['all-targets', 'frontendopenmp', 'windowsdriver']
endif
if with_clc
llvm_modules += ['coverage', 'target', 'linker', 'irreader', 'option', 'libdriver', 'lto']
- llvm_optional_modules += ['all-targets']
+ # all-targets is needed to support static linking LLVM build with multiple targets
+ # windowsdriver is needded with LLVM>=15, but we don't know what LLVM verrsion we are using yet
+ llvm_optional_modules += ['all-targets', 'windowsdriver']
endif
-if with_tests or with_gallium_softpipe
+draw_with_llvm = get_option('draw-use-llvm')
+if draw_with_llvm
llvm_modules += 'native'
+ # lto is needded with LLVM>=15, but we don't know what LLVM verrsion we are using yet
+ llvm_optional_modules += ['lto']
endif
-if with_amd_vk or with_gallium_radeonsi
+if with_intel_clc
+ _llvm_version = '>= 13.0.0'
+elif with_amd_vk or with_gallium_radeonsi or with_gallium_opencl
_llvm_version = '>= 11.0.0'
elif with_clc
_llvm_version = '>= 10.0.0'
-elif with_gallium_opencl
- _llvm_version = '>= 8.0.0'
else
- _llvm_version = '>= 3.9.0'
+ _llvm_version = '>= 5.0.0'
endif
_shared_llvm = get_option('shared-llvm')
@@ -1715,7 +1803,6 @@ endif
dep_llvm = null_dep
with_llvm = false
-draw_with_llvm = get_option('draw-use-llvm')
if _llvm != 'disabled'
dep_llvm = dependency(
'llvm',
@@ -1744,10 +1831,10 @@ if with_llvm
error('Lavapipe requires LLVM draw support.')
endif
- if cc.get_id() != 'msvc'
+ if host_machine.system() != 'windows'
# LLVM can be built without rtti, turning off rtti changes the ABI of C++
# programs, so we need to build all C++ code in mesa without rtti as well to
- # ensure that linking works. Note that MSVC does handle mismatching RTTI
+ # ensure that linking works. Note that Win32 compilers does handle mismatching RTTI
# without issues, so only apply this for other compilers.
if dep_llvm.type_name() == 'internal'
_llvm_rtti = subproject('llvm').get_variable('has_rtti', true)
@@ -1762,7 +1849,9 @@ if with_llvm
error('LLVM was built without RTTI, so Mesa must also disable RTTI. Use an LLVM built with LLVM_ENABLE_RTTI or add cpp_rtti=false.')
endif
endif
- else
+ endif
+
+ if cc.get_argument_syntax() == 'msvc'
# Suppress "/DELAYLOAD:ole32.dll/shell32.dll ignored" warnings that LLVM adds
add_project_link_arguments(
'/ignore:4199',
@@ -1789,12 +1878,18 @@ if with_opencl_spirv
# Require an SPIRV-LLVM-Translator version compatible with the chosen LLVM
# one.
+
+ # This first version check is still needed as maybe LLVM 8.0 was picked but
+ # we do not want to accept SPIRV-LLVM-Translator 8.0.0.1 as that version
+ # does not have the required API and those are only available starting from
+ # 8.0.1.3.
+ _llvmspirvlib_min_version = '>= 8.0.1.3'
+ if with_intel_clc
+ _llvmspirvlib_min_version = '>= 13.0.0.0'
+ endif
+
_llvmspirvlib_version = [
- # This first version check is still needed as maybe LLVM 8.0 was picked but
- # we do not want to accept SPIRV-LLVM-Translator 8.0.0.1 as that version does
- # not have the required API and those are only available starting from
- # 8.0.1.3.
- '>= 8.0.1.3',
+ _llvmspirvlib_min_version,
'>= @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor),
'< @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor + 1) ]
@@ -1812,13 +1907,16 @@ if with_clc
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
- if not dep_clang.found()
+ if not dep_clang.found() or not _shared_llvm
clang_modules = [
'clangBasic', 'clangAST', 'clangCodeGen', 'clangLex',
'clangDriver', 'clangFrontend', 'clangFrontendTool',
'clangHandleCXX', 'clangHandleLLVM', 'clangSerialization',
'clangSema', 'clangParse', 'clangEdit', 'clangAnalysis'
]
+ if dep_llvm.version().version_compare('>= 15.0')
+ clang_modules += 'clangSupport'
+ endif
dep_clang = []
foreach m : clang_modules
@@ -1830,25 +1928,16 @@ endif
# Be explicit about only using this lib on Windows, to avoid picking
# up random libs with the generic name 'libversion'
dep_version = null_dep
-if with_opencl_spirv and host_machine.system() == 'windows'
+if host_machine.system() == 'windows'
dep_version = cpp.find_library('version')
endif
-with_opencl_native = _opencl != 'disabled' and get_option('opencl-native')
-
-if (with_amd_vk or with_gallium_radeonsi or
- (with_gallium_opencl and with_opencl_native) or
- (with_gallium_r600 and with_llvm))
- if with_platform_windows
- dep_elf = dependency('libelf', required : false, fallback : ['libelf', 'libelf_dep'])
- else
- dep_elf = dependency('libelf', required : false)
- endif
- if not dep_elf.found()
- dep_elf = cc.find_library('elf')
- endif
-else
- dep_elf = null_dep
+dep_elf = dependency('libelf', required : false)
+if not with_platform_windows and not dep_elf.found()
+ dep_elf = cc.find_library('elf', required : false)
+endif
+if dep_elf.found()
+ pre_args += '-DUSE_LIBELF'
endif
dep_glvnd = null_dep
@@ -1894,32 +1983,29 @@ if build_machine.system() == 'windows'
# windows compatibility (uses <io.h> instead of <unistd.h> and _isatty,
# _fileno functions)
prog_flex = [prog_flex, '--wincompat']
- if get_option('c_std') == 'c99'
- prog_flex += '-D__STDC_VERSION__=199901'
- endif
else
- prog_flex = [find_program('flex', 'lex', required : with_any_opengl)]
+ prog_flex = [find_program('flex', 'lex', required : with_any_opengl, disabler : true)]
endif
# Force flex to use const keyword in prototypes, as relies on __cplusplus or
- # __STDC__ macro to determine whether it's safe to use const keyword, but
- # MSVC only defines __STDC_VERSION__ for C11/C17.
+ # __STDC__ macro to determine whether it's safe to use const keyword
prog_flex += '-DYY_USE_CONST='
prog_flex_cpp = prog_flex
- if get_option('c_std') != 'c99'
- # Convince win_flex to use <inttypes.h> for C++ files
- prog_flex_cpp += '-D__STDC_VERSION__=199901'
- endif
+ # Convince win_flex to use <inttypes.h> for C++ files
+ # Note that we are using a C99 version here rather than C11,
+ # because using a C11 version can cause the MSVC CRT headers to define
+ # static_assert to _Static_assert, which breaks other parts of the CRT
+ prog_flex_cpp += '-D__STDC_VERSION__=199901'
prog_bison = find_program('win_bison', required : false)
if not prog_bison.found()
- prog_bison = find_program('bison', 'yacc', required : with_any_opengl)
+ prog_bison = find_program('bison', 'yacc', required : with_any_opengl, disabler : true)
endif
else
prog_bison = find_program('bison', required : false)
if not prog_bison.found()
- prog_bison = find_program('byacc', required : with_any_opengl)
+ prog_bison = find_program('byacc', required : with_any_opengl, disabler : true)
yacc_is_bison = false
endif
@@ -1930,7 +2016,7 @@ else
prog_bison = [prog_bison, '-Wno-deprecated']
endif
- prog_flex = find_program('flex', required : with_any_opengl)
+ prog_flex = find_program('flex', required : with_any_opengl, disabler : true)
prog_flex_cpp = prog_flex
endif
@@ -1978,11 +2064,8 @@ if with_osmesa
osmesa_lib_name = 'OSMesa'
endif
osmesa_bits = get_option('osmesa-bits')
- if osmesa_bits != '8'
- if with_dri or with_glx != 'disabled'
- error('OSMesa bits must be 8 if building glx or dri based drivers')
- endif
- osmesa_lib_name = osmesa_lib_name + osmesa_bits
+ if osmesa_bits != 'unspecified'
+ warning('osmesa-bits option is deprecated and have no effect, please remove it.')
endif
endif
@@ -1990,7 +2073,7 @@ endif
if with_platform_wayland
dep_wl_scanner = dependency('wayland-scanner', native: true)
- prog_wl_scanner = find_program(dep_wl_scanner.get_pkgconfig_variable('wayland_scanner'))
+ prog_wl_scanner = find_program(dep_wl_scanner.get_variable(pkgconfig : 'wayland_scanner'))
if dep_wl_scanner.version().version_compare('>= 1.15')
wl_scanner_arg = 'private-code'
else
@@ -2004,7 +2087,7 @@ if with_platform_wayland
dep_wayland_egl_headers = dep_wayland_egl.partial_dependency(compile_args : true)
endif
wayland_dmabuf_xml = join_paths(
- dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
+ dep_wl_protocols.get_variable(pkgconfig : 'pkgdatadir'), 'unstable',
'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
)
pre_args += '-DWL_HIDE_DEPRECATED'
@@ -2039,11 +2122,13 @@ if host_machine.cpu_family() == 'x86_64' and cc.get_id() == 'gcc'
endif
endif
+with_dri3_modifiers = false
if with_platform_x11
- if with_glx == 'xlib' or with_glx == 'gallium-xlib'
+ if with_glx == 'xlib'
dep_x11 = dependency('x11')
dep_xext = dependency('xext')
dep_xcb = dependency('xcb')
+ dep_xcb_xrandr = dependency('xcb-randr')
elif with_glx == 'dri'
dep_x11 = dependency('x11')
dep_xext = dependency('xext')
@@ -2052,7 +2137,7 @@ if with_platform_x11
dep_xcb_shm = dependency('xcb-shm')
endif
if (with_any_vk or with_glx == 'dri' or with_egl or
- (with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or
+ (with_gallium_vdpau or with_gallium_va or
with_gallium_omx != 'disabled'))
dep_xcb = dependency('xcb')
dep_x11_xcb = dependency('x11-xcb')
@@ -2064,20 +2149,19 @@ if with_platform_x11
dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
if with_dri3
- pre_args += '-DHAVE_DRI3'
dep_xcb_dri3 = dependency('xcb-dri3')
dep_xcb_present = dependency('xcb-present')
# until xcb-dri3 has been around long enough to make a hard-dependency:
if (dep_xcb_dri3.version().version_compare('>= 1.13') and
dep_xcb_present.version().version_compare('>= 1.13'))
- pre_args += '-DHAVE_DRI3_MODIFIERS'
+ with_dri3_modifiers = true
endif
dep_xcb_shm = dependency('xcb-shm')
dep_xcb_sync = dependency('xcb-sync')
dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
endif
endif
- if with_glx == 'dri' or with_glx == 'gallium-xlib'
+ if with_glx == 'dri' or with_glx == 'xlib'
dep_glproto = dependency('glproto', version : '>= 1.4.14')
endif
if with_glx == 'dri'
@@ -2090,7 +2174,7 @@ if with_platform_x11
endif
if (with_egl or
with_dri3 or (
- with_gallium_vdpau or with_gallium_xvmc or with_gallium_xa or
+ with_gallium_vdpau or with_gallium_xa or
with_gallium_omx != 'disabled'))
dep_xcb_xfixes = dependency('xcb-xfixes')
endif
@@ -2102,6 +2186,22 @@ if with_platform_x11
endif
endif
+if with_dri
+ pre_args += '-DHAVE_DRI'
+endif
+if with_dri2
+ pre_args += '-DHAVE_DRI2'
+endif
+if with_dri3
+ pre_args += '-DHAVE_DRI3'
+endif
+if with_dri3_modifiers
+ pre_args += '-DHAVE_DRI3_MODIFIERS'
+endif
+if with_gallium_drisw_kms
+ pre_args += '-DHAVE_DRISW_KMS'
+endif
+
if get_option('gallium-extra-hud')
pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1'
endif
@@ -2143,7 +2243,7 @@ add_project_arguments(cpp_args, language : ['cpp'])
gl_priv_reqs = []
-if with_glx == 'xlib' or with_glx == 'gallium-xlib'
+if with_glx == 'xlib'
gl_priv_reqs += ['x11', 'xext', 'xcb']
elif with_glx == 'dri'
gl_priv_reqs += [
@@ -2197,6 +2297,8 @@ gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : []
devenv = environment()
+dir_compiler_nir = join_paths(meson.current_source_dir(), 'src/compiler/nir/')
+
subdir('include')
subdir('bin')
subdir('src')
@@ -2225,11 +2327,6 @@ endif
if with_dri
lines += ''
lines += 'DRI platform: ' + with_dri_platform
- if dri_drivers.length() != 0 and dri_drivers != ['']
- lines += 'DRI drivers: ' + ' '.join(dri_drivers)
- else
- lines += 'DRI drivers: no'
- endif
lines += 'DRI driver dir: ' + dri_drivers_path
endif
@@ -2268,12 +2365,16 @@ if with_gbm
endif
lines += ''
+lines += 'Video Codecs: ' + ' '.join(_codecs)
+lines += ''
+
if with_any_vk
lines += 'Vulkan drivers: ' + ' '.join(_vulkan_drivers)
lines += 'Vulkan ICD dir: ' + with_vulkan_icd_dir
if with_any_vulkan_layers
lines += 'Vulkan layers: ' + ' '.join(get_option('vulkan-layers'))
endif
+ lines += 'Vulkan Intel Ray Tracing: ' + (with_intel_vk_rt ? 'yes' : 'no')
else
lines += 'Vulkan drivers: no'
endif
@@ -2293,9 +2394,6 @@ if with_gallium
if with_gallium_xa
gallium_st += 'xa'
endif
- if with_gallium_xvmc
- gallium_st += 'xvmc'
- endif
if with_gallium_vdpau
gallium_st += 'vdpau'
endif