nvidia_390/nvidia_390-390.143-kernel-5.12.patch

48 lines
1.7 KiB
Diff
Raw Normal View History

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;