media-libs/mesa: Add Vulkan support.
authorMatt Turner <mattst88@gentoo.org>
Mon, 14 Nov 2016 19:37:06 +0000 (11:37 -0800)
committerMatt Turner <mattst88@gentoo.org>
Tue, 15 Nov 2016 01:25:09 +0000 (17:25 -0800)
Bug: https://bugs.gentoo.org/580148

media-libs/mesa/mesa-13.0.1.ebuild
media-libs/mesa/mesa-9999.ebuild
media-libs/mesa/metadata.xml

index c604a36ef957e7a4f929c77a11a9ac2b51e97a7f..664a022e69babc0f4a56dd3bd642a68f8622695d 100644 (file)
@@ -45,7 +45,7 @@ done
 IUSE="${IUSE_VIDEO_CARDS}
        bindist +classic d3d9 debug +dri3 +egl +gallium +gbm gcrypt gles1 gles2
        libressl +llvm nettle +nptl opencl osmesa pax_kernel openmax +openssl pic
-       selinux vaapi valgrind vdpau wayland xvmc xa kernel_FreeBSD"
+       selinux vaapi valgrind vdpau vulkan wayland xvmc xa kernel_FreeBSD"
 
 REQUIRED_USE="
        || ( gcrypt libressl nettle openssl )
@@ -57,6 +57,7 @@ REQUIRED_USE="
        gles2?  ( egl )
        vaapi? ( gallium )
        vdpau? ( gallium )
+       vulkan? ( || ( video_cards_i965 video_cards_radeonsi ) )
        wayland? ( egl gbm )
        xa?  ( gallium )
        video_cards_freedreno?  ( gallium )
@@ -273,6 +274,11 @@ multilib_src_configure() {
                fi
        fi
 
+       if use vulkan; then
+               vulkan_enable video_cards_i965 intel
+               vulkan_enable video_cards_radeonsi radeon
+       fi
+
        # x86 hardened pax_kernel needs glx-rts, bug 240956
        if [[ ${ABI} == x86 ]]; then
                myconf+=" $(use_enable pax_kernel glx-read-only-text)"
@@ -311,6 +317,7 @@ multilib_src_configure() {
                --enable-llvm-shared-libs \
                --with-dri-drivers=${DRI_DRIVERS} \
                --with-gallium-drivers=${GALLIUM_DRIVERS} \
+               --with-vulkan-drivers=${VULKAN_DRIVERS} \
                --with-sha1=$(usex nettle libnettle $(usex gcrypt libgcrypt libcrypto)) \
                PYTHON2="${PYTHON}" \
                ${myconf}
@@ -383,6 +390,9 @@ multilib_src_install_all() {
        # Install config file for eselect mesa
        insinto /usr/share/mesa
        newins "${FILESDIR}/eselect-mesa.conf.9.2" eselect-mesa.conf
+
+       # Mesa should not install these
+       rm "${ED}"/usr/include/vulkan/{vulkan.h,vk_platform.h}
 }
 
 multilib_src_test() {
@@ -475,3 +485,20 @@ gallium_enable() {
                        ;;
        esac
 }
+
+vulkan_enable() {
+       case $# in
+               # for enabling unconditionally
+               1)
+                       VULKAN_DRIVERS+=",$1"
+                       ;;
+               *)
+                       if use $1; then
+                               shift
+                               for i in $@; do
+                                       VULKAN_DRIVERS+=",${i}"
+                               done
+                       fi
+                       ;;
+       esac
+}
index c604a36ef957e7a4f929c77a11a9ac2b51e97a7f..664a022e69babc0f4a56dd3bd642a68f8622695d 100644 (file)
@@ -45,7 +45,7 @@ done
 IUSE="${IUSE_VIDEO_CARDS}
        bindist +classic d3d9 debug +dri3 +egl +gallium +gbm gcrypt gles1 gles2
        libressl +llvm nettle +nptl opencl osmesa pax_kernel openmax +openssl pic
-       selinux vaapi valgrind vdpau wayland xvmc xa kernel_FreeBSD"
+       selinux vaapi valgrind vdpau vulkan wayland xvmc xa kernel_FreeBSD"
 
 REQUIRED_USE="
        || ( gcrypt libressl nettle openssl )
@@ -57,6 +57,7 @@ REQUIRED_USE="
        gles2?  ( egl )
        vaapi? ( gallium )
        vdpau? ( gallium )
+       vulkan? ( || ( video_cards_i965 video_cards_radeonsi ) )
        wayland? ( egl gbm )
        xa?  ( gallium )
        video_cards_freedreno?  ( gallium )
@@ -273,6 +274,11 @@ multilib_src_configure() {
                fi
        fi
 
+       if use vulkan; then
+               vulkan_enable video_cards_i965 intel
+               vulkan_enable video_cards_radeonsi radeon
+       fi
+
        # x86 hardened pax_kernel needs glx-rts, bug 240956
        if [[ ${ABI} == x86 ]]; then
                myconf+=" $(use_enable pax_kernel glx-read-only-text)"
@@ -311,6 +317,7 @@ multilib_src_configure() {
                --enable-llvm-shared-libs \
                --with-dri-drivers=${DRI_DRIVERS} \
                --with-gallium-drivers=${GALLIUM_DRIVERS} \
+               --with-vulkan-drivers=${VULKAN_DRIVERS} \
                --with-sha1=$(usex nettle libnettle $(usex gcrypt libgcrypt libcrypto)) \
                PYTHON2="${PYTHON}" \
                ${myconf}
@@ -383,6 +390,9 @@ multilib_src_install_all() {
        # Install config file for eselect mesa
        insinto /usr/share/mesa
        newins "${FILESDIR}/eselect-mesa.conf.9.2" eselect-mesa.conf
+
+       # Mesa should not install these
+       rm "${ED}"/usr/include/vulkan/{vulkan.h,vk_platform.h}
 }
 
 multilib_src_test() {
@@ -475,3 +485,20 @@ gallium_enable() {
                        ;;
        esac
 }
+
+vulkan_enable() {
+       case $# in
+               # for enabling unconditionally
+               1)
+                       VULKAN_DRIVERS+=",$1"
+                       ;;
+               *)
+                       if use $1; then
+                               shift
+                               for i in $@; do
+                                       VULKAN_DRIVERS+=",${i}"
+                               done
+                       fi
+                       ;;
+       esac
+}
index ab07f8bae6e37e6ea42db68633b3fab7e8a351dc..043aec22078c31d3e24d326ac1277fa8f27265f5 100644 (file)
@@ -28,6 +28,7 @@
                <flag name="pic">disable optimized assembly code that is not PIC friendly</flag>
                <flag name="valgrind">Compile in valgrind memory hints</flag>
                <flag name="vdpau">Enable the VDPAU acceleration interface for the Gallium3D Video Layer.</flag>
+               <flag name="vulkan">Enable Vulkan drivers</flag>
                <flag name="wayland">Enable support for dev-libs/wayland</flag>
                <flag name="xa">Enable the XA (X Acceleration) API for Gallium3D.</flag>
                <flag name="xvmc">Enable the XvMC acceleration interface for the Gallium3D Video Layer.</flag>