meson: add libva wrap and fallback option
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

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, with_gallium_virgl,
] ]
allow_fallback_for_libva = get_option('allow-fallback-for').contains('libva')
fallback_libva_options = []
_va = get_option('gallium-va') \ _va = get_option('gallium-va') \
.require(_va_drivers.contains(true), .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.') 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_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() 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', if cc.has_header_symbol('va/va.h', 'VASurfaceAttribDRMFormatModifiers',
dependencies: dep_va_headers) dependencies: dep_va_headers)
pre_args += '-DHAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS' pre_args += '-DHAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS'

View file

@ -846,7 +846,7 @@ option(
type : 'array', type : 'array',
value : ['perfetto'], value : ['perfetto'],
choices : [ choices : [
'libdrm', 'perfetto', 'libdrm', 'libva', 'perfetto',
], ],
description : 'Allows the fallback mechanism if the dependency is not available on the system, or too old.' description : 'Allows the fallback mechanism if the dependency is not available on the system, or too old.'
) )

9
subprojects/libva.wrap Normal file
View file

@ -0,0 +1,9 @@
[wrap-file]
directory = libva-2.22.0
source_url = https://github.com/intel/libva/archive/refs/tags/2.22.0.tar.gz
source_filename = 2.22.0.tar.gz
source_hash = 467c418c2640a178c6baad5be2e00d569842123763b80507721ab87eb7af8735
wrapdb_version = 2.22.0-1
[provide]
libva = libva_dep