commit cad35064f5eb115b9ef8ea06159b4c0716e1599b
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Sat Jan 22 08:18:42 2022 +0000
Add fix to remove existing generic drivers
nvidia-kmod-simpledrm.patch | 63 +++++++++++++++++++++++++++++++++++++++++++++
nvidia-kmod.spec | 7 ++++-
2 files changed, 69 insertions(+), 1 deletion(-)
---
diff --git a/nvidia-kmod-simpledrm.patch b/nvidia-kmod-simpledrm.patch
new file mode 100644
index 0000000..8607bba
--- /dev/null
+++ b/nvidia-kmod-simpledrm.patch
@@ -0,0 +1,63 @@
+From 4f64c5eb6abb6bc75d3d49d2a0b409366068f0e7 Mon Sep 17 00:00:00 2001
+From: Javier Martinez Canillas <javierm(a)redhat.com>
+Date: Fri, 21 Jan 2022 18:10:25 +0100
+Subject: [PATCH] nvidia-drm: remove existing generic drivers to take over the
+ device
+
+There are drivers that register framebuffer devices very early in the boot
+process and make use of the existing framebuffer as setup by the firmware.
+
+If one of those drivers has registered a fbdev, then the fallback fbdev of
+the DRM driver won't be bound to the framebuffer console. To avoid that,
+remove any existing generic driver and take over the graphics device.
+
+By doing that, the fb mapped to the console is switched correctly from the
+early fbdev (i.e: simpledrm) to the one registered by the real DRM drivers.
+
+Signed-off-by: Javier Martinez Canillas <javierm(a)redhat.com>
+---
+ kernel/nvidia-drm/nvidia-drm-drv.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index 0d29d1d6bf4d..3f7725de6b91 100644
+--- a/kernel/nvidia-drm/nvidia-drm-drv.c
++++ b/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -60,6 +60,8 @@
+ #include <drm/drm_ioctl.h>
+ #endif
+
++#include <drm/drm_aperture.h>
++
+ #include <linux/pci.h>
+
+ /*
+@@ -897,6 +899,8 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t
*gpu_info)
+ struct drm_device *dev = NULL;
+ struct device *device = gpu_info->os_device_ptr;
+
++ int ret = 0;
++
+ DRM_DEBUG(
+ "Registering device for NVIDIA GPU ID 0x08%x",
+ gpu_info->gpu_id);
+@@ -917,6 +921,16 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t
*gpu_info)
+ mutex_init(&nv_dev->lock);
+ #endif
+
++ /* Remove existing drivers that may own the framebuffer memory. */
++
++ ret = drm_aperture_remove_framebuffers(false, &nv_drm_driver);
++ if (ret) {
++ NV_DRM_DEV_LOG_ERR(nv_dev,
++ "Failed to remove existing framebuffers - %d.\n",
++ ret);
++ return;
++ }
++
+ /* Allocate DRM device */
+
+ dev = drm_dev_alloc(&nv_drm_driver, device);
+--
+2.34.1
+
diff --git a/nvidia-kmod.spec b/nvidia-kmod.spec
index 4993131..7ee1f98 100644
--- a/nvidia-kmod.spec
+++ b/nvidia-kmod.spec
@@ -12,13 +12,14 @@ Name: nvidia-kmod
Epoch: 3
Version: 510.39.01
# Taken over by kmodtool
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: NVIDIA display driver kernel module
License: Redistributable, no modification permitted
URL:
http://www.nvidia.com/
Source11: nvidia-kmodtool-excludekernel-filterfile
Patch0: nvidia-kmod-pci-request-regions.patch
+Patch1: nvidia-kmod-simpledrm.patch
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: x86_64
@@ -43,6 +44,7 @@ kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name}
--filterf
tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{version}-%{_target_cpu}.tar.xz
# patch loop
%patch0 -p0
+%patch1 -p1
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
@@ -77,6 +79,9 @@ done
%changelog
+* Sat Jan 22 2022 Leigh Scott <leigh123linux(a)gmail.com> - 3:510.39.01-3
+- Add fix to remove existing generic drivers
+
* Wed Jan 19 2022 Nicolas Chauvet <kwizart(a)gmail.com> - 3:510.39.01-2
- Add fix for FB