-
Notifications
You must be signed in to change notification settings - Fork 1
/
nvidia-390xx-kmod-0024-kernel-6.2-adaptation.patch
173 lines (149 loc) · 6.26 KB
/
nvidia-390xx-kmod-0024-kernel-6.2-adaptation.patch
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
From bf78b6170c83d556d318efa7197398c2442d776b Mon Sep 17 00:00:00 2001
From: NVieville <[email protected]>
Date: Wed, 12 Apr 2023 12:14:39 +0200
Subject: [PATCH] Fix build for kernel 6.2.x
Signed-off-by: NVieville <[email protected]>
---
kernel/nvidia-drm/nvidia-drm-connector.c | 21 +++++++++++++++++++++
kernel/nvidia-drm/nvidia-drm-drv.c | 4 ++++
kernel/nvidia-drm/nvidia-drm-fb.c | 1 +
kernel/nvidia/nv-acpi.c | 19 +++++++++++++++++++
4 files changed, 45 insertions(+)
diff --git a/kernel/nvidia-drm/nvidia-drm-connector.c b/kernel/nvidia-drm/nvidia-drm-connector.c
index 54167a7..9585840 100644
--- a/kernel/nvidia-drm/nvidia-drm-connector.c
+++ b/kernel/nvidia-drm/nvidia-drm-connector.c
@@ -20,6 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <linux/version.h>
+#include <drm/drm_edid.h>
#include "nvidia-drm-conftest.h" /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
@@ -98,6 +100,7 @@ __nv_drm_detect_encoder(struct NvKmsKapiDynamicDisplayParams *pDetectParams,
break;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
if (connector->override_edid) {
const struct drm_property_blob *edid = connector->edid_blob_ptr;
@@ -110,6 +113,24 @@ __nv_drm_detect_encoder(struct NvKmsKapiDynamicDisplayParams *pDetectParams,
sizeof(pDetectParams->edid.buffer));
}
}
+#else
+ // Rel. commit "drm/edid: detach debugfs EDID override from EDID property update" (Jani Nikula, 24 Oct 2022)
+ // NOTE: HUGE HACK!
+ mutex_lock(&connector->edid_override_mutex);
+ if (connector->edid_override) {
+ const struct edid *edid = drm_edid_raw(connector->edid_override);
+ size_t edid_length = EDID_LENGTH * (edid->extensions + 1);
+ if (edid_length <= sizeof(pDetectParams->edid.buffer)) {
+ memcpy(pDetectParams->edid.buffer, edid, edid_length);
+ pDetectParams->edid.bufferSize = edid_length;
+ pDetectParams->overrideEdid = NV_TRUE;
+ } else {
+ WARN_ON(edid_length >
+ sizeof(pDetectParams->edid.buffer));
+ }
+ }
+ mutex_unlock(&connector->edid_override_mutex);
+#endif
if (!nvKms->getDynamicDisplayInfo(nv_dev->pDevice, pDetectParams)) {
NV_DRM_DEV_LOG_ERR(
diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
index 1289cb3..ca03978 100644
--- a/kernel/nvidia-drm/nvidia-drm-drv.c
+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -20,6 +20,7 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <linux/version.h>
#include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
#include "nvidia-drm-priv.h"
@@ -239,9 +240,12 @@ nv_drm_init_mode_config(struct nv_drm_device *nv_dev,
dev->mode_config.preferred_depth = 24;
dev->mode_config.prefer_shadow = 1;
+// Rel. commit "drm: Remove drm_mode_config::fb_base" (Zack Rusin, 18 Oct 2022)
+#if defined(CONFIG_FB) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
/* Currently unused. Update when needed. */
dev->mode_config.fb_base = 0;
+#endif
dev->mode_config.async_page_flip = false;
diff --git a/kernel/nvidia-drm/nvidia-drm-fb.c b/kernel/nvidia-drm/nvidia-drm-fb.c
index 725164a..e0b94f2 100644
--- a/kernel/nvidia-drm/nvidia-drm-fb.c
+++ b/kernel/nvidia-drm/nvidia-drm-fb.c
@@ -31,6 +31,7 @@
#include "nvidia-drm-gem.h"
#include <drm/drm_crtc_helper.h>
+#include <drm/drm_modeset_helper.h>
static void nv_drm_framebuffer_destroy(struct drm_framebuffer *fb)
{
diff --git a/kernel/nvidia/nv-acpi.c b/kernel/nvidia/nv-acpi.c
index b37c9f3..06056a4 100644
--- a/kernel/nvidia/nv-acpi.c
+++ b/kernel/nvidia/nv-acpi.c
@@ -8,6 +8,7 @@
* _NVRM_COPYRIGHT_END_
*/
+#include <linux/version.h>
#define __NO_VERSION__
#include "nv-misc.h"
@@ -23,11 +24,16 @@ static NV_STATUS nv_acpi_extract_object (const union acpi_object *, void *, N
static int nv_acpi_add (struct acpi_device *);
+// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0))
+static void nv_acpi_remove_one_arg_void(struct acpi_device *device);
+#else
#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
static int nv_acpi_remove_two_args(struct acpi_device *device, int type);
#else
static int nv_acpi_remove_one_arg(struct acpi_device *device);
#endif
+#endif
static void nv_acpi_event (acpi_handle, u32, void *);
static acpi_status nv_acpi_find_methods (acpi_handle, u32, void *, void **);
@@ -73,11 +79,16 @@ static const struct acpi_driver nv_acpi_driver_template = {
#endif
.ops = {
.add = nv_acpi_add,
+// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0))
+ .remove = nv_acpi_remove_one_arg_void,
+#else
#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
.remove = nv_acpi_remove_two_args,
#else
.remove = nv_acpi_remove_one_arg,
#endif
+#endif
#if defined(NV_ACPI_DEVICE_OPS_HAS_MATCH)
.match = nv_acpi_match,
#endif
@@ -331,11 +342,16 @@ static int nv_acpi_add(struct acpi_device *device)
return 0;
}
+// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0))
+static void nv_acpi_remove_one_arg_void(struct acpi_device *device)
+#else
#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
static int nv_acpi_remove_two_args(struct acpi_device *device, int type)
#else
static int nv_acpi_remove_one_arg(struct acpi_device *device)
#endif
+#endif
{
/*
* This function will cause RM to relinquish control of the VGA ACPI device.
@@ -385,7 +401,10 @@ static int nv_acpi_remove_one_arg(struct acpi_device *device)
device->driver_data = NULL;
}
+// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
return status;
+#endif
}
static void nv_acpi_event(acpi_handle handle, u32 event_type, void *data)
--
2.40.1