6
6
[' c' , ' cpp' ],
7
7
version : files (' VERSION' ),
8
8
license : ' MIT' ,
9
- meson_version : ' >= 1.3 .0' ,
9
+ meson_version : ' >= 1.1 .0' ,
10
10
default_options : [
11
11
' buildtype=debugoptimized' ,
12
12
' b_ndebug=if-release' ,
@@ -44,22 +44,6 @@ with_mesa_debug = get_option('buildtype') == 'debug'
44
44
# This means the final value of b_ndebug==true
45
45
with_mesa_ndebug = get_option (' b_ndebug' ) == ' true' or (get_option (' buildtype' ) == ' release' and get_option (' b_ndebug' ) == ' if-release' )
46
46
47
- # We need to set -fmacro-prefix-map properly for driver CL reproducability.
48
- relative_dir = fs.relative_to(meson .global_source_root(), meson .global_build_root())
49
-
50
- cl_args = [
51
- ' -fmacro-prefix-map=@0@/=' .format(relative_dir),
52
-
53
- # Set the OpenCL standard to CL 2.0, enabling everything at a frontend.
54
- # Drivers may not actually support everything but that's ok.
55
- ' -cl-std=cl2.0' ,
56
- ' -D__OPENCL_VERSION__=200'
57
- ]
58
-
59
- if with_mesa_ndebug
60
- cl_args += [' -DNDEBUG' ]
61
- endif
62
-
63
47
# Arguments for the preprocessor, put these in a separate array from the C and
64
48
# C++ (cpp in meson terminology) arguments since they need to be added to the
65
49
# default arguments for both C and C++.
@@ -80,10 +64,10 @@ with_moltenvk_dir = get_option('moltenvk-dir')
80
64
with_vulkan_icd_dir = get_option (' vulkan-icd-dir' )
81
65
with_tests = get_option (' build-tests' )
82
66
with_glcpp_tests = get_option (' enable-glcpp-tests' )
83
- with_radv_tests = get_option (' build-radv-tests' )
84
67
with_aco_tests = get_option (' build-aco-tests' )
85
68
with_glx_read_only_text = get_option (' glx-read-only-text' )
86
69
with_glx_direct = get_option (' glx-direct' )
70
+ with_osmesa = get_option (' osmesa' )
87
71
with_vulkan_overlay_layer = get_option (' vulkan-layers' ).contains(' overlay' )
88
72
with_vulkan_device_select_layer = get_option (' vulkan-layers' ).contains(' device-select' )
89
73
with_vulkan_screenshot_layer = get_option (' vulkan-layers' ).contains(' screenshot' )
@@ -120,15 +104,28 @@ if gbm_backends_path == ''
120
104
gbm_backends_path = join_paths (get_option (' prefix' ), get_option (' libdir' ), ' gbm' )
121
105
endif
122
106
107
+ # Default shared glapi disabled for windows, enabled elsewhere.
108
+ with_shared_glapi = get_option (' shared-glapi' ) \
109
+ .disable_auto_if(host_machine .system() == ' windows' ) \
110
+ .allowed()
111
+
123
112
with_opengl = get_option (' opengl' )
124
- with_gles1 = get_option (' gles1' ).allowed()
125
- with_gles2 = get_option (' gles2' ).allowed()
113
+
114
+ with_gles1 = get_option (' gles1' ) \
115
+ .require(with_shared_glapi, error_message : ' OpengGL ES 1.x requires shared-glapi' ) \
116
+ .allowed()
117
+
118
+ with_gles2 = get_option (' gles2' ) \
119
+ .require(with_shared_glapi, error_message : ' OpengGL ES 2.x requires shared-glapi' ) \
120
+ .allowed()
126
121
127
122
pre_args += ' -DHAVE_OPENGL=@0@' .format(with_opengl.to_int())
128
123
pre_args += ' -DHAVE_OPENGL_ES_1=@0@' .format(with_gles1.to_int())
129
124
pre_args += ' -DHAVE_OPENGL_ES_2=@0@' .format(with_gles2.to_int())
130
125
131
126
with_any_opengl = with_opengl or with_gles1 or with_gles2
127
+ # Only build shared_glapi if at least one OpenGL API is enabled
128
+ with_shared_glapi = with_shared_glapi and with_any_opengl
132
129
133
130
system_has_kms_drm = [' openbsd' , ' netbsd' , ' freebsd' , ' gnu/kfreebsd' , ' dragonfly' , ' linux' , ' sunos' , ' android' , ' managarm' ].contains(host_machine .system())
134
131
@@ -168,22 +165,30 @@ if gallium_drivers.contains('auto')
168
165
host_machine .system()))
169
166
endif
170
167
elif gallium_drivers.contains(' all' )
168
+ # Build-test everything except for i915, which depends on libdrm-intel which
169
+ # is not available on non-Intel distros.
171
170
gallium_drivers = [
172
- ' r300' , ' r600' , ' radeonsi' , ' crocus' , ' v3d' , ' vc4' , ' freedreno' , ' etnaviv' , ' i915 ' ,
171
+ ' r300' , ' r600' , ' radeonsi' , ' crocus' , ' v3d' , ' vc4' , ' freedreno' , ' etnaviv' ,
173
172
' nouveau' , ' svga' , ' tegra' , ' virgl' , ' lima' , ' panfrost' , ' llvmpipe' , ' softpipe' , ' iris' ,
174
173
' zink' , ' d3d12' , ' asahi'
175
174
]
176
175
endif
177
176
177
+ # compatibility for meson configurations asking for 'swrast'
178
+ with_swrast = gallium_drivers.contains(' swrast' )
179
+ if with_swrast
180
+ warning (' `gallium-drivers=swrast` is a deprecated alias for `gallium-drivers=softpipe,llvmpipe` and will be removed in version 25.0' )
181
+ endif
182
+
178
183
with_amdgpu_virtio = get_option (' amdgpu-virtio' )
179
184
180
185
with_gallium_radeonsi = gallium_drivers.contains(' radeonsi' )
181
186
with_gallium_r300 = gallium_drivers.contains(' r300' )
182
187
with_gallium_r600 = gallium_drivers.contains(' r600' )
183
188
with_gallium_nouveau = gallium_drivers.contains(' nouveau' )
184
189
with_gallium_freedreno = gallium_drivers.contains(' freedreno' )
185
- with_gallium_softpipe = gallium_drivers.contains(' softpipe' )
186
- with_gallium_llvmpipe = gallium_drivers.contains(' llvmpipe' )
190
+ with_gallium_softpipe = with_swrast or gallium_drivers.contains(' softpipe' )
191
+ with_gallium_llvmpipe = with_swrast or gallium_drivers.contains(' llvmpipe' )
187
192
with_gallium_vc4 = gallium_drivers.contains(' vc4' )
188
193
with_gallium_v3d = gallium_drivers.contains(' v3d' )
189
194
with_gallium_panfrost = gallium_drivers.contains(' panfrost' )
@@ -225,7 +230,7 @@ if _vulkan_drivers.contains('auto')
225
230
if host_machine .cpu_family().startswith(' x86' )
226
231
_vulkan_drivers = [' amd' , ' intel' , ' intel_hasvk' , ' nouveau' , ' swrast' ]
227
232
elif [' arm' , ' aarch64' ].contains(host_machine .cpu_family())
228
- _vulkan_drivers = [' swrast' , ' intel' , ' panfrost' , ' freedreno ' ]
233
+ _vulkan_drivers = [' swrast' , ' intel' , ' panfrost' ]
229
234
elif [' mips' , ' mips64' , ' ppc' , ' ppc64' , ' riscv32' , ' riscv64' ].contains(host_machine .cpu_family())
230
235
_vulkan_drivers = [' amd' , ' swrast' ]
231
236
elif [' loongarch64' ].contains(host_machine .cpu_family())
@@ -344,9 +349,6 @@ endif
344
349
if with_aco_tests and not with_amd_vk
345
350
error (' ACO tests require Radv' )
346
351
endif
347
- if with_radv_tests and not with_amd_vk
348
- error (' RADV tests require RADV' )
349
- endif
350
352
351
353
with_microsoft_clc = get_option (' microsoft-clc' ).enabled()
352
354
with_spirv_to_dxil = get_option (' spirv-to-dxil' )
@@ -382,7 +384,13 @@ all_codecs = patent_codecs + free_codecs
382
384
if _codecs.contains(' all' )
383
385
_codecs = all_codecs
384
386
elif _codecs.contains(' all_free' )
385
- _codecs += free_codecs
387
+ selected_codecs = _codecs
388
+ _codecs = free_codecs
389
+ foreach c : patent_codecs
390
+ if selected_codecs.contains(c)
391
+ _codecs += c
392
+ endif
393
+ endforeach
386
394
endif
387
395
foreach c : all_codecs
388
396
pre_args += ' -DVIDEO_CODEC_@0@=@1@' .format(c.to_upper(), _codecs.contains(c).to_int())
@@ -452,6 +460,7 @@ if not (with_dri or with_gallium or with_glx != 'disabled')
452
460
with_gles2 = false
453
461
with_opengl = false
454
462
with_any_opengl = false
463
+ with_shared_glapi = false
455
464
endif
456
465
457
466
with_gbm = get_option (' gbm' ) \
@@ -465,6 +474,7 @@ with_xlib_lease = get_option('xlib-lease') \
465
474
466
475
with_egl = get_option (' egl' ) \
467
476
.require(with_platform_windows or with_platform_haiku or with_dri or with_platform_android, error_message : ' EGL requires DRI, Haiku, Windows or Android' ) \
477
+ .require(with_shared_glapi, error_message : ' EGL requires shared-glapi' ) \
468
478
.require(with_glx != ' xlib' , error_message :' EGL requires DRI, but GLX is being built with xlib support' ) \
469
479
.disable_auto_if(with_platform_haiku) \
470
480
.allowed()
@@ -554,6 +564,10 @@ if with_glx != 'disabled'
554
564
elif with_dri
555
565
error (' xlib conflicts with any dri driver' )
556
566
endif
567
+ elif with_glx == ' dri'
568
+ if not with_shared_glapi
569
+ error (' dri based GLX requires shared-glapi' )
570
+ endif
557
571
endif
558
572
endif
559
573
@@ -696,7 +710,6 @@ endif
696
710
697
711
with_gallium_st_nine = get_option (' gallium-nine' )
698
712
if with_gallium_st_nine
699
- warning (' The nine state tracker will be removed in Mesa 25.2' )
700
713
if not with_gallium_swrast
701
714
error (' The nine state tracker requires gallium softpipe/llvmpipe.' )
702
715
elif not [
@@ -721,18 +734,27 @@ if with_gallium_st_d3d10umd
721
734
error (' The d3d10umd state tracker requires gallium softpipe/llvmpipe.' )
722
735
endif
723
736
endif
724
-
725
- if host_machine .cpu_family() == ' ppc64' and host_machine .endian() == ' little'
726
- if cc.compiles('''
727
- #include <altivec.h>
728
- int main() {
729
- vector unsigned char r;
730
- vector unsigned int v = vec_splat_u32 (1);
731
- r = __builtin_vec_vgbbd ((vector unsigned char) v);
732
- return 0;
733
- }''' ,
734
- name : ' POWER8 intrinsics' )
735
- pre_args += [' -D_ARCH_PWR8' ]
737
+ _power8 = get_option (' power8' )
738
+ if _power8.allowed()
739
+ if host_machine .cpu_family() == ' ppc64' and host_machine .endian() == ' little'
740
+ if cc.get_id() == ' gcc' and cc.version().version_compare(' < 4.8' )
741
+ error (' Altivec is not supported with gcc version < 4.8.' )
742
+ endif
743
+ if cc.compiles('''
744
+ #include <altivec.h>
745
+ int main() {
746
+ vector unsigned char r;
747
+ vector unsigned int v = vec_splat_u32 (1);
748
+ r = __builtin_vec_vgbbd ((vector unsigned char) v);
749
+ return 0;
750
+ }''' ,
751
+ args : ' -mpower8-vector' ,
752
+ name : ' POWER8 intrinsics' )
753
+ pre_args += [' -D_ARCH_PWR8' ]
754
+ c_cpp_args += ' -mpower8-vector'
755
+ elif _power8.enabled()
756
+ error (' POWER8 intrinsic support required but not found.' )
757
+ endif
736
758
endif
737
759
endif
738
760
@@ -810,22 +832,17 @@ else
810
832
with_drivers_clc = false
811
833
endif
812
834
813
- with_driver_using_cl = [
814
- with_gallium_iris, with_intel_vk,
815
- with_gallium_asahi, with_asahi_vk,
816
- with_gallium_panfrost, with_panfrost_vk,
817
- with_nouveau_vk,
818
- ].contains(true )
819
-
820
835
if get_option (' mesa-clc' ) == ' system'
821
836
prog_mesa_clc = find_program (' mesa_clc' , native : true )
822
- prog_vtn_bindgen2 = find_program (' vtn_bindgen2 ' , native : true )
837
+ prog_vtn_bindgen = find_program (' vtn_bindgen ' , native : true )
823
838
# Even with mesa-clc already built, rusticl still needs clc.
824
839
with_clc = with_gallium_rusticl
825
840
else
826
841
with_clc = get_option (' mesa-clc' ) != ' auto' or \
827
- with_microsoft_clc or with_gallium_rusticl or \
828
- with_drivers_clc or with_driver_using_cl
842
+ with_microsoft_clc or with_drivers_clc or \
843
+ with_gallium_iris or with_intel_vk or \
844
+ with_gallium_asahi or with_asahi_vk or \
845
+ with_gallium_rusticl
829
846
endif
830
847
831
848
dep_clc = null_dep
@@ -861,7 +878,7 @@ if with_platform_x11
861
878
endif
862
879
863
880
with_glapi_export_proto_entry_points = false
864
- if not with_glx_indirect_rendering
881
+ if with_shared_glapi and not with_glx_indirect_rendering
865
882
# Imply !defined(GLX_INDIRECT_RENDERING)
866
883
with_glapi_export_proto_entry_points = true
867
884
endif
@@ -1085,7 +1102,6 @@ if cc.get_argument_syntax() == 'msvc'
1085
1102
' /we4024' , # Error when passing different type of parameter
1086
1103
' /we4189' , # 'identifier' : local variable is initialized but not referenced
1087
1104
' /Zc:__cplusplus' , #Set __cplusplus macro to match the /std:c++<version> on the command line
1088
- ' /Zc:preprocessor' , # Use the standards-conforming preprocessor
1089
1105
]
1090
1106
c_args += cc.get_supported_arguments(_trial)
1091
1107
cpp_args += cpp.get_supported_arguments(_trial)
@@ -1546,6 +1562,10 @@ if with_any_intel and ['x86', 'x86_64'].contains(host_machine.cpu_family())
1546
1562
pre_args += ' -DSUPPORT_INTEL_INTEGRATED_GPUS'
1547
1563
endif
1548
1564
1565
+ if with_gallium_i915 and host_machine .cpu_family().startswith(' x86' ) == false
1566
+ error (' Intel "i915" Gallium driver requires x86 or x86_64 CPU family' )
1567
+ endif
1568
+
1549
1569
# Determine whether or not the rt library is needed for time functions
1550
1570
if host_machine .system() == ' windows' or cc.has_function(' clock_gettime' )
1551
1571
dep_clock = null_dep
@@ -1746,9 +1766,7 @@ amd_with_llvm = get_option('amd-use-llvm')
1746
1766
llvm_has_mcjit = host_machine .cpu_family() in [' aarch64' , ' arm' , ' ppc' , ' ppc64' , ' s390x' , ' x86' , ' x86_64' ]
1747
1767
llvm_with_orcjit = get_option (' llvm-orcjit' ) or not llvm_has_mcjit
1748
1768
1749
- if with_amd_vk or with_gallium_radeonsi
1750
- _llvm_version = ' >= 18.0.0'
1751
- elif with_clc or llvm_with_orcjit
1769
+ if with_amd_vk or with_gallium_radeonsi or with_clc or llvm_with_orcjit
1752
1770
_llvm_version = ' >= 15.0.0'
1753
1771
elif with_gallium_clover
1754
1772
_llvm_version = ' >= 11.0.0'
@@ -1869,7 +1887,7 @@ endif
1869
1887
dep_spirv_tools = dependency (
1870
1888
' SPIRV-Tools' ,
1871
1889
required : with_clc,
1872
- version : ' >= 2024 .1'
1890
+ version : ' >= 2022 .1'
1873
1891
)
1874
1892
if dep_spirv_tools.found()
1875
1893
pre_args += ' -DHAVE_SPIRV_TOOLS'
@@ -2019,6 +2037,17 @@ if dep_unwind.found()
2019
2037
pre_args += ' -DHAVE_LIBUNWIND'
2020
2038
endif
2021
2039
2040
+ if with_osmesa
2041
+ # if not with_gallium_swrast
2042
+ # error('OSMesa gallium requires gallium softpipe or llvmpipe.')
2043
+ # endif
2044
+ if host_machine .system() == ' windows'
2045
+ osmesa_lib_name = ' osmesa'
2046
+ else
2047
+ osmesa_lib_name = ' OSMesa'
2048
+ endif
2049
+ endif
2050
+
2022
2051
# TODO: symbol mangling
2023
2052
2024
2053
if with_platform_wayland
@@ -2029,7 +2058,7 @@ if with_platform_wayland
2029
2058
else
2030
2059
wl_scanner_arg = ' code'
2031
2060
endif
2032
- dep_wl_protocols = dependency (' wayland-protocols' , version : ' >= 1.41 ' , default_options : [ ' tests=false' ])
2061
+ dep_wl_protocols = dependency (' wayland-protocols' , version : ' >= 1.38 ' , default_options : [ ' tests=false' ])
2033
2062
dep_wayland_client = dependency (' wayland-client' , version : ' >=1.18' )
2034
2063
dep_wayland_server = dependency (' wayland-server' , version : ' >=1.18' )
2035
2064
if with_egl
@@ -2317,6 +2346,7 @@ summary(
2317
2346
' OpenGL' : with_opengl,
2318
2347
' ES1' : with_gles1,
2319
2348
' ES2' : with_gles2,
2349
+ ' Shared glapi' : with_shared_glapi,
2320
2350
' GLVND' : with_glvnd,
2321
2351
},
2322
2352
section : ' OpenGL' , bool_yn : true
@@ -2357,7 +2387,7 @@ summary(egl_summary, section: 'EGL', bool_yn: true, list_sep: ' ')
2357
2387
2358
2388
gbm_summary = {' Enabled' : with_gbm}
2359
2389
if with_gbm
2360
- gbm_summary += {' External libgbm ' : get_option ( ' libgbm-external ' ), ' Backends path' : gbm_backends_path}
2390
+ gbm_summary += {' Backends path' : gbm_backends_path}
2361
2391
endif
2362
2392
summary (gbm_summary, section : ' GBM' , bool_yn : true , list_sep : ' ' )
2363
2393
@@ -2384,7 +2414,6 @@ if with_any_vk
2384
2414
video_apis += ' vulkan'
2385
2415
endif
2386
2416
if with_gallium_xa
2387
- warning (' XA will be removed in Mesa 25.2' )
2388
2417
video_apis += ' xa'
2389
2418
endif
2390
2419
video_summary += {' APIs' : video_apis.length() != 0 ? video_apis : false }
@@ -2421,6 +2450,7 @@ if with_gallium
2421
2450
gallium_frontends += ' rusticl'
2422
2451
endif
2423
2452
gallium_summary += {' Frontends' : gallium_frontends}
2453
+ gallium_summary += {' Off-screen rendering (OSMesa)' : with_osmesa ? ' lib' + osmesa_lib_name : false }
2424
2454
gallium_summary += {' HUD lm-sensors' : dep_lmsensors.found()}
2425
2455
endif
2426
2456
summary (gallium_summary, section : ' Gallium' , bool_yn : true , list_sep : ' ' )
0 commit comments