commit:     28eb1f8c76963eb75f18e66072ac4244a367dacd
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  2 05:23:34 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Sun Oct  2 06:23:05 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28eb1f8c

x11-drivers/nvidia-drivers: patch 515.65.01 for >=kernel-6.0-rc1

Mostly because the fixed 515.76 is masked. Meant to fix more
versions, but older branches have other problems.

Unlikely to break again between -rc7 and release, but still
skipping updating NV_KERNEL_MAX until can try 6.0.0.

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 profiles/package.mask                                 |  3 +--
 .../files/nvidia-drivers-515.65.01-kernel6.patch      | 19 +++++++++++++++++++
 .../nvidia-drivers/nvidia-drivers-515.65.01.ebuild    |  6 ++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/profiles/package.mask b/profiles/package.mask
index 5b103b7dc310..41868fba75b0 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -102,8 +102,7 @@ games-sports/torcs
 # Ionen Wolkens <[email protected]> (2022-09-25)
 # This version been causing major issues for some RTX 30xx users and
 # no real reason not to stick to 515.65.01 for now (but feel free to
-# unmask if it's been fine and need it, notably has fixes to build
-# with upcoming 6.0 linux kernels).
+# unmask if it's been fine).
 # https://bugs.archlinux.org/task/75995
 # 
https://forums.developer.nvidia.com/t/bug-report-black-x11-screen-and-partial-lockup-when-upgraded-to-515-76-and-dual-rtx3060
 ~x11-drivers/nvidia-drivers-515.76

diff --git 
a/x11-drivers/nvidia-drivers/files/nvidia-drivers-515.65.01-kernel6.patch 
b/x11-drivers/nvidia-drivers/files/nvidia-drivers-515.65.01-kernel6.patch
new file mode 100644
index 000000000000..5cdf2f639c6b
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-515.65.01-kernel6.patch
@@ -0,0 +1,19 @@
+Normally avoid adding kernel support patches, but this one is very
+trivial and many want to use 6.0 early.
+
+Masked 515.76 has a more elaborate fix to ensure it works with
+all supported kernel branches (not all have this header), so
+this one should be conditional as a safety.
+
+Note older drivers branches have bigger issues and this is not
+sufficient, this will wait until their next release.
+
+https://github.com/NVIDIA/open-gpu-kernel-modules/pull/350
+--- a/kernel/nvidia-drm/nvidia-drm-helper.h
++++ b/kernel/nvidia-drm/nvidia-drm-helper.h
+@@ -109,4 +109,5 @@
+  */
+ #include <drm/drm_crtc.h>
++#include <drm/drm_framebuffer.h>
+ 
+ #if defined(drm_for_each_plane)

diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-515.65.01.ebuild 
b/x11-drivers/nvidia-drivers/nvidia-drivers-515.65.01.ebuild
index 9c35dd8fe324..f694157692b4 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-515.65.01.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-515.65.01.ebuild
@@ -232,6 +232,12 @@ src_prepare() {
        eapply --directory=kernel-module-source/kernel-open \
                -p2 "${FILESDIR}"/nvidia-drivers-470.141.03-clang15.patch
 
+       if kernel_is -ge 6; then # conditional as a safety, see patch
+               eapply "${FILESDIR}"/nvidia-drivers-515.65.01-kernel6.patch
+               eapply --directory=kernel-module-source/kernel-open \
+                       -p2 "${FILESDIR}"/nvidia-drivers-515.65.01-kernel6.patch
+       fi
+
        default
 
        # prevent detection of incomplete kernel DRM support (bug #603818)

Reply via email to