[FIX] Driver 418.43 with kernel 5

Tested with kernel 5.0.0-rc7 (drm-next-5.2-wip 940d1042) .

Here’s the patch :

diff --git kernel/conftest.sh kernel/conftest.sh
index 2dd63b4..720bbf4 100755
--- kernel/conftest.sh
+++ kernel/conftest.sh
@@ -2166,6 +2166,7 @@ compile_test() {
             echo "$CONFTEST_PREAMBLE
             #include <drm/drm_crtc_helper.h>
+            #include <drm/drm_probe_helper.h>
             void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
                                                 struct drm_framebuffer *fb,
                                                 const struct drm_mode_fb_cmd2 *mode_cmd)
@@ -2193,6 +2194,7 @@ compile_test() {
                 echo "$CONFTEST_PREAMBLE
                 #include <drm/drm_crtc_helper.h>
+                #include <drm/drm_probe_helper.h>
                 void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
                                                     const struct drm_mode_fb_cmd2 *mode_cmd)
diff --git kernel/nvidia-drm/nvidia-drm-connector.c kernel/nvidia-drm/nvidia-drm-connector.c
index 4dd12d1..0bf69dd 100644
--- kernel/nvidia-drm/nvidia-drm-connector.c
+++ kernel/nvidia-drm/nvidia-drm-connector.c
@@ -31,6 +31,7 @@
 #include "nvidia-drm-encoder.h"
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
diff --git kernel/nvidia-drm/nvidia-drm-crtc.c kernel/nvidia-drm/nvidia-drm-crtc.c
index 780df0e..285a6e3 100644
--- kernel/nvidia-drm/nvidia-drm-crtc.c
+++ kernel/nvidia-drm/nvidia-drm-crtc.c
@@ -34,6 +34,7 @@
 #include "nvidia-drm-ioctl.h"
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_atomic.h>
diff --git kernel/nvidia-drm/nvidia-drm-drv.c kernel/nvidia-drm/nvidia-drm-drv.c
index 58fd272..b330b1e 100644
--- kernel/nvidia-drm/nvidia-drm-drv.c
+++ kernel/nvidia-drm/nvidia-drm-drv.c
@@ -42,6 +42,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 #if defined(NV_DRM_DRM_GEM_H_PRESENT)
 #include <drm/drm_gem.h>
diff --git kernel/nvidia-drm/nvidia-drm-encoder.c kernel/nvidia-drm/nvidia-drm-encoder.c
index f66bbd7..d9ff50c 100644
--- kernel/nvidia-drm/nvidia-drm-encoder.c
+++ kernel/nvidia-drm/nvidia-drm-encoder.c
@@ -32,6 +32,7 @@
 #include "nvidia-drm-helper.h"
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
diff --git kernel/nvidia-drm/nvidia-drm-fb.c kernel/nvidia-drm/nvidia-drm-fb.c
index 725164a..d07ba8b 100644
--- kernel/nvidia-drm/nvidia-drm-fb.c
+++ kernel/nvidia-drm/nvidia-drm-fb.c
@@ -31,6 +31,7 @@
 #include "nvidia-drm-gem.h"
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 static void nv_drm_framebuffer_destroy(struct drm_framebuffer *fb)

I hope it helps somebody, since nvidia never launches a driver that works on non-generic drivers, and I’m not complaining only because of the 5.0, it has been a hell to workaround things since 4.18-4.20+/-. What a mess to choose a nvidia card.

I tried to use nouveau, but since I’m using a GTX1070 and yet they can’t manage the power consumption, even an YouTube video is enough to lag the card sometimes (it keeps at the lowest clock possible for safety).

Then I made some fixes for 410.93 but it simply won’t work with kernel 5.0 without horrible workarounds (re-coding). And I read from somewhere else that 418 was aiming the kernel 5.0. So I gave it a shot before digging more into the 4.20s.

Then for my luck the fix for 418.43 was much much easier. And finally after being forced to use nouveau for a long time, I can use an official driver.

It fixes errors like :

nvidia-drm-drv.c:222:5: error: implicit declaration of function ‘drm_kms_helper_poll_init’ did you mean ‘drm_modeset_lock_init’

Furthermore, if you don’t have any idea of what to do with this patch, do this :

  1. Download NVIDIA-Linux-x86_64-418.43.run .
  2. Copy the patch code in a file called patch in the same location.
  3. Run in a bash terminal:
    sh $DRIVER.run -x
    cd $DRIVER
    patch -p0 < ../patch
    cd ..
    ./$DRIVER/makeself.sh ./$DRIVER $DRIVER-fixed.run "$DRIVER fixed." ./nvidia-installer
  4. Install the new file exactly as you'd do with the original one.
  5. Think twice before buying an nvidia card. Even that you need to test some cuda codes. Think about opencl being hardware independent. I know you may think I'm a hater, but the only time I had peace with nvidia was using a tesla at a college's server. At my notebook it is a hell (optimus, no need to say anything else) and with every single different installation or driver version it reminds me of what nvidia is. Now that my new CPU needs some fixes not yet spreaded across the distro's kernels, I have been living with an unusable card.

Managing, tweaking, debugging and solving issues in linux is fun, no doubt. I know this solution is simple, but not always you’ll have that precious time to spend, specially if it is not an optmization but a blocker indeed.