From b6faf586e65be3a0c6c18e4ba66b9cb10892e9b9 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 10 Sep 2024 09:23:03 +0200 Subject: [PATCH] targets/vdpau: Build vdpau driver into libgallium when building with dri Currently vdpau driver and dri driver are two separate libraries, when radeonsi is enabled both libraries contain amdgpu winsys. radeonsi needs shared winsys to ensure sync between OpenGL and VDPAU works. Build vdpau driver into libgallium to avoid having two instances of amdgpu winsys. Cc: mesa-stable Part-of: --- src/gallium/meson.build | 10 +++++---- src/gallium/targets/dri/dri.sym.in | 1 + src/gallium/targets/dri/meson.build | 33 ++++++++++++++++++++++++----- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/gallium/meson.build b/src/gallium/meson.build index 3a4625dc520..46685aa19a5 100644 --- a/src/gallium/meson.build +++ b/src/gallium/meson.build @@ -212,6 +212,12 @@ if with_gallium_va subdir('targets/va') endif endif +if with_gallium_vdpau + subdir('frontends/vdpau') + if not with_dri + subdir('targets/vdpau') + endif +endif if with_dri subdir('frontends/dri') subdir('targets/dri') @@ -220,10 +226,6 @@ if with_osmesa subdir('frontends/osmesa') subdir('targets/osmesa') endif -if with_gallium_vdpau - subdir('frontends/vdpau') - subdir('targets/vdpau') -endif if with_gallium_xa subdir('frontends/xa') subdir('targets/xa') diff --git a/src/gallium/targets/dri/dri.sym.in b/src/gallium/targets/dri/dri.sym.in index e3a5211ce4f..0add030eccc 100644 --- a/src/gallium/targets/dri/dri.sym.in +++ b/src/gallium/targets/dri/dri.sym.in @@ -71,6 +71,7 @@ @fd_drm_screen_create_renderonly@ @ac_init_shared_llvm_once@ @va_driver_init@ + @vdp_imp_device_create_x11@ local: *; }; diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build index 13e01d602c4..e4ed5dd68b8 100644 --- a/src/gallium/targets/dri/meson.build +++ b/src/gallium/targets/dri/meson.build @@ -13,10 +13,16 @@ gallium_dri_drivers = [] gallium_dri_link_with = [] gallium_dri_link_whole = [] -if with_gallium_va +if with_gallium_va or with_gallium_vdpau gallium_dri_link_with += [libgalliumvlwinsys] - gallium_dri_link_whole += [libva_st] - sym_config.set('va_driver_init', '__vaDriverInit_*_*;') + if with_gallium_va + gallium_dri_link_whole += [libva_st] + sym_config.set('va_driver_init', '__vaDriverInit_*_*;') + endif + if with_gallium_vdpau + gallium_dri_link_whole += [libvdpau_st] + sym_config.set('vdp_imp_device_create_x11', 'vdp_imp_device_create_x11;') + endif endif dri_sym = configure_file(input : 'dri.sym.in', output : 'dri.sym', configuration : sym_config) @@ -64,15 +70,21 @@ libgallium_dri = shared_library( name_suffix : 'so', ) -if with_gallium_va +if with_gallium_va or with_gallium_vdpau va_drivers = [] + vdpau_drivers = [] foreach d : [[with_gallium_r600, 'r600'], [with_gallium_radeonsi, 'radeonsi'], [with_gallium_nouveau, 'nouveau'], [with_gallium_virgl, 'virtio_gpu'], [with_gallium_d3d12_video, 'd3d12']] if d[0] - va_drivers += '@0@_drv_video.so'.format(d[1]) + if with_gallium_va + va_drivers += '@0@_drv_video.so'.format(d[1]) + endif + if with_gallium_vdpau + vdpau_drivers += 'libvdpau_@0@.so.@1@.@2@.0'.format(d[1], VDPAU_MAJOR, VDPAU_MINOR) + endif endif endforeach @@ -86,4 +98,15 @@ if with_gallium_va install_tag : 'runtime', ) endif + + if vdpau_drivers.length() > 0 + meson.add_install_script( + install_megadrivers_py.full_path(), + libgallium_dri.full_path(), + vdpau_drivers_path, + vdpau_drivers, + '--megadriver_libdir', get_option('libdir'), + install_tag : 'runtime', + ) + endif endif