Created
March 1, 2021 16:29
-
-
Save joanbm/7a034ac4b79396c3841040e410ef7e91 to your computer and use it in GitHub Desktop.
Tentative fix for NVIDIA 460.56 driver for Linux 5.12-rc1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From a2963d47c009bcbdc98907f70717d9d49425f6db Mon Sep 17 00:00:00 2001 | |
From: Joan Bruguera <[email protected]> | |
Date: Mon, 1 Mar 2021 17:25:15 +0100 | |
Subject: [PATCH] Tentative fix for NVIDIA 460.56 driver for Linux 5.12-rc1 | |
--- | |
nvidia-drm/nvidia-drm-drv.c | 12 ++++++++++++ | |
1 file changed, 12 insertions(+) | |
diff --git a/nvidia-drm/nvidia-drm-drv.c b/nvidia-drm/nvidia-drm-drv.c | |
index 9582531..c23a338 100644 | |
--- a/nvidia-drm/nvidia-drm-drv.c | |
+++ b/nvidia-drm/nvidia-drm-drv.c | |
@@ -20,6 +20,7 @@ | |
* 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" | |
@@ -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 */ | |
} | |
-- | |
2.30.1 | |
Hi Joan, I forgot to mention that my way of installation is certainly not the standard one. I'm actually using the RPMs provided for openSUSE's Tumbleweed. The module build uses the Kbuild system requiring the "always-y" targets.
Looks like at least the line numbers have changed in the meantime.
Hence, the patch for nvidia-drm-drv.c
had to be updated in order to allow the patches to be applied:
@@ -20,6 +20,7 @@
* 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"
@@ -700,10 +701,10 @@
.num_ioctls = ARRAY_SIZE(nv_drm_ioctls),
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
- .gem_prime_export = nv_drm_gem_prime_export,
- .gem_prime_get_sg_table = nv_drm_gem_prime_get_sg_table,
- .gem_prime_vmap = nv_drm_gem_prime_vmap,
- .gem_prime_vunmap = nv_drm_gem_prime_vunmap,
+/* .gem_prime_export = nv_drm_gem_prime_export, */
+/* .gem_prime_get_sg_table = nv_drm_gem_prime_get_sg_table, */
+/* .gem_prime_vmap = nv_drm_gem_prime_vmap, */
+/* .gem_prime_vunmap = nv_drm_gem_prime_vunmap, */
#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
.gem_prime_res_obj = nv_drm_gem_prime_res_obj,
@@ -730,10 +731,17 @@
#if defined(NV_DRM_DRIVER_HAS_LEGACY_DEV_LIST)
.legacy_dev_list = LIST_HEAD_INIT(nv_drm_driver.legacy_dev_list),
#else
- .device_list = LIST_HEAD_INIT(nv_drm_driver.device_list),
+ /* .device_list = LIST_HEAD_INIT(nv_drm_driver.device_list),*/
#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.
@@ -757,9 +765,12 @@
nv_drm_driver.dumb_create = nv_drm_dumb_create;
nv_drm_driver.dumb_map_offset = nv_drm_dumb_map_offset;
- nv_drm_driver.dumb_destroy = drm_gem_dumb_destroy;
-
- nv_drm_driver.gem_vm_ops = &nv_drm_gem_vma_ops;
+ #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
+ /* nv_drm_driver.gem_vm_ops = &nv_drm_gem_vma_ops; */
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@berny156: Thanks for the contribution, I did not run into this problem, but this may be because I build and apply the patch by adding it on top of the Arch Linux's nvidia-dkms package rather than running the installer, so maybe it does something differently. Thinking about this, I should test the patch before release using a more conventional Debian+NVIDIA-Installer setup so I catch those problems more often. Commit 5f2fb52fac15a seems to be quite old and has been in the kernel sources for some versions so I don't think it's the problem though, but rather maybe other more recent changes.
@dogansan: I didn't know there was an
--apply-patch
option, but it doesn't seem to be compatible with the way I set up the directory structure for the patch, which is rather set up so I can easily apply the patch automatically using DKMS.Anyway, if I remember correctly, you should be able to apply the patch by extracting the installer and manually running patch over the
kernel
folder after being extracted, like so: