distribution/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0005-fix-5.9.patch
2022-02-05 09:23:32 -05:00

76 lines
2.7 KiB
Diff

diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv.c
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv.c 2020-08-26 14:28:09.350000000 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv.c 2020-08-26 14:35:42.856666666 +0200
@@ -2785,8 +2785,12 @@
#if defined(CONFIG_VGA_ARB)
#if defined(VGA_DEFAULT_DEVICE)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+ vga_get(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK, 0);
+#else
vga_tryget(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK);
#endif
+#endif
vga_set_legacy_decoding(dev, VGA_RSRC_NONE);
#endif
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c 2020-08-26 14:28:09.506666667 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2020-08-26 14:48:58.443333335 +0200
@@ -373,7 +373,11 @@
.set_busid = drm_pci_set_busid,
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+ .gem_free_object_unlocked = nv_gem_free,
+#else
.gem_free_object = nv_gem_free,
+#endif
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.gem_prime_export = drm_gem_prime_export,
@@ -470,8 +474,14 @@
#if defined(NV_DRM_GEM_OBJECT_PUT_UNLOCKED_PRESENT)
drm_gem_object_put_unlocked(&nv_obj->base);
#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+ drm_gem_object_put(&nv_obj->base);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+ drm_gem_object_put_locked(&nv_obj->base);
+#else
drm_gem_object_unreference_unlocked(&nv_obj->base);
#endif
+#endif
status = RM_OK;
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h 2020-08-26 14:28:09.583333333 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h 2020-08-26 14:53:45.693333299 +0200
@@ -136,8 +136,10 @@
#if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL)
#include <linux/syscalls.h> /* sys_ioctl() */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
#include <linux/ioctl32.h> /* register_ioctl32_conversion() */
#endif
+#endif
#if !defined(NV_FILE_OPERATIONS_HAS_IOCTL) && \
!defined(NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL)
@@ -2249,10 +2251,13 @@
pages, vmas, NULL);
#else
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+ return get_user_pages_remote(mm, start, nr_pages, flags,
+ pages, vmas, NULL);
+#else
return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
pages, vmas);
-
+#endif
#endif
}