Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add vulkan-nouveau-git #947

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
109 changes: 109 additions & 0 deletions pkgs/lib32-vulkan-nouveau-git/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Maintainer: Echo J. <aidas957 at gmail dot com>
# shellcheck shell=bash disable=SC2034,SC2164

pkgname=lib32-vulkan-nouveau-git
pkgdesc="Nouveau Vulkan (NVK) Mesa driver with some additions (32-bit Git version)"
pkgver=24.0.branchpoint.r4611.g702f40f
pkgrel=1
arch=('x86_64')
depends=('lib32-libdrm' 'lib32-libxshmfence' 'lib32-libx11' 'lib32-systemd' 'lib32-vulkan-icd-loader' 'lib32-wayland')
makedepends=('cbindgen' 'elfutils' 'git' 'glslang' 'lib32-libunwind' 'lib32-libxrandr' 'lib32-rust-libs' 'meson>=1.3.0rc2'
'python-mako' 'rust-bindgen' 'systemd' 'wayland-protocols' 'xorgproto' 'zstd') # -rc1 has weird crate issues
optdepends=('lib32-vulkan-mesa-layers: Additional Vulkan layers'
'linux>=6.6.arch1: Minimum required kernel for new uAPI support')
provides=('lib32-vulkan-driver')
conflicts=('lib32-vulkan-nouveau')
url="https://gitlab.freedesktop.org/mesa/mesa"
license=('MIT AND BSD-3-Clause AND SGI-B-2.0')
source=("git+${url}.git",
"drm-modifiers.patch")
sha512sums=('SKIP',
'SKIP')
install="${pkgname}.install"

prepare() {
# HACK: Don't copy Mesa defaults (they're basically useless for this standalone driver)
# TODO: replace this with a build option if possible
cd mesa
sed -i 's/install_data/#install_data/' src/util/meson.build

# HACK: Disable xcb-util-keysyms dependency
# It's only used for a RADV-specific trace feature so it's useless for us
sed -i 's/with_xcb_keysyms = dep_xcb_keysyms.found()/with_xcb_keysyms = false/' meson.build

# Set some common patch command options
_patch_opts="--no-backup-if-mismatch -Np1 -i"

### DXVK v2.0+ FIRE FESTIVAL (that is somehow working) ###

# HACK: Always expose Vulkan memory model/Vulkan 1.3
# NAK does properly support those now but the compiler is still WIP for pre-Volta GPUs (so I'll enable these at the cost of CTS tests)
sed -i 's/KHR_vulkan_memory_model = nvk_use_nak(info)/KHR_vulkan_memory_model = true/' src/nouveau/vulkan/nvk_physical_device.c
sed -i 's/vulkanMemoryModel = nvk_use_nak(info)/vulkanMemoryModel = true/' src/nouveau/vulkan/nvk_physical_device.c
sed -i 's/VK_MAKE_VERSION(1, 0/VK_MAKE_VERSION(1, 3/' src/nouveau/vulkan/nvk_physical_device.c

### Misc stuff ###

# Mark this NVK package with a signature (so I could track who's using it for bug report purposes)
sed -i 's/"Mesa " PACKAGE_VERSION/"Mesa DodoNVK " PACKAGE_VERSION/' src/nouveau/vulkan/nvk_physical_device.c
}

pkgver() {
cd mesa
git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
# Auto-download Rust crates for NAK/NIL (removes extra code for crate handling)
_nvk_crate="--force-fallback-for=paste,syn"

# HACK: Remove crate .rlib files before build
# (This prevents build errors after a Rust update: https://github.com/mesonbuild/meson/issues/10706)
[ -d build/subprojects ] && find build/subprojects \( -iname "*.rlib" -o -iname "*.so" \) -delete
[ -d build/src/nouveau/compiler ] && find build/src/nouveau/compiler -iname "*.rlib" -delete
[ -d build/src/nouveau/headers ] && find build/src/nouveau/headers -iname "*.rlib" -delete
[ -d build/src/nouveau/nil ] && find build/src/nouveau/nil -iname "*.rlib" -delete

# As you can see, I optimized the build options pretty well 🐸
arch-meson mesa build \
--cross-file lib32 \
--reconfigure \
--wrap-mode=nofallback \
${_nvk_crate} \
-D b_ndebug=false \
-D platforms=x11,wayland \
-D gallium-drivers= \
-D vulkan-drivers=nouveau \
-D vulkan-layers= \
-D dri3=enabled \
-D egl=disabled \
-D gallium-extra-hud=false \
-D gallium-nine=false \
-D gallium-omx=disabled \
-D gallium-opencl=disabled \
-D gallium-va=disabled \
-D gallium-vdpau=disabled \
-D gallium-xa=disabled \
-D gbm=disabled \
-D gles1=disabled \
-D gles2=disabled \
-D glvnd=disabled \
-D glx=disabled \
-D libunwind=enabled \
-D llvm=disabled \
-D lmsensors=disabled \
-D osmesa=false \
-D shared-glapi=disabled \
-D microsoft-clc=disabled \
-D valgrind=disabled \
-D android-libbacktrace=disabled \
-D intel-rt=disabled

meson compile -C build
}

package() {
meson install -C build --destdir "${pkgdir}"

install -Dm644 mesa/docs/license.rst -t "${pkgdir}/usr/share/licenses/${pkgname}"
}