commit 8c2d4883ecb4dfe56b6fbbdb3f827d0efd578637
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Mon Mar 4 12:57:59 2024 +0000
Add fix for 'Flip event'
nvidia-drm-take-modeset-ownership-earlier.patch | 97 +++++++++++++++++++++++++
nvidia-kmod.spec | 7 +-
2 files changed, 103 insertions(+), 1 deletion(-)
---
diff --git a/nvidia-drm-take-modeset-ownership-earlier.patch
b/nvidia-drm-take-modeset-ownership-earlier.patch
new file mode 100644
index 0000000..56fa6bc
--- /dev/null
+++ b/nvidia-drm-take-modeset-ownership-earlier.patch
@@ -0,0 +1,97 @@
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index 9de3f3fa7105..0e867433307a 100644
+--- a/kernel/nvidia-drm/nvidia-drm-drv.c
++++ b/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -480,6 +480,22 @@ static int nv_drm_load(struct drm_device *dev, unsigned long flags)
+ return -ENODEV;
+ }
+
++#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
++ /*
++ * If fbdev is enabled, take modeset ownership now before other DRM clients
++ * can take master (and thus NVKMS ownership).
++ */
++ if (nv_drm_fbdev_module_param) {
++ if (!nvKms->grabOwnership(pDevice)) {
++ nvKms->freeDevice(pDevice);
++ NV_DRM_DEV_LOG_ERR(nv_dev, "Failed to grab NVKMS modeset
ownership");
++ return -EBUSY;
++ }
++
++ nv_dev->hasFramebufferConsole = NV_TRUE;
++ }
++#endif
++
+ mutex_lock(&nv_dev->lock);
+
+ /* Set NvKmsKapiDevice */
+@@ -590,6 +606,15 @@ static void __nv_drm_unload(struct drm_device *dev)
+ return;
+ }
+
++ /* Release modeset ownership if fbdev is enabled */
++
++#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
++ if (nv_dev->hasFramebufferConsole) {
++ drm_atomic_helper_shutdown(dev);
++ nvKms->releaseOwnership(nv_dev->pDevice);
++ }
++#endif
++
+ cancel_delayed_work_sync(&nv_dev->hotplug_event_work);
+ mutex_lock(&nv_dev->lock);
+
+@@ -1768,14 +1793,7 @@ void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
+ }
+
+ #if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
+- if (nv_drm_fbdev_module_param &&
+- drm_core_check_feature(dev, DRIVER_MODESET)) {
+-
+- if (!nvKms->grabOwnership(nv_dev->pDevice)) {
+- NV_DRM_DEV_LOG_ERR(nv_dev, "Failed to grab NVKMS modeset
ownership");
+- goto failed_grab_ownership;
+- }
+-
++ if (nv_dev->hasFramebufferConsole) {
+ if (bus_is_pci) {
+ struct pci_dev *pdev = to_pci_dev(device);
+
+@@ -1786,8 +1804,6 @@ void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
+ #endif
+ }
+ drm_fbdev_generic_setup(dev, 32);
+-
+- nv_dev->hasFramebufferConsole = NV_TRUE;
+ }
+ #endif /* defined(NV_DRM_FBDEV_GENERIC_AVAILABLE) */
+
+@@ -1798,12 +1814,6 @@ void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
+
+ return; /* Success */
+
+-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
+-failed_grab_ownership:
+-
+- drm_dev_unregister(dev);
+-#endif
+-
+ failed_drm_register:
+
+ nv_drm_dev_free(dev);
+@@ -1870,12 +1880,6 @@ void nv_drm_remove_devices(void)
+ struct nv_drm_device *next = dev_list->next;
+ struct drm_device *dev = dev_list->dev;
+
+-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
+- if (dev_list->hasFramebufferConsole) {
+- drm_atomic_helper_shutdown(dev);
+- nvKms->releaseOwnership(dev_list->pDevice);
+- }
+-#endif
+ drm_dev_unregister(dev);
+ nv_drm_dev_free(dev);
+
+--
+2.44.0
+
diff --git a/nvidia-kmod.spec b/nvidia-kmod.spec
index d725ce2..e29961a 100644
--- a/nvidia-kmod.spec
+++ b/nvidia-kmod.spec
@@ -12,7 +12,7 @@ Name: nvidia-kmod
Epoch: 3
Version: 550.54.14
# Taken over by kmodtool
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: NVIDIA display driver kernel module
License: Redistributable, no modification permitted
URL:
https://www.nvidia.com/
@@ -20,6 +20,7 @@ URL:
https://www.nvidia.com/
Source11: nvidia-kmodtool-excludekernel-filterfile
Patch0: make_modeset_default.patch
Patch1: gcc14.patch
+Patch2: nvidia-drm-take-modeset-ownership-earlier.patch
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: x86_64 aarch64
@@ -55,6 +56,7 @@ echo "Set nvidia to fbdev=1 modeset=1"
%patch -P0 -p1
%endif
%patch -P1 -p1
+%patch -P2 -p1
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
done
@@ -88,6 +90,9 @@ done
%changelog
+* Mon Mar 04 2024 Leigh Scott <leigh123linux(a)gmail.com> - 3:550.54.14-2
+- Add fix for 'Flip event'
+
* Fri Feb 23 2024 Leigh Scott <leigh123linux(a)gmail.com> - 3:550.54.14-1
- Update to 550.54.14 release