Skip to content

Instantly share code, notes, and snippets.

@sorrat
Created September 13, 2021 18:42
Show Gist options
  • Save sorrat/1a3c06d3629534d551b948e100c58917 to your computer and use it in GitHub Desktop.
Save sorrat/1a3c06d3629534d551b948e100c58917 to your computer and use it in GitHub Desktop.
Fix NVIDIA 460.67 for Linux 5.14.2, based on https://gist.github.com/joanbm
--- common/inc/nv-time.h 2021-09-13 22:04:46.614497200 +0400
+++ common/inc/nv-time.h 2021-09-13 21:57:50.965477400 +0400
@@ -24,6 +24,7 @@
#define __NV_TIME_H__
#include "conftest.h"
+#include <linux/version.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
@@ -205,7 +206,12 @@
// the requested timeout has expired, loop until less
// than a jiffie of the desired delay remains.
//
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
current->state = TASK_INTERRUPTIBLE;
+#else
+ // Rel. commit "sched: Change task_struct::state" (Peter Zijlstra, Jun 11 2021)
+ WRITE_ONCE(current->__state, TASK_INTERRUPTIBLE);
+#endif
do
{
schedule_timeout(jiffies);
--- nvidia-drm/nvidia-drm-crtc.c 2021-09-13 22:04:28.561468900 +0400
+++ nvidia-drm/nvidia-drm-crtc.c 2021-09-13 21:57:42.262322400 +0400
@@ -24,6 +24,7 @@
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
+#include <linux/version.h>
#include "nvidia-drm-helper.h"
#include "nvidia-drm-priv.h"
#include "nvidia-drm-crtc.h"
@@ -226,9 +227,19 @@
return false;
}
+// Rel commit "drm/atomic: Pass the full state to planes atomic_check" (Maxime Ripard, Feb 19 2021)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0))
static int nv_drm_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *plane_state)
+#else
+static int nv_drm_plane_atomic_check(struct drm_plane *plane,
+ struct drm_atomic_state *state)
+#endif
{
+// Rel commit "drm/atomic: Pass the full state to planes atomic_check" (Maxime Ripard, Feb 19 2021)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0))
+ struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, plane);
+#endif
int i;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
@@ -275,13 +286,25 @@
return 0;
}
+// Rel commit "drm/atomic: Pass the full state to planes atomic disable and update" (Maxime Ripard, Feb 19 2021)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0))
static void nv_drm_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state)
+#else
+static void nv_drm_plane_atomic_update(struct drm_plane *plane,
+ struct drm_atomic_state *state)
+#endif
{
}
+// Rel commit "drm/atomic: Pass the full state to planes atomic disable and update" (Maxime Ripard, Feb 19 2021)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0))
static void nv_drm_plane_atomic_disable(struct drm_plane *plane,
struct drm_plane_state *old_state)
+#else
+static void nv_drm_plane_atomic_disable(struct drm_plane *plane,
+ struct drm_atomic_state *state)
+#endif
{
}
--- nvidia-drm/nvidia-drm-drv.c 2021-09-13 22:06:52.455752000 +0400
+++ nvidia-drm/nvidia-drm-drv.c 2021-09-13 22:09:03.070334800 +0400
@@ -22,6 +22,7 @@
#include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
+#include <linux/version.h>
#include "nvidia-drm-priv.h"
#include "nvidia-drm-drv.h"
#include "nvidia-drm-fb.h"
@@ -865,9 +866,12 @@
dev->dev_private = nv_dev;
nv_dev->dev = dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
+ // Rel. commit "drm: Remove pdev field from struct drm_device" (Thomas Zimmermann, 3 May 2021)
if (device->bus == &pci_bus_type) {
dev->pdev = to_pci_dev(device);
}
+#endif
/* Register DRM device to DRM sub-system */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment