Import initial kernel 5.12 compat patch, based on Joan Bruguera's b21e792dc0/nvidia-fix-linux-5.12.patch
This commit is contained in:
29
PKGBUILD
29
PKGBUILD
@@ -215,7 +215,7 @@ fi
|
||||
|
||||
pkgname=("${_pkgname_array[@]}")
|
||||
pkgver=$_driver_version
|
||||
pkgrel=154
|
||||
pkgrel=155
|
||||
arch=('x86_64')
|
||||
url="http://www.nvidia.com/"
|
||||
license=('custom:NVIDIA')
|
||||
@@ -268,6 +268,7 @@ source=($_source_name
|
||||
'kernel-5.11.patch' # 5.11 workaround
|
||||
'5.11-legacy.diff' # 5.11 additional workaround (<460.32.03)
|
||||
'455-crashfix.diff' # 455 drivers fix - https://forums.developer.nvidia.com/t/455-23-04-page-allocation-failure-in-kernel-module-at-random-points/155250/79
|
||||
'kernel-5.12.patch' # 5.12 workaround
|
||||
)
|
||||
|
||||
msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP
|
||||
@@ -300,7 +301,8 @@ md5sums=("$_md5sum"
|
||||
'bcdd512edad1bad8331a8872259d2581'
|
||||
'fd0d6e14e675a61f32279558678cfc36'
|
||||
'8764cc714e61363cc8f818315957ad17'
|
||||
'08bec554de265ce5fdcfdbd55fb608fc')
|
||||
'08bec554de265ce5fdcfdbd55fb608fc'
|
||||
'539fef68f4466c4d8cce40bb2fe0e7d9')
|
||||
|
||||
if [ "$_autoaddpatch" = "true" ]; then
|
||||
# Auto-add *.patch files from $startdir to source=()
|
||||
@@ -575,6 +577,12 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# 5.12
|
||||
if (( $(vercmp "$_kernel" "5.12") >= 0 )); then
|
||||
_kernel512="1"
|
||||
_whitelist512=( 455.50* 460.* )
|
||||
fi
|
||||
|
||||
# Loop patches (linux-4.15.patch, lol.patch, ...)
|
||||
for _p in $(printf -- '%s\n' ${source[@]} | grep .patch); do # https://stackoverflow.com/a/21058239/1821548
|
||||
# Patch version (4.15, "", ...)
|
||||
@@ -625,6 +633,9 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
if [ "$_patch" = "5.11" ]; then
|
||||
_whitelist=(${_whitelist511[@]})
|
||||
fi
|
||||
if [ "$_patch" = "5.12" ]; then
|
||||
_whitelist=(${_whitelist512[@]})
|
||||
fi
|
||||
|
||||
patchy=0
|
||||
if (( $(vercmp "$_kernel" "$_patch") >= 0 )); then
|
||||
@@ -897,6 +908,20 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# 5.12
|
||||
if [ "$_kernel512" = "1" ]; then
|
||||
patchy=0
|
||||
for yup in "${_whitelist512[@]}"; do
|
||||
[[ $pkgver = $yup ]] && patchy=1
|
||||
done
|
||||
if [ "$patchy" = "1" ]; then
|
||||
msg2 "Applying kernel-5.12.patch for dkms..."
|
||||
patch -Np1 -i "$srcdir"/kernel-5.12.patch
|
||||
else
|
||||
msg2 "Skipping kernel-5.12.patch as it doesn't apply to this driver version..."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Legacy quirks
|
||||
if [ "$_oldstuff" = "1" ]; then
|
||||
msg2 "Applying 01-ipmi-vm.diff for dkms..."
|
||||
|
30
patches/kernel-5.12.patch
Normal file
30
patches/kernel-5.12.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
diff --git a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
index 9582531..c23a338 100644
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
@@ -796,6 +797,13 @@ static struct drm_driver nv_drm_driver = {
|
||||
#endif
|
||||
};
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
|
||||
+// Reimport trivial forwarder function deleted in commit "drm: Don't export the drm_gem_dumb_destroy() function" (file drivers/gpu/drm/drm_gem.c)
|
||||
+static int nv_drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev, u32 handle)
|
||||
+{
|
||||
+ return drm_gem_handle_delete(file, handle);
|
||||
+}
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Update the global nv_drm_driver for the intended features.
|
||||
@@ -819,7 +827,11 @@ static void nv_drm_update_drm_driver_features(void)
|
||||
|
||||
nv_drm_driver.dumb_create = nv_drm_dumb_create;
|
||||
nv_drm_driver.dumb_map_offset = nv_drm_dumb_map_offset;
|
||||
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
|
||||
nv_drm_driver.dumb_destroy = drm_gem_dumb_destroy;
|
||||
+#else
|
||||
+ nv_drm_driver.dumb_destroy = nv_drm_gem_dumb_destroy;
|
||||
+#endif
|
||||
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
||||
}
|
||||
|
Reference in New Issue
Block a user