glx: include: meson_options.txt: Allow disabling DRI glx backends

This allows building the X server with glx and without mesa.
This also makes the X server optionally no longer be a loader for dri drivers.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1638
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1819

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111
2025-12-14 01:25:14 +02:00
committed by Enrico Weigelt
parent 972d57d5da
commit 63f2422475
9 changed files with 37 additions and 11 deletions

View File

@@ -272,7 +272,12 @@ glxClientCallback(CallbackListPtr *list, void *closure, void *data)
/************************************************************************/
static __GLXprovider *__glXProviderStack = &__glXDRISWRastProvider;
static __GLXprovider *__glXProviderStack =
#ifdef BUILD_GLX_DRI
&__glXDRISWRastProvider;
#else
NULL;
#endif
void
GlxPushProvider(__GLXprovider * provider)

View File

@@ -13,8 +13,6 @@ srcs_glx = [
'glxcmds.c',
'glxcmdsswap.c',
'glxext.c',
'glxdriswrast.c',
'glxdricommon.c',
'glxscreens.c',
'render2.c',
'render2swap.c',
@@ -30,6 +28,16 @@ srcs_glx = [
'xfont.c',
]
srcs_glxdri2 = []
if build_glx_dri
srcs_glx += 'glx_dri/glxdriswrast.c'
srcs_glx += 'glx_dri/glxdricommon.c'
if build_dri2 or build_dri3
srcs_glxdri2 = files('glx_dri/glxdri2.c')
endif
endif
libxserver_glx = []
if build_glx
libxserver_glx = static_library('xserver_glx',
@@ -50,11 +58,6 @@ if build_glx
)
endif
srcs_glxdri2 = []
if build_dri2 or build_dri3
srcs_glxdri2 = files('glxdri2.c')
endif
srcs_vnd = [
'vndcmds.c',
'vndext.c',

View File

@@ -6,8 +6,6 @@ patch = version_split[2].to_int()
# convert to the old-style 1.x.y version scheme used up to 1.20.x for backwards compatibility
release = 1 * 10000000 + major * 100000 + minor * 1000 + patch
dri_dep = dependency('dri', required: build_glx)
# For feature macros we're using either false (boolean) or '1', which correspond to the macro being
# not defined at all and defined to 1. This is to match autotools behavior and thus preserve
# backwards compatibility with all the existing code that uses #ifdef to check if feature is
@@ -222,7 +220,10 @@ conf_data.set('DPMSExtension', build_dpms ? '1' : false)
conf_data.set('DRI2', build_dri2 ? '1' : false)
conf_data.set('DRI3', build_dri3 ? '1' : false)
if build_glx
conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_variable(pkgconfig : 'dridriverdir'))
if build_glx_dri
conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_variable(pkgconfig : 'dridriverdir'))
conf_data.set('BUILD_GLX_DRI', 1)
endif
endif
conf_data.set('MITSHM', build_mitshm ? '1' : false)
conf_data.set('CONFIG_MITSHM', build_mitshm ? '1' : false)

View File

@@ -475,6 +475,20 @@ if build_glx
build_hashtable = true
endif
dri_dep = dependency('dri', required: false)
glx_dri_opt = get_option('glx_dri')
build_glx_dri = (glx_dri_opt != 'false')
if not dri_dep.found()
if glx_dri_opt == 'auto'
build_glx_dri = false
endif
if glx_dri_opt == 'true'
error('DRI glx backends requested, but dri.pc was not found')
endif
endif
libdrm_dep = dependency('libdrm', version: libdrm_req, required: false)
if get_option('dri1') == 'auto'

View File

@@ -37,6 +37,9 @@ option('fontrootdir', type: 'string',
option('serverconfigdir', type: 'string',
description: 'Miscellaneous server configuration files path. Default: $libdir/xorg')
option('glx_dri', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
description: 'Build the dri-based glx backends. Default: true')
option('glx', type: 'boolean', value: true)
option('xdmcp', type: 'boolean', value: true)
option('xdm-auth-1', type: 'boolean', value: true)