commit:     a4ca7cc2d9bc8cb0a253e81632b1a034920cf87e
Author:     Mike Lothian <mike <AT> fireburn <DOT> co <DOT> uk>
AuthorDate: Fri Aug  5 12:49:36 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue Sep  6 16:03:24 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4ca7cc2

media-libs/mesa: Add support for d3d12 and dozen drivers

This adds support for the d3d12 gallium driver and the dozen vulkan
driver. It uses the video_cards_microsoft flag

It optionally adds in video acceleration if vaapi or vdpau is enabled

It's been compiled tested with GCC 12.1 & Clang 14

If building mesa with Clang, directx-headers must be build with clang
too, otherwise you'll experience linking errors

Closes: https://github.com/gentoo/gentoo/pull/26746
Signed-off-by: Mike Lothain <mike <AT> fireburn.co.uk>
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 media-libs/mesa/mesa-9999.ebuild | 30 +++++++++++++++++++++---------
 profiles/arch/amd64/use.mask     |  1 +
 profiles/arch/base/use.mask      |  1 +
 profiles/arch/x86/use.mask       |  1 +
 profiles/desc/video_cards.desc   |  1 +
 5 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild
index 379fc0756847..830e5bfd10f3 100644
--- a/media-libs/mesa/mesa-9999.ebuild
+++ b/media-libs/mesa/mesa-9999.ebuild
@@ -25,7 +25,7 @@ SLOT="0"
 RESTRICT="!test? ( test )"
 
 RADEON_CARDS="r300 r600 radeon radeonsi"
-VIDEO_CARDS="${RADEON_CARDS} freedreno intel lima nouveau panfrost v3d vc4 
virgl vivante vmware"
+VIDEO_CARDS="${RADEON_CARDS} d3d12 freedreno intel lima nouveau panfrost v3d 
vc4 virgl vivante vmware"
 for card in ${VIDEO_CARDS}; do
        IUSE_VIDEO_CARDS+=" video_cards_${card}"
 done
@@ -176,6 +176,7 @@ RDEPEND="${RDEPEND}
 unset {LLVM,CLANG}_DEPSTR{,_AMDGPU}
 
 DEPEND="${RDEPEND}
