On 13 March 2018 at 18:52, Dylan Baker <dy...@pnwbakers.com> wrote:
> Currently each driver specifies it's own version, and core libdrm
> specifies a version. In the most common case this is fine, since there
> will be exactly one libdrm installed on a system, but if there are more
> than one it's possible that mesa will be linked against different
> versions of libdrm. There is also the possibility that the current
> approach makes the pkg-config files we generate incorrect, since there
> could be #defines that use newer features if they're available.
> This patch corrects all of that. All of the versions are still set by
> driver (along with a default core version). Then all of the drivers that
> are enabled have their versions compared and the highest version is
> selected, then all libdrm checks are made with that version.
> Signed-off-by: Dylan Baker <dylan.c.ba...@intel.com>
> meson.build | 67 +++++++++++++++++++++++++++++++++++++-----------------
> 1 file changed, 46 insertions(+), 21 deletions(-)
> diff --git a/meson.build b/meson.build
> index e747d99..6019008 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1015,35 +1015,60 @@ dep_expat = dependency('expat')
> # its not linux and and wont
> dep_m = cc.find_library('m', required : false)
> +# Check for libdrm. various drivers have different libdrm version
> +# but we always want to use the same version for all libdrm modules. That
> +# even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and
> +# bar are both on use 2.4.3 for both of them
> dep_libdrm_amdgpu = 
> dep_libdrm_radeon = 
> dep_libdrm_nouveau = 
> dep_libdrm_etnaviv = 
> dep_libdrm_freedreno = 
> dep_libdrm_intel = 
> -if with_dri_i915 or with_gallium_i915
> - dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
> -if with_amd_vk or with_gallium_radeonsi
> - dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.90')
> -if (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or
> - with_gallium_r300 or with_gallium_r600)
> - dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71')
> -if with_gallium_nouveau or with_dri_nouveau
> - dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66')
> -if with_gallium_etnaviv
> - dep_libdrm_etnaviv = dependency('libdrm_etnaviv', version : '>= 2.4.82')
> -if with_gallium_freedreno
> - dep_libdrm_freedreno = dependency('libdrm_freedreno', version : '>=
> +_drm_amdgpu_ver = '2.4.90'
> +_drm_radeon_ver = '2.4.71'
> +_drm_nouveau_ver = '2.4.66'
> +_drm_etnaviv_ver = '2.4.82'
> +_drm_freedreno_ver = '2.4.91'
> +_drm_intel_ver = '2.4.75'
> +_drm_ver = '2.4.75'
> +_libdrm_checks = [
> + [with_dri_i915 or with_gallium_i915, 'intel'],
> + [with_amd_vk or with_gallium_radeonsi, 'amdgpu'],
> + [(with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or
> + with_gallium_r300 or with_gallium_r600),
> + 'radeon'],
> + [(with_gallium_nouveau or with_dri_nouveau), 'nouveau'],
> + [with_gallium_etnaviv, 'etnaviv'],
> + [with_gallium_freedreno, 'freedreno'],
> +# Loop over the enables versions and get the highest libdrm requirement for
> +# active drivers.
> +foreach d : _libdrm_checks
> + ver = get_variable('_drm_@0@_ver'.format(d))
> + if d and ver.version_compare('>' + _drm_ver)
> + _drm_ver = ver
> + endif
> +# Then get each libdrm module
> +foreach d : _libdrm_checks
> + if d
> + set_variable(
> + 'dep_libdrm_' + d,
> + dependency('libdrm_' + d, version : '>=' + _drm_ver)
> + )
> + endif
> with_gallium_drisw_kms = false
> -dep_libdrm = dependency('libdrm', version : '>= 2.4.75',
> - required : with_dri2 or with_dri3)
> +dep_libdrm = dependency(
> + 'libdrm', version : '>=' + _drm_ver,
> + required : with_dri2 or with_dri3
> if dep_libdrm.found()
> pre_args += '-DHAVE_LIBDRM'
> if with_dri_platform == 'drm' and with_dri
IIRC a few developers had some suggestions about this in the past, I
think Dave and Ilia were mostly interested.
Namely - both libdrm and libdrm_$vendor should meet the
I'd give it a quick check with them, since I don't know the specifics
on their setups.
mesa-dev mailing list