summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Matteo Bernardini2021-06-17 17:32:54 +0200
committer Matteo Bernardini2021-06-17 17:32:54 +0200
commit71d3563b7c82fd7b50d5e62e12b38cb59ccdeb74 (patch)
tree76b286362d54dbf6a8c935f44ab37fda45a17756
parent9d43690fd55fb2c1a4d72855df80527b5b105d59 (diff)
downloadslackbuilds-71d3563b7c82fd7b50d5e62e12b38cb59ccdeb74.tar.gz
system/nvidia-legacy390-kernel: Patch for kernel 5.12.x.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
-rw-r--r--system/nvidia-legacy390-kernel/kernel-5.12.patch47
-rw-r--r--system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild2
2 files changed, 49 insertions, 0 deletions
diff --git a/system/nvidia-legacy390-kernel/kernel-5.12.patch b/system/nvidia-legacy390-kernel/kernel-5.12.patch
new file mode 100644
index 0000000000..8413156bf4
--- /dev/null
+++ b/system/nvidia-legacy390-kernel/kernel-5.12.patch
@@ -0,0 +1,47 @@
+Taken from https://build.opensuse.org/package/view_file/X11:Drivers:Video/nvidia-gfxG04/kernel-5.12.patch
+Credit to Larry Finger <Larry.Finger@lwfinger.net>
+390.143 refresh and version check by JF
+
+Index: NVIDIA-Linux-x86_64-390.143-no-compat32/kernel/nvidia-drm/nvidia-drm-drv.c
+===================================================================
+--- NVIDIA-Linux-x86_64-390.143-no-compat32.orig/kernel/nvidia-drm/nvidia-drm-drv.c
++++ NVIDIA-Linux-x86_64-390.143-no-compat32/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -20,6 +20,8 @@
+ * DEALINGS IN THE SOFTWARE.
+ */
+
++#include <linux/version.h>
++
+ #include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
+
+ #include "nvidia-drm-priv.h"
+@@ -737,6 +737,17 @@ static struct drm_driver nv_drm_driver =
+ #endif
+ };
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
++/* Starting with kernel 5.12, drm_gem_dumb_destroy() is no longer exported.
++ * For that reason, we need to supply a replacement version.
++ */
++int replace_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.
+@@ -760,7 +767,11 @@ static void nv_drm_update_drm_driver_fea
+
+ 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 = nv_drm_dumb_destroy;
++#else
++ nv_drm_driver.dumb_destroy = replace_dumb_destroy;
++#endif
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS)
+ nv_drm_driver.gem_vm_ops = &nv_drm_gem_vma_ops;
diff --git a/system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild b/system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild
index 7e7ecd9e18..0b28ef93c8 100644
--- a/system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild
+++ b/system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild
@@ -77,6 +77,8 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+patch -p1 < $CWD/kernel-5.12.patch
+
(cd kernel || exit 1
make SYSSRC=$KERNELPATH module || exit 1
)