HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/src/nvidia-srv-580.173.02/patches/buildfix_kernel_5.13.patch
From ec3c174d8a7967a2a41eccf272f604a65a80a7ae Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.milone@canonical.com>
Date: Wed, 26 May 2021 14:50:38 +0200
Subject: [PATCH 1/1] Add support for Linux 5.13

---
 conftest.sh                  | 32 ++++++++++++++++++++++++++++++++
 nvidia-drm/nvidia-drm-crtc.c | 16 ++++++++++++++++
 nvidia-drm/nvidia-drm.Kbuild |  1 +
 3 files changed, 49 insertions(+)

diff --git a/conftest.sh b/conftest.sh
index 9f954c2..3ce633c 100755
--- a/conftest.sh
+++ b/conftest.sh
@@ -4382,6 +4382,38 @@ compile_test() {
             fi
         ;;
 
+        drm_plane_atomic_update_has_atomic_state_arg)
+            #
+            # Determine if drm_plane_helper_funcs::atomic_update takes 'state'
+            # argument of 'struct drm_atomic_state' type.
+            #
+            # The commit 977697e20b3d ("drm/atomic: Pass the full state to
+            # planes atomic disable and update") passed the full atomic state to
+            # drm_crtc_helper_funcs::atomic_update() and atomic_disable().
+            #
+            echo "$CONFTEST_PREAMBLE
+            #include <drm/drm_modeset_helper_vtables.h>
+            #include <drm/drm_crtc_helper.h>
+            #include <drm/drm_plane_helper.h>
+            #include <drm/drm_atomic.h>
+            #include <drm/drm_atomic_helper.h>
+            void conftest_drm_plane_helper_atomic_update_has_atomic_state_arg(
+                    struct drm_plane *plane, struct drm_atomic_state *state) {
+                const struct drm_plane_helper_funcs *funcs = plane->helper_private;
+                funcs->atomic_update(plane, state);
+            }" > conftest$$.c
+
+            $CC $CFLAGS -Werror=incompatible-pointer-types -c conftest$$.c > /dev/null 2>&1
+            rm -f conftest$$.c
+
+            if [ -f conftest$$.o ]; then
+                rm -f conftest$$.o
+                echo "#define NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG" | append_conftest "types"
+            else
+                echo "#undef NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG" | append_conftest "types"
+            fi
+        ;;
+
         drm_gem_object_vmap_has_map_arg)
             #
             # Determine if drm_gem_object_funcs::vmap takes 'map'
diff --git a/nvidia-drm/nvidia-drm-crtc.c b/nvidia-drm/nvidia-drm-crtc.c
index 3d3d94a..68bab51 100644
--- a/nvidia-drm/nvidia-drm-crtc.c
+++ b/nvidia-drm/nvidia-drm-crtc.c
@@ -227,13 +227,21 @@ static bool __is_async_flip_requested(const struct drm_plane *plane,
 }
 
 static int nv_drm_plane_atomic_check(struct drm_plane *plane,
+#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG)
+                                     struct drm_atomic_state *state)
+#else
                                      struct drm_plane_state *plane_state)
+#endif
 {
     int i;
     struct drm_crtc *crtc;
     struct drm_crtc_state *crtc_state;
     NvKmsKapiLayerType type;
 
+#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG)
+    struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state,
+                                                                         plane);
+#endif
     if (NV_DRM_WARN(!drm_plane_type_to_nvkms_plane_type(plane->type, &type))) {
         goto done;
     }
@@ -276,12 +284,20 @@ done:
 }
 
 static void nv_drm_plane_atomic_update(struct drm_plane *plane,
+#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG)
+                                       struct drm_atomic_state *old_state)
+#else
                                        struct drm_plane_state *old_state)
+#endif
 {
 }
 
 static void nv_drm_plane_atomic_disable(struct drm_plane *plane,
+#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG)
+                                        struct drm_atomic_state *old_state)
+#else
                                         struct drm_plane_state *old_state)
+#endif
 {
 }
 
diff --git a/nvidia-drm/nvidia-drm.Kbuild b/nvidia-drm/nvidia-drm.Kbuild
index 31ca09d..70711f8 100644
--- a/nvidia-drm/nvidia-drm.Kbuild
+++ b/nvidia-drm/nvidia-drm.Kbuild
@@ -108,4 +108,5 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_free_object
 NV_CONFTEST_TYPE_COMPILE_TESTS += drm_prime_pages_to_sg_has_drm_device_arg
 NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_prime_callbacks
 NV_CONFTEST_TYPE_COMPILE_TESTS += drm_crtc_atomic_check_has_atomic_state_arg
+NV_CONFTEST_TYPE_COMPILE_TESTS += drm_plane_atomic_update_has_atomic_state_arg
 NV_CONFTEST_TYPE_COMPILE_TESTS += drm_gem_object_vmap_has_map_arg
-- 
2.30.2