forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-20 ea08eeccae9297f7aabd2ef7f0c2517ac4549acc
kernel/drivers/gpu/drm/nouveau/nouveau_drv.h
....@@ -1,4 +1,4 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
1
+/* SPDX-License-Identifier: MIT */
22 #ifndef __NOUVEAU_DRV_H__
33 #define __NOUVEAU_DRV_H__
44
....@@ -46,7 +46,10 @@
4646 #include <nvif/mmu.h>
4747 #include <nvif/vmm.h>
4848
49
-#include <drm/drmP.h>
49
+#include <drm/drm_connector.h>
50
+#include <drm/drm_device.h>
51
+#include <drm/drm_drv.h>
52
+#include <drm/drm_file.h>
5053
5154 #include <drm/ttm/ttm_bo_api.h>
5255 #include <drm/ttm/ttm_bo_driver.h>
....@@ -55,12 +58,12 @@
5558 #include <drm/ttm/ttm_module.h>
5659 #include <drm/ttm/ttm_page_alloc.h>
5760
61
+#include <drm/drm_audio_component.h>
62
+
5863 #include "uapi/drm/nouveau_drm.h"
5964
6065 struct nouveau_channel;
6166 struct platform_device;
62
-
63
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
6467
6568 #include "nouveau_fence.h"
6669 #include "nouveau_bios.h"
....@@ -96,6 +99,7 @@
9699 struct nvif_device device;
97100 struct nvif_mmu mmu;
98101 struct nouveau_vmm vmm;
102
+ struct nouveau_vmm svm;
99103 const struct nvif_mclass *mem;
100104
101105 struct list_head head;
....@@ -128,14 +132,22 @@
128132 }
129133
130134 #include <nvif/object.h>
131
-#include <nvif/device.h>
135
+#include <nvif/parent.h>
132136
133137 struct nouveau_drm {
138
+ struct nvif_parent parent;
134139 struct nouveau_cli master;
135140 struct nouveau_cli client;
136141 struct drm_device *dev;
137142
138143 struct list_head clients;
144
+
145
+ /**
146
+ * @clients_lock: Protects access to the @clients list of &struct nouveau_cli.
147
+ */
148
+ struct mutex clients_lock;
149
+
150
+ u8 old_pm_cap;
139151
140152 struct {
141153 struct agp_bridge_data *bridge;
....@@ -146,19 +158,19 @@
146158
147159 /* TTM interface support */
148160 struct {
149
- struct drm_global_reference mem_global_ref;
150
- struct ttm_bo_global_ref bo_global_ref;
151161 struct ttm_bo_device bdev;
152162 atomic_t validate_sequence;
153163 int (*move)(struct nouveau_channel *,
154164 struct ttm_buffer_object *,
155
- struct ttm_mem_reg *, struct ttm_mem_reg *);
165
+ struct ttm_resource *, struct ttm_resource *);
156166 struct nouveau_channel *chan;
157167 struct nvif_object copy;
158168 int mtrr;
159169 int type_vram;
160170 int type_host[2];
161171 int type_ncoh[2];
172
+ struct mutex io_reserve_mutex;
173
+ struct list_head io_reserve_lru;
162174 } ttm;
163175
164176 /* GEM interface support */
....@@ -181,9 +193,7 @@
181193 struct nouveau_channel *channel;
182194 struct nvkm_gpuobj *notify;
183195 struct nouveau_fbdev *fbcon;
184
- struct nvif_object nvsw;
185196 struct nvif_object ntfy;
186
- struct nvif_notify flip;
187197
188198 /* nv10-nv40 tiling regions */
189199 struct {
....@@ -194,9 +204,9 @@
194204 /* modesetting */
195205 struct nvbios vbios;
196206 struct nouveau_display *display;
197
- struct backlight_device *backlight;
198
- struct list_head bl_connectors;
199207 struct work_struct hpd_work;
208
+ struct mutex hpd_lock;
209
+ u32 hpd_pending;
200210 struct work_struct fbcon_work;
201211 int fbcon_new_state;
202212 #ifdef CONFIG_ACPI
....@@ -210,10 +220,16 @@
210220 /* led management */
211221 struct nouveau_led *led;
212222
213
- /* display power reference */
214
- bool have_disp_power_ref;
215
-
216223 struct dev_pm_domain vga_pm_domain;
224
+
225
+ struct nouveau_svm *svm;
226
+
227
+ struct nouveau_dmem *dmem;
228
+
229
+ struct {
230
+ struct drm_audio_component *component;
231
+ bool component_registered;
232
+ } audio;
217233 };
218234
219235 static inline struct nouveau_drm *
....@@ -244,19 +260,27 @@
244260 struct nouveau_cli *_cli = (c); \
245261 dev_##l(_cli->drm->dev->dev, "%s: "f, _cli->name, ##a); \
246262 } while(0)
263
+
247264 #define NV_FATAL(drm,f,a...) NV_PRINTK(crit, &(drm)->client, f, ##a)
248265 #define NV_ERROR(drm,f,a...) NV_PRINTK(err, &(drm)->client, f, ##a)
249266 #define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a)
250267 #define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a)
268
+
251269 #define NV_DEBUG(drm,f,a...) do { \
252
- if (unlikely(drm_debug & DRM_UT_DRIVER)) \
270
+ if (drm_debug_enabled(DRM_UT_DRIVER)) \
253271 NV_PRINTK(info, &(drm)->client, f, ##a); \
254272 } while(0)
255273 #define NV_ATOMIC(drm,f,a...) do { \
256
- if (unlikely(drm_debug & DRM_UT_ATOMIC)) \
274
+ if (drm_debug_enabled(DRM_UT_ATOMIC)) \
257275 NV_PRINTK(info, &(drm)->client, f, ##a); \
258276 } while(0)
259277
278
+#define NV_PRINTK_ONCE(l,c,f,a...) NV_PRINTK(l##_once,c,f, ##a)
279
+
280
+#define NV_ERROR_ONCE(drm,f,a...) NV_PRINTK_ONCE(err, &(drm)->client, f, ##a)
281
+#define NV_WARN_ONCE(drm,f,a...) NV_PRINTK_ONCE(warn, &(drm)->client, f, ##a)
282
+#define NV_INFO_ONCE(drm,f,a...) NV_PRINTK_ONCE(info, &(drm)->client, f, ##a)
283
+
260284 extern int nouveau_modeset;
261285
262286 #endif