meson: Add "amber" option for automatic LTS build configuration

Setting amber to true changes these defaults:

- glvnd defaults to enabled
- the glvnd vendor name is set to "amber"
- the gallium and vulkan drivers are disabled
- prefer-iris defaults to false
- eglQueryString(EGL_VENDOR) returns "Mesa Project (Amber)"

The megadriver for the classic driver set will be installed to a file
name unique from Mesa main. Beyond that no attempt is made to use
filenames different from main - particularly not if glvnd is explicitly
disabled - so you would still need to configure your install paths
appropriately so things don't collide, if you want them to not collide.
But if you have that problem, consider that glvnd already solves it.

This has a quiet dependency on glapi and gbm's library API remaining
stable. gbm you could fix by linking it statically, glapi is a little
harder. I think the right move for glapi is to use glvnd's gldispatch
more directly, but that's not public API at the moment.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10557>
This commit is contained in:
Adam Jackson 2021-04-30 14:01:26 -04:00 committed by Eric Engestrom
parent d5ec846bc8
commit 988762679c
6 changed files with 66 additions and 15 deletions

View File

@ -39,6 +39,13 @@ if get_option('layout') != 'mirror'
error('`mirror` is the only build directory layout supported')
endif
amber = get_option('amber')
if amber
package_version_suffix=' Amber'
else
package_version_suffix=''
endif
# Arguments for the preprocessor, put these in a separate array from the C and
# C++ (cpp in meson terminology) arguments since they need to be added to the
# default arguments for both C and C++.
@ -46,13 +53,18 @@ pre_args = [
'-D__STDC_CONSTANT_MACROS',
'-D__STDC_FORMAT_MACROS',
'-D__STDC_LIMIT_MACROS',
'-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
'-DPACKAGE_VERSION="@0@@1@"'.format(meson.project_version(), package_version_suffix),
'-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"',
]
c_args = []
cpp_args = []
with_moltenvk_dir = get_option('moltenvk-dir')
if amber
pre_args += '-DAMBER'
endif
with_vulkan_icd_dir = get_option('vulkan-icd-dir')
with_tests = get_option('build-tests')
with_aco_tests = get_option('build-aco-tests')
@ -199,7 +211,9 @@ with_dri = dri_drivers.length() != 0
gallium_drivers = get_option('gallium-drivers')
if gallium_drivers.contains('auto')
if system_has_kms_drm
if amber
gallium_drivers = []
elif system_has_kms_drm
# TODO: PPC, Sparc
if ['x86', 'x86_64'].contains(host_machine.cpu_family())
gallium_drivers = [
@ -262,7 +276,9 @@ endif
_vulkan_drivers = get_option('vulkan-drivers')
if _vulkan_drivers.contains('auto')
if system_has_kms_drm
if host_machine.cpu_family().startswith('x86')
if amber
_vulkan_drivers = []
elif host_machine.cpu_family().startswith('x86')
_vulkan_drivers = ['amd', 'intel', 'swrast']
elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
_vulkan_drivers = ['swrast']
@ -531,8 +547,22 @@ if with_glx != 'disabled'
endif
endif
with_glvnd = get_option('glvnd')
_glvnd = get_option('glvnd')
if _glvnd == 'true' or _glvnd == 'enabled' or (amber and _glvnd == 'auto')
with_glvnd = true
else
with_glvnd = false
endif
glvnd_vendor_name = get_option('glvnd-vendor-name')
if glvnd_vendor_name == 'auto'
if amber
glvnd_vendor_name = 'amber'
else
glvnd_vendor_name = 'mesa'
endif
endif
if with_glvnd
if with_platform_windows
error('glvnd cannot be used on Windows')

View File

@ -302,8 +302,9 @@ option(
)
option(
'glvnd',
type : 'boolean',
value : false,
type : 'combo',
value : 'auto',
choices : ['auto', 'true', 'false', 'enabled', 'disabled'],
description : 'Enable GLVND support.'
)
option(
@ -321,7 +322,7 @@ option(
option(
'glvnd-vendor-name',
type : 'string',
value : 'mesa',
value : 'auto',
description : 'Vendor name string to use for glvnd libraries'
)
option(
@ -457,14 +458,16 @@ option(
)
option(
'prefer-iris',
type : 'boolean',
value : true,
type : 'combo',
value : 'auto',
choices : ['auto', 'true', 'false'],
description : 'Prefer new Intel iris driver over older i965 driver'
)
option(
'prefer-crocus',
type : 'boolean',
value : false,
type : 'combo',
value : 'auto',
choices : ['auto', 'true', 'false'],
description : 'Prefer new crocus driver over older i965 driver for gen4-7'
)
option('egl-lib-suffix',
@ -530,3 +533,9 @@ option(
value : false,
description : 'Build gallium VMware/svga driver with mksGuestStats instrumentation.'
)
option(
'amber',
type : 'boolean',
value : false,
description : 'Configure LTS build to coexist with Mesa >= 22.0'
)

View File

@ -46,7 +46,11 @@ extern "C" {
#define _EGL_MAX_PBUFFER_WIDTH 4096
#define _EGL_MAX_PBUFFER_HEIGHT 4096
#ifdef AMBER
#define _EGL_VENDOR_STRING "Mesa Project (Amber)"
#else
#define _EGL_VENDOR_STRING "Mesa Project"
#endif
#ifdef __cplusplus
}

View File

@ -165,7 +165,7 @@ else
files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
glvnd_config = configuration_data()
glvnd_config.set('glvnd_vendor_name', get_option('glvnd-vendor-name'))
glvnd_config.set('glvnd_vendor_name', glvnd_vendor_name)
configure_file(
configuration: glvnd_config,
input : 'main/50_mesa.json',

View File

@ -41,11 +41,19 @@ loader_c_args = [
'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
]
if get_option('prefer-iris')
_prefer_iris = get_option('prefer-iris')
if _prefer_iris == 'auto'
_prefer_iris = amber ? 'false' : 'true'
endif
if _prefer_iris == 'true'
loader_c_args += ['-DPREFER_IRIS']
endif
if get_option('prefer-crocus')
_prefer_crocus = get_option('prefer-crocus')
if _prefer_crocus == 'auto'
_prefer_crocus = 'false'
endif
if _prefer_crocus == 'true'
loader_c_args += ['-DPREFER_CROCUS']
endif

View File

@ -51,7 +51,7 @@ endif
if _dri_drivers != []
libmesa_dri_drivers = shared_library(
'mesa_dri_drivers',
'@0@_dri_drivers'.format(glvnd_vendor_name),
[],
link_whole : _dri_drivers,
link_with : [