dri: Let dril handle the DRI driver link farm

xserver's loader will look for drivers this way, but there's no reason
we need to keep hurting ourselves like that.

Co-authored-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>

Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28378>
This commit is contained in:
Adam Jackson
2024-06-13 19:01:05 -04:00
committed by Marge Bot
parent 3de62b2f9a
commit d709b42180
3 changed files with 91 additions and 92 deletions

View File

@@ -23,7 +23,7 @@ if with_ld_dynamic_list
endif
libgallium_dri = shared_library(
'gallium_dri',
'gallium',
files('dri_target.c'),
include_directories : [
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_util, inc_gallium_drivers,
@@ -50,93 +50,3 @@ libgallium_dri = shared_library(
install_dir : dri_drivers_path,
name_suffix : 'so',
)
foreach d : [[with_gallium_kmsro, [
'armada-drm_dri.so',
'exynos_dri.so',
'gm12u320_dri.so',
'hdlcd_dri.so',
'hx8357d_dri.so',
'ili9163_dri.so',
'ili9225_dri.so',
'ili9341_dri.so',
'ili9486_dri.so',
'imx-drm_dri.so',
'imx-dcss_dri.so',
'imx-lcdif_dri.so',
'ingenic-drm_dri.so',
'kirin_dri.so',
'komeda_dri.so',
'mali-dp_dri.so',
'mcde_dri.so',
'mediatek_dri.so',
'meson_dri.so',
'mi0283qt_dri.so',
'mxsfb-drm_dri.so',
'panel-mipi-dbi_dri.so',
'pl111_dri.so',
'rcar-du_dri.so',
'repaper_dri.so',
'rockchip_dri.so',
'rzg2l-du_dri.so',
'ssd130x_dri.so',
'st7586_dri.so',
'st7735r_dri.so',
'sti_dri.so',
'stm_dri.so',
'sun4i-drm_dri.so',
'udl_dri.so',
'vkms_dri.so',
'zynqmp-dpsub_dri.so',
]],
[with_gallium_radeonsi, 'radeonsi_dri.so'],
[with_gallium_nouveau, 'nouveau_dri.so'],
[with_gallium_freedreno, ['msm_dri.so', 'kgsl_dri.so']],
[with_gallium_softpipe, 'swrast_dri.so'],
[with_gallium_softpipe and with_gallium_drisw_kms, 'kms_swrast_dri.so'],
[with_gallium_v3d, 'v3d_dri.so'],
[with_gallium_vc4, 'vc4_dri.so'],
[with_gallium_panfrost, ['panfrost_dri.so', 'panthor_dri.so']],
[with_gallium_etnaviv, 'etnaviv_dri.so'],
[with_gallium_tegra, 'tegra_dri.so'],
[with_gallium_crocus, 'crocus_dri.so'],
[with_gallium_iris, 'iris_dri.so'],
[with_gallium_i915, 'i915_dri.so'],
[with_gallium_r300, 'r300_dri.so'],
[with_gallium_r600, 'r600_dri.so'],
[with_gallium_svga, 'vmwgfx_dri.so'],
[with_gallium_virgl or
(with_gallium_freedreno and freedreno_kmds.contains('virtio')),
'virtio_gpu_dri.so'],
[with_gallium_lima, 'lima_dri.so'],
[with_gallium_zink, 'zink_dri.so'],
[with_gallium_d3d12, 'd3d12_dri.so'],
[with_gallium_asahi, 'asahi_dri.so']]
if d[0]
gallium_dri_drivers += d[1]
endif
endforeach
# This only works on Unix-like oses, which is probably fine for dri
prog_ln = find_program('ln', required : false)
if prog_ln.found()
devenv.set('LIBGL_DRIVERS_PATH', meson.current_build_dir())
foreach d : gallium_dri_drivers
custom_target(
'devenv_@0@'.format(d),
input : libgallium_dri,
output : d,
command : [prog_ln, '-f', '@INPUT@', '@OUTPUT@'],
build_by_default : true,
)
endforeach
endif
meson.add_install_script(
install_megadrivers_py.full_path(),
libgallium_dri.full_path(),
dri_drivers_path,
gallium_dri_drivers,
install_tag : 'runtime',
)

View File

@@ -61,3 +61,92 @@ dril_dri = shared_library(
install_dir : dri_drivers_path,
name_suffix : 'so',
)
foreach d : [[with_gallium_kmsro, [
'armada-drm_dri.so',
'exynos_dri.so',
'gm12u320_dri.so',
'hdlcd_dri.so',
'hx8357d_dri.so',
'ili9163_dri.so',
'ili9225_dri.so',
'ili9341_dri.so',
'ili9486_dri.so',
'imx-drm_dri.so',
'imx-dcss_dri.so',
'imx-lcdif_dri.so',
'ingenic-drm_dri.so',
'kirin_dri.so',
'komeda_dri.so',
'mali-dp_dri.so',
'mcde_dri.so',
'mediatek_dri.so',
'meson_dri.so',
'mi0283qt_dri.so',
'mxsfb-drm_dri.so',
'panel-mipi-dbi_dri.so',
'pl111_dri.so',
'rcar-du_dri.so',
'repaper_dri.so',
'rockchip_dri.so',
'rzg2l-du_dri.so',
'ssd130x_dri.so',
'st7586_dri.so',
'st7735r_dri.so',
'sti_dri.so',
'stm_dri.so',
'sun4i-drm_dri.so',
'udl_dri.so',
'vkms_dri.so',
'zynqmp-dpsub_dri.so',
]],
[with_gallium_radeonsi, 'radeonsi_dri.so'],
[with_gallium_nouveau, 'nouveau_dri.so'],
[with_gallium_freedreno, ['msm_dri.so', 'kgsl_dri.so']],
[with_gallium_softpipe, 'swrast_dri.so'],
[with_gallium_softpipe and with_gallium_drisw_kms, 'kms_swrast_dri.so'],
[with_gallium_v3d, 'v3d_dri.so'],
[with_gallium_vc4, 'vc4_dri.so'],
[with_gallium_panfrost, ['panfrost_dri.so', 'panthor_dri.so']],
[with_gallium_etnaviv, 'etnaviv_dri.so'],
[with_gallium_tegra, 'tegra_dri.so'],
[with_gallium_crocus, 'crocus_dri.so'],
[with_gallium_iris, 'iris_dri.so'],
[with_gallium_i915, 'i915_dri.so'],
[with_gallium_r300, 'r300_dri.so'],
[with_gallium_r600, 'r600_dri.so'],
[with_gallium_svga, 'vmwgfx_dri.so'],
[with_gallium_virgl or
(with_gallium_freedreno and freedreno_kmds.contains('virtio')),
'virtio_gpu_dri.so'],
[with_gallium_lima, 'lima_dri.so'],
[with_gallium_d3d12, 'd3d12_dri.so'],
[with_gallium_asahi, 'asahi_dri.so']]
if d[0]
dril_drivers += d[1]
endif
endforeach
# This only works on Unix-like oses, which is probably fine for dri
prog_ln = find_program('ln', required : false)
if prog_ln.found()
devenv.set('LIBGL_DRIVERS_PATH', meson.current_build_dir())
foreach d : dril_drivers
custom_target(
'devenv_@0@'.format(d),
input : dril_dri,
output : d,
command : [prog_ln, '-f', '@INPUT@', '@OUTPUT@'],
build_by_default : true,
)
endforeach
endif
meson.add_install_script(
install_megadrivers_py.full_path(),
dril_dri.full_path(),
dri_drivers_path,
dril_drivers,
install_tag : 'runtime',
)

View File

@@ -883,7 +883,7 @@ loader_open_driver(const char *driver_name,
const struct __DRIextensionRec **extensions = NULL;
const struct __DRIextensionRec **(*get_extensions)(void);
void *driver = loader_open_driver_lib(driver_name, "_dri", search_path_vars,
void *driver = loader_open_driver_lib("libgallium", "", search_path_vars,
DEFAULT_DRIVER_DIR, !driver_name_is_inferred);
if (!driver)