meson: Warn about side-effects from DRM for FD KMDs

Any build which requires Turnip to link to libdrm will cause a
runtime dependency which could be a compatibility hazard on
platforms such as Android which generally don't ship with libdrm.
This hazard could be unintentionally triggered and to avoid this
from happening, a warning is now issued when building FD with msm
alongside other backends or if DRM is enabled due to building a
Gallium driver using DRM.

Signed-off-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25005>
This commit is contained in:
Mark Collins 2023-08-08 10:00:49 +00:00 committed by Marge Bot
parent ce124328a0
commit dee280249c

View File

@ -180,13 +180,6 @@ foreach gallium_driver : gallium_drivers
pre_args += '-DHAVE_@0@'.format(gallium_driver.to_upper())
endforeach
freedreno_kmds = get_option('freedreno-kmds')
# If building only vulkan with only kgsl kmd support, there is no libdrm
# dependency:
if freedreno_kmds.length() == 1 and freedreno_kmds.contains('kgsl') and not with_gallium_freedreno
system_has_kms_drm = false
endif
with_gallium = gallium_drivers.length() != 0
with_gallium_kmsro = system_has_kms_drm and [
with_gallium_asahi,
@ -198,15 +191,6 @@ with_gallium_kmsro = system_has_kms_drm and [
with_gallium_vc4,
].contains(true)
with_dri = false
if with_gallium and system_has_kms_drm
_glx = get_option('glx')
_egl = get_option('egl')
if _glx == 'dri' or _egl.enabled() or (_glx == 'disabled' and _egl.allowed())
with_dri = true
endif
endif
_vulkan_drivers = get_option('vulkan-drivers')
if _vulkan_drivers.contains('auto')
if system_has_kms_drm
@ -245,6 +229,30 @@ with_microsoft_vk = _vulkan_drivers.contains('microsoft-experimental')
with_nouveau_vk = _vulkan_drivers.contains('nouveau-experimental')
with_any_vk = _vulkan_drivers.length() != 0
freedreno_kmds = get_option('freedreno-kmds')
if freedreno_kmds.length() != 0 and freedreno_kmds != [ 'msm' ] and with_freedreno_vk
if freedreno_kmds.contains('msm')
warning('Turnip with the DRM KMD will require libdrm to always be present at runtime which may not always be the case on platforms such as Android.')
elif with_gallium_kmsro
warning('As a side-effect, Turnip is forced to link with libdrm when built alongside Gallium DRM drivers which platforms such as Android may not have available at runtime.')
elif _vulkan_drivers != [ 'freedreno' ]
warning('Turnip is forced to link with libdrm when built alongside other Vulkan drivers which platforms such as Android may not have available at runtime.')
else
# If DRM support isn't needed, we can get rid of it since linking
# to libdrm can be a potential compatibility hazard.
system_has_kms_drm = false
endif
endif
with_dri = false
if with_gallium and system_has_kms_drm
_glx = get_option('glx')
_egl = get_option('egl')
if _glx == 'dri' or _egl.enabled() or (_glx == 'disabled' and _egl.allowed())
with_dri = true
endif
endif
with_any_broadcom = [
with_gallium_vc4,
with_gallium_v3d,