commit:     f85261855b30cf967158691a973f3e59852dbee7
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 14 19:37:06 2016 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 01:25:09 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8526185

media-libs/mesa: Add Vulkan support.

Bug: https://bugs.gentoo.org/580148

 media-libs/mesa/mesa-13.0.1.ebuild | 29 ++++++++++++++++++++++++++++-
 media-libs/mesa/mesa-9999.ebuild   | 29 ++++++++++++++++++++++++++++-
 media-libs/mesa/metadata.xml       |  1 +
 3 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/media-libs/mesa/mesa-13.0.1.ebuild 
b/media-libs/mesa/mesa-13.0.1.ebuild
index c604a36..664a022 100644
--- a/media-libs/mesa/mesa-13.0.1.ebuild
+++ b/media-libs/mesa/mesa-13.0.1.ebuild
@@ -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
+}

diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild
index c604a36..664a022 100644
--- a/media-libs/mesa/mesa-9999.ebuild
+++ b/media-libs/mesa/mesa-9999.ebuild
@@ -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
+}

diff --git a/media-libs/mesa/metadata.xml b/media-libs/mesa/metadata.xml
index ab07f8b..043aec2 100644
--- a/media-libs/mesa/metadata.xml
+++ b/media-libs/mesa/metadata.xml
@@ -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>

Reply via email to