File kernel-6.4.patch of Package nvidia-gfxG04

From: Hans-Peter Jansen <hpj@urpla.net>
Date: Tue, 04 July 2023 17:38:23 +0200
Subject: [PATCH] Tentative fix for NVIDIA 390.157 driver for Linux 6.4

Index: b/NVIDIA-Linux-x86_64-390.157/kernel/nvidia/nvidia.Kbuild
===================================================================
--- a/NVIDIA-Linux-x86_64-390.157/kernel/nvidia/nvidia.Kbuild
+++ b/NVIDIA-Linux-x86_64-390.157/kernel/nvidia/nvidia.Kbuild
@@ -209,6 +209,7 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += sysfs_
 NV_CONFTEST_TYPE_COMPILE_TESTS += vmalloc_has_pgprot_t_arg
 NV_CONFTEST_TYPE_COMPILE_TESTS += pci_dev_has_skip_bus_pm
 NV_CONFTEST_TYPE_COMPILE_TESTS += pci_channel_state
+NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_dumb_destroy
 
 NV_CONFTEST_GENERIC_COMPILE_TESTS += dom0_kernel_present
 NV_CONFTEST_GENERIC_COMPILE_TESTS += nvidia_vgpu_kvm_build
Index: b/NVIDIA-Linux-x86_64-390.157/kernel/nvidia-drm/nvidia-drm-drv.c
===================================================================
--- a/NVIDIA-Linux-x86_64-390.157/kernel/nvidia-drm/nvidia-drm-drv.c
+++ b/NVIDIA-Linux-x86_64-390.157/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -762,7 +762,9 @@ static void nv_drm_update_drm_driver_fea
 
     nv_drm_driver.dumb_create      = nv_drm_dumb_create;
     nv_drm_driver.dumb_map_offset  = nv_drm_dumb_map_offset;
+#if defined(NV_DRM_DRIVER_HAS_DUMB_DESTROY)
     nv_drm_driver.dumb_destroy     = nv_drm_dumb_destroy;
+#endif /* NV_DRM_DRIVER_HAS_DUMB_DESTROY */
 
 #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS)
     nv_drm_driver.gem_vm_ops       = &nv_drm_gem_vma_ops;
Index: b/NVIDIA-Linux-x86_64-390.157/kernel/conftest.sh
===================================================================
--- a/NVIDIA-Linux-x86_64-390.157/kernel/conftest.sh
+++ b/NVIDIA-Linux-x86_64-390.157/kernel/conftest.sh
@@ -4646,6 +4646,30 @@ compile_test() {
 
             compile_check_conftest "$CODE" "NV_ACPI_VIDEO_BACKLIGHT_USE_NATIVE" "" "functions"
         ;;
+
+        drm_driver_has_dumb_destroy)
+            #
+            # Determine if the 'drm_driver' structure has a 'dumb_destroy'
+            # function pointer.
+            #
+            # Removed by commit 96a7b60f6ddb2 ("drm: remove dumb_destroy
+            # callback") in v6.3 linux-next (2023-02-10).
+            #
+            CODE="
+            #if defined(NV_DRM_DRMP_H_PRESENT)
+            #include <drm/drmP.h>
+            #endif
+
+            #if defined(NV_DRM_DRM_DRV_H_PRESENT)
+            #include <drm/drm_drv.h>
+            #endif
+
+            int conftest_drm_driver_has_dumb_destroy(void) {
+                return offsetof(struct drm_driver, dumb_destroy);
+            }"
+
+            compile_check_conftest "$CODE" "NV_DRM_DRIVER_HAS_DUMB_DESTROY" "" "types"
+        ;;
     esac
 }
 
openSUSE Build Service is sponsored by