gallium/meson: Deconflate swrast/softpipe/llvmpipe

This adds explicit names for softpipe and llvmpipe to the gallium driver
list. "swrast" is treated as a compatibility name that selects both. We
clarify how lavapipe depends on (just) llvmpipe, and we make it possible
to build llvmpipe without softpipe.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27607>
This commit is contained in:
Adam Jackson 2024-02-13 14:50:50 -05:00 committed by Marge Bot
parent 3fba270907
commit 010b2f9497
17 changed files with 55 additions and 46 deletions

View File

@ -165,12 +165,19 @@ elif gallium_drivers.contains('all')
]
endif
# compatibility for meson configurations asking for 'swrast'
with_swrast = gallium_drivers.contains('swrast')
if with_swrast
warning('`gallium-drivers=swrast` is a deprecated alias for `gallium-drivers=softpipe,llvmpipe` and will be removed in version 25.0')
endif
with_gallium_radeonsi = gallium_drivers.contains('radeonsi')
with_gallium_r300 = gallium_drivers.contains('r300')
with_gallium_r600 = gallium_drivers.contains('r600')
with_gallium_nouveau = gallium_drivers.contains('nouveau')
with_gallium_freedreno = gallium_drivers.contains('freedreno')
with_gallium_softpipe = gallium_drivers.contains('swrast')
with_gallium_softpipe = with_swrast or gallium_drivers.contains('softpipe')
with_gallium_llvmpipe = with_swrast or gallium_drivers.contains('llvmpipe')
with_gallium_vc4 = gallium_drivers.contains('vc4')
with_gallium_v3d = gallium_drivers.contains('v3d')
with_gallium_panfrost = gallium_drivers.contains('panfrost')
@ -189,6 +196,12 @@ foreach gallium_driver : gallium_drivers
pre_args += '-DHAVE_@0@'.format(gallium_driver.to_upper())
endforeach
# compatibility for "swrast" as an internal-ish driver name
with_gallium_swrast = with_gallium_softpipe or with_gallium_llvmpipe
if with_gallium_swrast
pre_args += '-DHAVE_SWRAST'
endif
with_gallium = gallium_drivers.length() != 0
with_gallium_kmsro = system_has_kms_drm and [
with_gallium_asahi,
@ -248,6 +261,8 @@ if with_any_vk and host_machine.system() == 'windows' and meson.version().versio
error('Vulkan drivers on Windows require meson 1.3 or newer')
endif
with_any_llvmpipe = with_gallium_llvmpipe or with_swrast_vk
freedreno_kmds = get_option('freedreno-kmds')
if freedreno_kmds.length() != 0 and freedreno_kmds != [ 'msm' ] and with_freedreno_vk
if freedreno_kmds.contains('msm')
@ -307,9 +322,6 @@ if with_nouveau_vk
pre_args += '-DHAVE_NVK'
endif
if with_swrast_vk and not with_gallium_softpipe
error('swrast vulkan requires gallium swrast')
endif
if with_gallium_tegra and not with_gallium_nouveau
error('tegra driver requires nouveau driver')
endif
@ -514,7 +526,7 @@ if with_glx != 'disabled'
elif with_glx == 'xlib'
if not with_gallium
error('xlib based GLX requires at least one gallium driver')
elif not with_gallium_softpipe
elif not with_gallium_swrast
error('xlib based GLX requires softpipe or llvmpipe.')
elif with_dri
error('xlib conflicts with any dri driver')
@ -748,7 +760,7 @@ endif
with_gallium_st_nine = get_option('gallium-nine')
if with_gallium_st_nine
if not with_gallium_softpipe
if not with_gallium_swrast
error('The nine state tracker requires gallium softpipe/llvmpipe.')
elif not [
with_gallium_crocus,
@ -771,7 +783,7 @@ if with_gallium_st_nine
endif
with_gallium_st_d3d10umd = get_option('gallium-d3d10umd')
if with_gallium_st_d3d10umd
if not with_gallium_softpipe
if not with_gallium_swrast
error('The d3d10umd state tracker requires gallium softpipe/llvmpipe.')
endif
endif
@ -1818,6 +1830,8 @@ elif with_amd_vk and with_aco_tests
error('ACO tests require LLVM, but LLVM is disabled.')
elif with_swrast_vk
error('The following drivers require LLVM: Lavapipe. One of these is enabled, but LLVM is disabled.')
elif with_gallium_llvmpipe
error('The following drivers require LLVM: llvmpipe. It is enabled, but LLVM is disabled.')
elif with_gallium_clover
error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.')
elif with_clc
@ -2006,7 +2020,7 @@ if dep_unwind.found()
endif
if with_osmesa
if not with_gallium_softpipe
if not with_gallium_swrast
error('OSMesa gallium requires gallium softpipe or llvmpipe.')
endif
if host_machine.system() == 'windows'

View File

@ -89,10 +89,11 @@ option(
'auto', 'kmsro', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno',
'swrast', 'v3d', 'vc4', 'etnaviv', 'tegra', 'i915', 'svga', 'virgl',
'panfrost', 'iris', 'lima', 'zink', 'd3d12', 'asahi', 'crocus', 'all',
'softpipe', 'llvmpipe',
],
description : 'List of gallium drivers to build. If this is set to auto ' +
'all drivers applicable to the target OS/architecture ' +
'will be built'
'will be built.'
)
option(

View File

@ -351,7 +351,7 @@ _eglQueryDevicesEXT(EGLint max_devices, _EGLDevice **devices,
num_devs = _eglDeviceRefreshList();
devs = _eglGlobal.DeviceList;
#ifdef GALLIUM_SOFTPIPE
#ifdef HAVE_SWRAST
swrast = devs;
#else
swrast = NULL;

View File

@ -10,10 +10,6 @@ link_for_egl = []
deps_for_egl = []
incs_for_egl = [inc_include, inc_src, inc_egl]
if with_gallium_softpipe
c_args_for_egl += '-DGALLIUM_SOFTPIPE'
endif
files_egl = files(
'main/eglapi.c',
'main/eglarray.c',

View File

@ -105,15 +105,13 @@ libllvmpipe = static_library(
dependencies : [ dep_llvm, idep_nir_headers, idep_mesautil, dep_libdrm],
)
# This overwrites the softpipe driver dependency, but itself depends on the
# softpipe dependency.
driver_swrast = declare_dependency(
driver_llvmpipe = declare_dependency(
compile_args : '-DGALLIUM_LLVMPIPE',
link_with : libllvmpipe,
dependencies : [driver_swrast, dep_llvm, idep_mesautil],
dependencies : [dep_llvm, idep_mesautil],
)
if with_tests and with_gallium_softpipe and draw_with_llvm
if with_tests
foreach t : ['lp_test_format', 'lp_test_arit', 'lp_test_blend',
'lp_test_conv', 'lp_test_printf', 'lp_test_lookup_multiple']
test(

View File

@ -67,7 +67,7 @@ libsoftpipe = static_library(
dependencies : idep_nir,
)
driver_swrast = declare_dependency(
driver_softpipe = declare_dependency(
compile_args : '-DGALLIUM_SOFTPIPE',
link_with : libsoftpipe
)

View File

@ -2322,7 +2322,7 @@ fail:
static const __DRIconfig **
dri_swrast_kms_init_screen(struct dri_screen *screen, bool driver_name_is_inferred)
{
#if defined(GALLIUM_SOFTPIPE)
#if defined(HAVE_SWRAST)
const __DRIconfig **configs;
struct pipe_screen *pscreen = NULL;
@ -2352,7 +2352,7 @@ dri_swrast_kms_init_screen(struct dri_screen *screen, bool driver_name_is_inferr
fail:
dri_release_screen(screen);
#endif // GALLIUM_SOFTPIPE
#endif // HAVE_SWRAST
return NULL;
}

View File

@ -42,10 +42,6 @@ if with_gallium_zink and not with_platform_android
deps_for_libdri += vulkan_wsi_deps
endif
if with_gallium_softpipe
libdri_c_args += '-DGALLIUM_SOFTPIPE'
endif
libdri = static_library(
'dri',
[ files_libdri, sha1_h ],

View File

@ -6,11 +6,6 @@ files_libsthgl = files(
'hgl.c',
)
libsthgl_c_args = []
if with_gallium_softpipe
libsthgl_c_args += '-DGALLIUM_SOFTPIPE'
endif
libsthgl = static_library(
'sthgl',
files_libsthgl,
@ -18,6 +13,5 @@ libsthgl = static_library(
inc_include, inc_util, inc_mesa, inc_mapi, inc_src,
inc_gallium, inc_gallium_aux
],
c_args : [libsthgl_c_args],
gnu_symbol_visibility : 'hidden',
)

View File

@ -44,12 +44,26 @@ if with_platform_haiku
endif
if with_gallium_softpipe
subdir('drivers/softpipe')
if draw_with_llvm
subdir('drivers/llvmpipe')
endif
else
driver_softpipe = declare_dependency()
endif
if with_any_llvmpipe
subdir('drivers/llvmpipe')
else
driver_llvmpipe = declare_dependency()
endif
if with_gallium_llvmpipe and with_gallium_softpipe
driver_swrast = declare_dependency(
dependencies : [ driver_softpipe, driver_llvmpipe ],
)
elif with_gallium_llvmpipe
driver_swrast = driver_llvmpipe
elif with_gallium_softpipe
driver_swrast = driver_softpipe
else
driver_swrast = declare_dependency()
endif
if with_gallium_asahi
subdir('winsys/asahi/drm')
subdir('drivers/asahi')

View File

@ -12,7 +12,7 @@ PUBLIC const __DRIextension **__driDriverGetExtensions_##drivername(void) \
return galliumdrm_driver_extensions; \
}
#if defined(GALLIUM_SOFTPIPE)
#if defined(HAVE_SWRAST)
const __DRIextension **__driDriverGetExtensions_swrast(void);

View File

@ -103,8 +103,8 @@ foreach d : [[with_gallium_kmsro, [
[with_gallium_radeonsi, 'radeonsi_dri.so'],
[with_gallium_nouveau, 'nouveau_dri.so'],
[with_gallium_freedreno, ['msm_dri.so', 'kgsl_dri.so']],
[with_gallium_softpipe, 'swrast_dri.so'],
[with_gallium_softpipe and with_gallium_drisw_kms, 'kms_swrast_dri.so'],
[with_gallium_swrast, 'swrast_dri.so'],
[with_gallium_swrast and with_gallium_drisw_kms, 'kms_swrast_dri.so'],
[with_gallium_v3d, 'v3d_dri.so'],
[with_gallium_vc4, 'vc4_dri.so'],
[with_gallium_panfrost, ['panfrost_dri.so', 'panthor_dri.so']],

View File

@ -13,7 +13,7 @@ libvulkan_lvp = shared_library(
# The linker still expects a definition for weak symbols at build time, just not at runtime.
# We have to forcibly ignore undefined symbols, which unfortunately applies to all symbols.
override_options : ['b_lundef=@0@'.format(host_machine.system() == 'darwin' ? 'false' : get_option('b_lundef').to_string())],
dependencies : driver_swrast,
dependencies : driver_llvmpipe,
name_prefix : host_machine.system() == 'windows' ? '' : [],
install : true,
)

View File

@ -5,9 +5,6 @@
# Static targets are always enabled in autotools (unless you modify
# configure.ac)
gallium_xlib_c_args = [
'-DGALLIUM_SOFTPIPE',
]
gallium_xlib_ld_args = []
gallium_xlib_link_with = []
gallium_xlib_link_depends = []
@ -27,7 +24,6 @@ libgl = shared_library(
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_gallium_winsys, inc_gallium_drivers,
include_directories('../../frontends/glx/xlib'),
],
c_args : [gallium_xlib_c_args],
gnu_symbol_visibility : 'hidden',
link_args : [ld_args_bsymbolic, ld_args_gc_sections, gallium_xlib_ld_args],
link_depends : gallium_xlib_link_depends,

View File

@ -36,7 +36,7 @@ pipe_loaders = [
[with_gallium_freedreno, 'msm', driver_freedreno, []],
[with_gallium_kmsro, 'kmsro', _kmsro_targets, [libpipe_loader_dynamic]],
[with_gallium_svga, 'vmwgfx', driver_svga, []],
[with_gallium_softpipe, 'swrast', driver_swrast, [libwsw, libws_null, libswdri, libswkmsdri]],
[with_gallium_swrast, 'swrast', driver_swrast, [libwsw, libws_null, libswdri, libswkmsdri]],
]
foreach x : pipe_loaders

View File

@ -170,7 +170,7 @@ wgl_present(struct pipe_screen *screen,
* other structs such as this stw_winsys as well...
*/
#if defined(GALLIUM_LLVMPIPE) || defined(GALLIUM_SOFTPIPE)
#if defined(HAVE_SWRAST)
struct sw_winsys *winsys = NULL;
struct sw_displaytarget *dt = NULL;
#endif

View File

@ -5,6 +5,6 @@ if not with_platform_windows
# pipe-loader doesn't build on windows.
subdir('trivial')
endif
if with_gallium_softpipe
if with_gallium_swrast
subdir('unit')
endif