summaryrefslogtreecommitdiff
path: root/system/nvidia-legacy390-kernel/kernel-5.13.patch
blob: 36c0c6874c304ef4b84f663ee674ae3fdca4f3ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index 4b6a9ed..25a8afa 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -4408,6 +4408,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/kernel/nvidia-drm/nvidia-drm-crtc.c b/kernel/nvidia-drm/nvidia-drm-crtc.c
index 8abd1f3..d5e5cfd 100644
--- a/kernel/nvidia-drm/nvidia-drm-crtc.c
+++ b/kernel/nvidia-drm/nvidia-drm-crtc.c
@@ -131,13 +131,21 @@ plane_req_config_update(struct drm_plane_state *plane_state,
 }
 
 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;
     NvKmsKapiPlaneType 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;
     }
@@ -166,12 +174,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/kernel/nvidia-drm/nvidia-drm.Kbuild b/kernel/nvidia-drm/nvidia-drm.Kbuild
index 885ab49..2cb0f9f 100644
--- a/kernel/nvidia-drm/nvidia-drm.Kbuild
+++ b/kernel/nvidia-drm/nvidia-drm.Kbuild
@@ -100,4 +100,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