Quoting Ilia Mirkin (2018-03-13 12:15:08) > On Tue, Mar 13, 2018 at 3:05 PM, Emil Velikov <emil.l.veli...@gmail.com> > wrote: > > 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 > >> requirements, > >> +# but we always want to use the same version for all libdrm modules. That > >> means > >> +# 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') > >> -endif > >> -if with_amd_vk or with_gallium_radeonsi > >> - dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.90') > >> -endif > >> -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') > >> -endif > >> -if with_gallium_nouveau or with_dri_nouveau > >> - dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66') > >> -endif > >> -if with_gallium_etnaviv > >> - dep_libdrm_etnaviv = dependency('libdrm_etnaviv', version : '>= 2.4.82') > >> -endif > >> -if with_gallium_freedreno > >> - dep_libdrm_freedreno = dependency('libdrm_freedreno', version : '>= > >> 2.4.91') > >> -endif > >> + > >> +_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 all > >> +# active drivers. > >> +foreach d : _libdrm_checks > >> + ver = get_variable('_drm_@0@_ver'.format(d[1])) > >> + if d[0] and ver.version_compare('>' + _drm_ver) > >> + _drm_ver = ver > >> + endif > >> +endforeach > >> + > >> +# Then get each libdrm module > >> +foreach d : _libdrm_checks > >> + if d[0] > >> + set_variable( > >> + 'dep_libdrm_' + d[1], > >> + dependency('libdrm_' + d[1], version : '>=' + _drm_ver) > >> + ) > >> + endif > >> +endforeach > >> > >> 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 > > $vendor_version requirement. > > > > I'd give it a quick check with them, since I don't know the specifics > > on their setups. > > > > -Emil > > A quick glance over this makes sense. You basically say that if you > have $drivera and $driverb enabled, take each of them, and say libdrm* > > $drivera and libdrm* > $driverb, which in effect says that the max > of those is the minimum required. But if driverc is not enabled, then > its version requirements are not taken into account. > > Is this an accurate interpretation of what your patch does?
Yes that's exactly what it does. Dylan
signature.asc
Description: signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev