-dep_libdrm_amdgpu = []
-dep_libdrm_radeon = []
-dep_libdrm_nouveau = []
-dep_libdrm_etnaviv = []
-dep_libdrm_freedreno = []
-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')
+# 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 = null_dep
+dep_libdrm_radeon = null_dep
+dep_libdrm_nouveau = null_dep
+dep_libdrm_etnaviv = null_dep
+dep_libdrm_freedreno = null_dep
+dep_libdrm_intel = null_dep
+
+_drm_amdgpu_ver = '2.4.91'
+_drm_radeon_ver = '2.4.71'
+_drm_nouveau_ver = '2.4.66'
+_drm_etnaviv_ver = '2.4.89'
+_drm_freedreno_ver = '2.4.92'
+_drm_intel_ver = '2.4.75'
+_drm_ver = '2.4.75'
+
+_libdrm_checks = [
+ ['intel', with_dri_i915 or with_gallium_i915],
+ ['amdgpu', with_amd_vk or with_gallium_radeonsi],
+ ['radeon', (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or
+ with_gallium_r300 or with_gallium_r600)],
+ ['nouveau', (with_gallium_nouveau or with_dri_nouveau)],
+ ['etnaviv', with_gallium_etnaviv],
+ ['freedreno', with_gallium_freedreno],
+]
+
+# VC4 only needs core libdrm support of this version, not a libdrm_vc4
+# library.
+if with_gallium_vc4
+ _drm_ver = '2.4.89'