meson: add libva wrap and fallback option

Allow for Mesa to be built with VAAPI support, without having to install
libva headers first.

Signed-off-by: Thong Thai <thong.thai@amd.com>
Acked-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38271>
This commit is contained in:
Thong Thai 2025-11-05 20:36:08 +00:00 committed by Marge Bot
parent f5eb3fe9cb
commit b4e7c13ef4
3 changed files with 19 additions and 3 deletions

View file

@ -690,13 +690,20 @@ _va_drivers = [
with_gallium_virgl,
]
allow_fallback_for_libva = get_option('allow-fallback-for').contains('libva')
fallback_libva_options = []
_va = get_option('gallium-va') \
.require(_va_drivers.contains(true),
error_message : 'VA state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau, d3d12 (with option gallium-d3d12-video), virgl.')
_dep_va_name = host_machine.system() == 'windows' ? 'libva-win32' : 'libva'
dep_va = dependency(_dep_va_name, version : '>= 1.8.0', required : _va)
dep_va = dependency(
_dep_va_name, version : '>= 1.8.0',
required : _va,
allow_fallback: allow_fallback_for_libva,
default_options: fallback_libva_options
)
if dep_va.found()
dep_va_headers = dep_va.partial_dependency(compile_args : true)
dep_va_headers = dep_va.partial_dependency(compile_args : true, includes : true)
if cc.has_header_symbol('va/va.h', 'VASurfaceAttribDRMFormatModifiers',
dependencies: dep_va_headers)
pre_args += '-DHAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS'