aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2024-06-27 06:27:30 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2024-07-01 08:17:57 +0000
commitefb0c89e59bd2768d97c23ad1efe9c37e33b11fb (patch)
tree6d13168d26a527cd9613af26bc687b1044d8508d
parenta26876a1e5f8629e203f98d279dad670be735652 (diff)
graphics/mesa-dri: Convert gallium and vulkan driver to port options
Instead of selecting the one by arches add options. This will help users who doesn't want some features. The default are still the same based on the specific arch. No functional changes intended. Differential Revision: https://reviews.freebsd.org/D45754 Inspired by: graphics/mesa-devel Reviewed by: bapt Sponsored by: Beckhoff Automation GmbH & Co. KG
-rw-r--r--graphics/mesa-dri/Makefile88
-rw-r--r--graphics/mesa-dri/pkg-plist38
2 files changed, 69 insertions, 57 deletions
diff --git a/graphics/mesa-dri/Makefile b/graphics/mesa-dri/Makefile
index b0f9f3699612..6d62a6bd913e 100644
--- a/graphics/mesa-dri/Makefile
+++ b/graphics/mesa-dri/Makefile
@@ -1,6 +1,6 @@
PORTNAME= mesa-dri
PORTVERSION= ${MESAVERSION}
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= graphics
COMMENT= OpenGL hardware acceleration drivers for DRI2+
@@ -10,14 +10,8 @@ LIB_DEPENDS+= libglapi.so:graphics/mesa-libs
USES+= llvm:lib,noexport
-OPTIONS_GROUP= PLATFORM
-OPTIONS_GROUP_PLATFORM= X11 WAYLAND
-X11_DESC= Enable X11 support for GBM/EGL
-WAYLAND_DESC= Enable Wayland support for GBM/EGL and Vulkan
-WAYLAND_BUILD_DEPENDS= wayland-protocols>=1.8:graphics/wayland-protocols
-WAYLAND_LIB_DEPENDS= libwayland-client.so:graphics/wayland
-
OPTIONS_DEFINE= ZSTD
+OPTIONS_GROUP= GALLIUM PLATFORM VULKAN
OPTIONS_DEFAULT= WAYLAND X11 ZSTD
OPTIONS_SUB= yes
@@ -25,31 +19,51 @@ ZSTD_DESC= Use ZSTD for shader cache
ZSTD_LIB_DEPENDS= libzstd.so:archivers/zstd
ZSTD_MESON_ENABLED= zstd
-.include <bsd.port.options.mk>
-.include "${.CURDIR:H:H}/graphics/mesa-dri/Makefile.common"
+OPTIONS_GROUP_PLATFORM= X11 WAYLAND
+X11_DESC= Enable X11 support for GBM/EGL
+WAYLAND_DESC= Enable Wayland support for GBM/EGL and Vulkan
+WAYLAND_BUILD_DEPENDS= wayland-protocols>=1.8:graphics/wayland-protocols
+WAYLAND_LIB_DEPENDS= libwayland-client.so:graphics/wayland
-ALL_GALLIUM_DRIVERS= CROCUS I915 IRIS PANFROST R300 R600 RADEONSI SVGA \
- SWRAST ZINK
-ALL_VULKAN_DRIVERS= INTEL AMD SWRAST
+OPTIONS_GROUP_GALLIUM= crocus i915 iris panfrost r300 r600 radeonsi svga swrast zink
+GALLIUM_DESC= Unified OpenGL drivers
+crocus_DESC= Intel GPU Gen4 (Broadwater) to Gen7 (Haswell)
+i915_DESC= Intel GPU Gen3 (Grantsdale to Pineview)
+iris_DESC= Intel GPU Gen8 (Broadwell) and newer
+panfrost_DESC= ARM Midgard and Bifrost
+r300_DESC= AMD/ATI R300, R400 and R500
+r600_DESC= AMD/ATI R600, R700, Evergreen, Northern Islands
+radeonsi_DESC= AMD/ATI Southern Islands and newer
+svga_DESC= VMWare Virtual GPU
+swrast_DESC= Software Rasterizer
+zink_DESC= OpenGL on top of Khronos’ Vulkan API
-GALLIUM_DRIVERS+= SWRAST \
- ZINK
-VULKAN_DRIVERS+= SWRAST # lavapipe
+OPTIONS_EXCLUDE+= ${ARCH:Marmv7:C/.+/crocus i915 iris panfrost r300 r600 radeonsi svga zink/}
+OPTIONS_EXCLUDE+= ${ARCH:Naarch64:C/.+/panfrost/}
+OPTIONS_EXCLUDE+= ${ARCH:Namd64:Ni386:Nx86_64:C/.+/crocus i915 iris svga/}
+MESON_ARGS+= -Dgallium-drivers=${GALLIUM_DRIVERS:ts,}
+. for _gd in ${OPTIONS_GROUP_GALLIUM}
+OPTIONS_DEFAULT+= ${_gd}
+${_gd}_VARS+= GALLIUM_DRIVERS+=${_gd}
+. endfor
-.if ${ARCH} == aarch64
-GALLIUM_DRIVERS+= PANFROST
-.endif
+OPTIONS_GROUP_VULKAN= anv radv swrast_vk
+VULKAN_DESC= Vulkan drivers
+anv_DESC= Intel GPU Gen9 and newer Vulkan support
+radv_DESC= AMD/ATI Southern Islands and newer Vulkan support
+radv_BUILD_DEPENDS= glslangValidator:graphics/glslang
+swrast_vk_DESC= Software Rasterizer Vulkan support
-.if ${ARCH} == aarch64 || ${ARCH} == amd64 || ${ARCH} == i386 \
- || ${ARCH:Mpowerpc*} || ${ARCH} == riscv64
-GALLIUM_DRIVERS+= R300 R600 RADEONSI
-VULKAN_DRIVERS+= AMD
-BUILD_DEPENDS+= glslangValidator:graphics/glslang
-.endif
-.if ${ARCH} == amd64 || ${ARCH} == i386
-GALLIUM_DRIVERS+= CROCUS I915 IRIS SVGA
-VULKAN_DRIVERS+= INTEL
-.endif
+OPTIONS_EXCLUDE+= ${ARCH:Marmv7:C/.+/anv radv/}
+OPTIONS_EXCLUDE+= ${ARCH:Namd64:Ni386:Nx86_64:C/.+/anv/}
+MESON_ARGS+= -Dvulkan-drivers=${VULKAN_DRIVERS:ts,}
+. for _vd in ${OPTIONS_GROUP_VULKAN}
+OPTIONS_DEFAULT+= ${_vd}
+${_vd}_VARS+= VULKAN_DRIVERS+=${_vd:S/anv/intel/:S/radv/amd/:S/swrast_vk/swrast/}
+. endfor
+
+.include <bsd.port.options.mk>
+.include "${.CURDIR:H:H}/graphics/mesa-dri/Makefile.common"
LDFLAGS_i386= -Wl,-znotext
@@ -64,9 +78,7 @@ MESON_ARGS+= -Dxlib-lease=disabled
MESA_PLATFORMS+= wayland
.endif
-MESON_ARGS+= -Dgallium-drivers="${GALLIUM_DRIVERS:ts,:tl}" \
- -Dvulkan-drivers="${VULKAN_DRIVERS:ts,:tl}" \
- -Dplatforms="${MESA_PLATFORMS:ts,:tl}"
+MESON_ARGS+= -Dplatforms="${MESA_PLATFORMS:ts,:tl}"
# Vulkan Video extensions (keep in sync with mesa-gallium-va)
MESON_ARGS+= -Dvideo-codecs="vc1dec,h264dec,h264enc,h265dec,h265enc,av1dec,av1enc,vp9dec"
@@ -85,20 +97,20 @@ MESON_ARGS+= -Dandroid-libbacktrace=disabled \
-Dosmesa=false \
-Dvalgrind=disabled
-.for _gd in ${ALL_GALLIUM_DRIVERS}
+.for _gd in ${OPTIONS_GROUP_GALLIUM}
. if defined(GALLIUM_DRIVERS) && ${GALLIUM_DRIVERS:M${_gd}}
-PLIST_SUB+= ${_gd}_GDRIVER=""
+PLIST_SUB+= ${_gd}=""
. else
-PLIST_SUB+= ${_gd}_GDRIVER="@comment "
+PLIST_SUB+= ${_gd}="@comment "
. endif
.endfor
PLIST_SUB += ARCH=${ARCH:S/amd/x86_/}
-.for _vd in ${ALL_VULKAN_DRIVERS}
+.for _vd in ${OPTIONS_GROUP_VULKAN}
. if defined(VULKAN_DRIVERS) && ${VULKAN_DRIVERS:M${_vd}}
-PLIST_SUB+= ${_vd}_VDRIVER=""
+PLIST_SUB+= ${_vd}=""
. else
-PLIST_SUB+= ${_vd}_VDRIVER="@comment "
+PLIST_SUB+= ${_vd}="@comment "
. endif
.endfor
diff --git a/graphics/mesa-dri/pkg-plist b/graphics/mesa-dri/pkg-plist
index 1dbaa3607221..5c06f06c0b75 100644
--- a/graphics/mesa-dri/pkg-plist
+++ b/graphics/mesa-dri/pkg-plist
@@ -21,18 +21,18 @@ include/GL/internal/dri_interface.h
@comment include/GLES3/gl3platform.h
@comment include/KHR/khrplatform.h
@comment include/gbm.h
-%%CROCUS_GDRIVER%%lib/dri/crocus_dri.so
-%%I915_GDRIVER%%lib/dri/i915_dri.so
-%%IRIS_GDRIVER%%lib/dri/iris_dri.so
-%%PANFROST_GDRIVER%%lib/dri/panfrost_dri.so
-%%PANFROST_GDRIVER%%lib/dri/rockchip_dri.so
-%%SWRAST_GDRIVER%%lib/dri/kms_swrast_dri.so
-%%R300_GDRIVER%%lib/dri/r300_dri.so
-%%R600_GDRIVER%%lib/dri/r600_dri.so
-%%RADEONSI_GDRIVER%%lib/dri/radeonsi_dri.so
-%%SWRAST_GDRIVER%%lib/dri/swrast_dri.so
-%%SVGA_GDRIVER%%lib/dri/vmwgfx_dri.so
-%%ZINK_GDRIVER%%lib/dri/zink_dri.so
+%%crocus%%lib/dri/crocus_dri.so
+%%i915%%lib/dri/i915_dri.so
+%%iris%%lib/dri/iris_dri.so
+%%panfrost%%lib/dri/panfrost_dri.so
+%%panfrost%%lib/dri/rockchip_dri.so
+%%r300%%lib/dri/r300_dri.so
+%%r600%%lib/dri/r600_dri.so
+%%radeonsi%%lib/dri/radeonsi_dri.so
+%%svga%%lib/dri/vmwgfx_dri.so
+%%swrast%%lib/dri/kms_swrast_dri.so
+%%swrast%%lib/dri/swrast_dri.so
+%%zink%%lib/dri/zink_dri.so
@comment lib/libEGL.so
@comment lib/libEGL.so.1
@comment lib/libEGL.so.1.0.0
@@ -48,17 +48,17 @@ include/GL/internal/dri_interface.h
@comment lib/libGLESv2.so
@comment lib/libGLESv2.so.2
@comment lib/libGLESv2.so.2.0.0
-%%INTEL_VDRIVER%%lib/libvulkan_intel.so
-%%AMD_VDRIVER%%lib/libvulkan_radeon.so
-%%SWRAST_VDRIVER%%lib/libvulkan_lvp.so
+%%anv%%lib/libvulkan_intel.so
+%%radv%%lib/libvulkan_radeon.so
+%%swrast_vk%%lib/libvulkan_lvp.so
libdata/pkgconfig/dri.pc
@comment libdata/pkgconfig/egl.pc
@comment libdata/pkgconfig/gbm.pc
@comment libdata/pkgconfig/glesv1_cm.pc
@comment libdata/pkgconfig/glesv2.pc
share/drirc.d/00-mesa-defaults.conf
-%%AMD_VDRIVER%%share/drirc.d/00-radv-defaults.conf
+%%radv%%share/drirc.d/00-radv-defaults.conf
share/drirc.d/01-freebsd.conf
-%%INTEL_VDRIVER%%share/vulkan/icd.d/intel_icd.%%ARCH%%.json
-%%AMD_VDRIVER%%share/vulkan/icd.d/radeon_icd.%%ARCH%%.json
-%%SWRAST_VDRIVER%%share/vulkan/icd.d/lvp_icd.%%ARCH%%.json
+%%anv%%share/vulkan/icd.d/intel_icd.%%ARCH%%.json
+%%radv%%share/vulkan/icd.d/radeon_icd.%%ARCH%%.json
+%%swrast_vk%%share/vulkan/icd.d/lvp_icd.%%ARCH%%.json