+       video_cards_d3d12? ( dev-util/directx-headers[${MULTILIB_USEDEP}] )
        valgrind? ( dev-util/valgrind )
        wayland? ( >=dev-libs/wayland-protocols-1.24 )
        X? (
@@ -223,11 +224,12 @@ llvm_check_deps() {
 
 pkg_pretend() {
        if use vulkan; then
-               if ! use video_cards_freedreno &&
+               if ! use video_cards_d3d12 &&
+                  ! use video_cards_freedreno &&
                   ! use video_cards_intel &&
                   ! use video_cards_radeonsi &&
                   ! use video_cards_v3d; then
-                       ewarn "Ignoring USE=vulkan     since VIDEO_CARDS does 
not contain freedreno, intel, radeonsi, or v3d"
+                       ewarn "Ignoring USE=vulkan     since VIDEO_CARDS does 
not contain d3d12, freedreno, intel, radeonsi, or v3d"
                fi
        fi
 
@@ -239,19 +241,21 @@ pkg_pretend() {
        fi
 
        if use vaapi; then
-               if ! use video_cards_r600 &&
+               if ! use video_cards_d3d12 &&
+                  ! use video_cards_r600 &&
                   ! use video_cards_radeonsi &&
                   ! use video_cards_nouveau; then
-                       ewarn "Ignoring USE=vaapi      since VIDEO_CARDS does 
not contain r600, radeonsi, or nouveau"
+                       ewarn "Ignoring USE=vaapi      since VIDEO_CARDS does 
not contain d3d12, r600, radeonsi, or nouveau"
                fi
        fi
 
        if use vdpau; then
-               if ! use video_cards_r300 &&
+               if ! use video_cards_d3d12 &&
+                  ! use video_cards_r300 &&
                   ! use video_cards_r600 &&
                   ! use video_cards_radeonsi &&
                   ! use video_cards_nouveau; then
-                       ewarn "Ignoring USE=vdpau      since VIDEO_CARDS does 
not contain r300, r600, radeonsi, or nouveau"
+                       ewarn "Ignoring USE=vdpau      since VIDEO_CARDS does 
not contain d3d12, r300, r600, radeonsi, or nouveau"
                fi
        fi
 
@@ -329,7 +333,8 @@ multilib_src_configure() {
                emesonargs+=(-Dgallium-nine=false)
        fi
 
-       if use video_cards_r600 ||
+       if use video_cards_d3d12 ||
+          use video_cards_r600 ||
           use video_cards_radeonsi ||
           use video_cards_nouveau; then
                emesonargs+=($(meson_feature vaapi gallium-va))
@@ -338,7 +343,12 @@ multilib_src_configure() {
                emesonargs+=(-Dgallium-va=disabled)
        fi
 
-       if use video_cards_r300 ||
+       if use video_cards_d3d12; then
+               emesonargs+=($(meson_feature vaapi gallium-d3d12-video))
+       fi
+
+       if use video_cards_d3d12 ||
+          use video_cards_r300 ||
           use video_cards_r600 ||
           use video_cards_radeonsi ||
           use video_cards_nouveau; then
@@ -375,6 +385,7 @@ multilib_src_configure() {
        gallium_enable video_cards_freedreno freedreno
        gallium_enable video_cards_intel crocus i915 iris
        gallium_enable video_cards_lima lima
+       gallium_enable video_cards_d3d12 d3d12
        gallium_enable video_cards_nouveau nouveau
        gallium_enable video_cards_panfrost panfrost
        gallium_enable video_cards_v3d v3d
@@ -400,6 +411,7 @@ multilib_src_configure() {
        if use vulkan; then
                vulkan_enable video_cards_freedreno freedreno
                vulkan_enable video_cards_intel intel
+               vulkan_enable video_cards_d3d12 microsoft-experimental
                vulkan_enable video_cards_radeonsi amd
                vulkan_enable video_cards_v3d broadcom
        fi

diff --git a/profiles/arch/amd64/use.mask b/profiles/arch/amd64/use.mask
index 19ac88e44f05..173918986b72 100644
--- a/profiles/arch/amd64/use.mask
+++ b/profiles/arch/amd64/use.mask
@@ -108,6 +108,7 @@
 -input_devices_wacom
 -video_cards_ast
 -video_cards_crocus
+-video_cards_d3d12
 -video_cards_i915
 -video_cards_i965
 -video_cards_intel

diff --git a/profiles/arch/base/use.mask b/profiles/arch/base/use.mask
index 499c69aadc54..649d66b60a69 100644
--- a/profiles/arch/base/use.mask
+++ b/profiles/arch/base/use.mask
@@ -123,6 +123,7 @@ video_cards_geode
 input_devices_vmmouse
 video_cards_ast
 video_cards_crocus
+video_cards_d3d12
 video_cards_i915
 video_cards_i965
 video_cards_intel

diff --git a/profiles/arch/x86/use.mask b/profiles/arch/x86/use.mask
index fefef575af00..f5ed2fdbec2f 100644
--- a/profiles/arch/x86/use.mask
+++ b/profiles/arch/x86/use.mask
@@ -125,6 +125,7 @@
 -input_devices_wacom
 -video_cards_ast
 -video_cards_crocus
+-video_cards_d3d12
 -video_cards_i915
 -video_cards_i965
 -video_cards_intel

diff --git a/profiles/desc/video_cards.desc b/profiles/desc/video_cards.desc
index 2b3d795e5b75..34d72812a660 100644
--- a/profiles/desc/video_cards.desc
+++ b/profiles/desc/video_cards.desc
@@ -7,6 +7,7 @@
 
 amdgpu - VIDEO_CARDS setting to build driver for AMDGPU video cards
 ast - VIDEO_CARDS setting to build driver for ASpeedTech video cards
+d3d12 - VIDEO_CARDS seeting to build driver for Microsoft WSL video cards
 dummy - VIDEO_CARDS setting to build driver for dummy video cards
 exynos - VIDEO_CARDS setting to build driver for Samsung Exynos video cards
 freedreno - VIDEO_CARDS setting to build reverse-engineered driver for 
Qualcomm Adreno cards

Reply via email to