forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-09 244b2c5ca8b14627e4a17755e5922221e121c771
kernel/drivers/gpu/drm/drm_legacy.h
....@@ -29,11 +29,15 @@
2929 * drivers use them, and removing them are API breaks.
3030 */
3131 #include <linux/list.h>
32
+
33
+#include <drm/drm.h>
34
+#include <drm/drm_device.h>
3235 #include <drm/drm_legacy.h>
3336
3437 struct agp_memory;
3538 struct drm_device;
3639 struct drm_file;
40
+struct drm_buf_desc;
3741
3842 /*
3943 * Generic DRM Contexts
....@@ -42,11 +46,19 @@
4246 #define DRM_KERNEL_CONTEXT 0
4347 #define DRM_RESERVED_CONTEXTS 1
4448
49
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
4550 void drm_legacy_ctxbitmap_init(struct drm_device *dev);
4651 void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev);
47
-void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
4852 void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);
53
+#else
54
+static inline void drm_legacy_ctxbitmap_init(struct drm_device *dev) {}
55
+static inline void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev) {}
56
+static inline void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file) {}
57
+#endif
4958
59
+void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
60
+
61
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
5062 int drm_legacy_resctx(struct drm_device *d, void *v, struct drm_file *f);
5163 int drm_legacy_addctx(struct drm_device *d, void *v, struct drm_file *f);
5264 int drm_legacy_getctx(struct drm_device *d, void *v, struct drm_file *f);
....@@ -56,6 +68,7 @@
5668
5769 int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f);
5870 int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
71
+#endif
5972
6073 /*
6174 * Generic Buffer Management
....@@ -63,16 +76,39 @@
6376
6477 #define DRM_MAP_HASH_OFFSET 0x10000000
6578
79
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
80
+static inline int drm_legacy_create_map_hash(struct drm_device *dev)
81
+{
82
+ return drm_ht_create(&dev->map_hash, 12);
83
+}
84
+
85
+static inline void drm_legacy_remove_map_hash(struct drm_device *dev)
86
+{
87
+ drm_ht_remove(&dev->map_hash);
88
+}
89
+#else
90
+static inline int drm_legacy_create_map_hash(struct drm_device *dev)
91
+{
92
+ return 0;
93
+}
94
+
95
+static inline void drm_legacy_remove_map_hash(struct drm_device *dev) {}
96
+#endif
97
+
98
+
99
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
66100 int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
67101 struct drm_file *file_priv);
68102 int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
69103 int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
104
+
70105 int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f);
71106 int drm_legacy_infobufs(struct drm_device *d, void *v, struct drm_file *f);
72107 int drm_legacy_markbufs(struct drm_device *d, void *v, struct drm_file *f);
73108 int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f);
74109 int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f);
75110 int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f);
111
+#endif
76112
77113 int __drm_legacy_infobufs(struct drm_device *, void *, int *,
78114 int (*)(void *, int, struct drm_buf_entry *));
....@@ -81,7 +117,17 @@
81117 int (*)(void *, int, unsigned long, struct drm_buf *),
82118 struct drm_file *);
83119
84
-#ifdef CONFIG_DRM_VM
120
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
121
+void drm_legacy_master_rmmaps(struct drm_device *dev,
122
+ struct drm_master *master);
123
+void drm_legacy_rmmaps(struct drm_device *dev);
124
+#else
125
+static inline void drm_legacy_master_rmmaps(struct drm_device *dev,
126
+ struct drm_master *master) {}
127
+static inline void drm_legacy_rmmaps(struct drm_device *dev) {}
128
+#endif
129
+
130
+#if IS_ENABLED(CONFIG_DRM_VM) && IS_ENABLED(CONFIG_DRM_LEGACY)
85131 void drm_legacy_vma_flush(struct drm_device *d);
86132 #else
87133 static inline void drm_legacy_vma_flush(struct drm_device *d)
....@@ -103,23 +149,66 @@
103149 };
104150
105151 /* drm_lock.c */
152
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
106153 int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f);
107154 int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f);
108155 void drm_legacy_lock_release(struct drm_device *dev, struct file *filp);
156
+#else
157
+static inline void drm_legacy_lock_release(struct drm_device *dev, struct file *filp) {}
158
+#endif
109159
110160 /* DMA support */
161
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
111162 int drm_legacy_dma_setup(struct drm_device *dev);
112163 void drm_legacy_dma_takedown(struct drm_device *dev);
164
+#else
165
+static inline int drm_legacy_dma_setup(struct drm_device *dev)
166
+{
167
+ return 0;
168
+}
169
+#endif
170
+
113171 void drm_legacy_free_buffer(struct drm_device *dev,
114172 struct drm_buf * buf);
173
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
115174 void drm_legacy_reclaim_buffers(struct drm_device *dev,
116175 struct drm_file *filp);
176
+#else
177
+static inline void drm_legacy_reclaim_buffers(struct drm_device *dev,
178
+ struct drm_file *filp) {}
179
+#endif
117180
118181 /* Scatter Gather Support */
182
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
119183 void drm_legacy_sg_cleanup(struct drm_device *dev);
120184 int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
121185 struct drm_file *file_priv);
122186 int drm_legacy_sg_free(struct drm_device *dev, void *data,
123187 struct drm_file *file_priv);
188
+#endif
189
+
190
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
191
+void drm_legacy_init_members(struct drm_device *dev);
192
+void drm_legacy_destroy_members(struct drm_device *dev);
193
+void drm_legacy_dev_reinit(struct drm_device *dev);
194
+int drm_legacy_setup(struct drm_device * dev);
195
+#else
196
+static inline void drm_legacy_init_members(struct drm_device *dev) {}
197
+static inline void drm_legacy_destroy_members(struct drm_device *dev) {}
198
+static inline void drm_legacy_dev_reinit(struct drm_device *dev) {}
199
+static inline int drm_legacy_setup(struct drm_device * dev) { return 0; }
200
+#endif
201
+
202
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
203
+void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master);
204
+#else
205
+static inline void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master) {}
206
+#endif
207
+
208
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
209
+void drm_master_legacy_init(struct drm_master *master);
210
+#else
211
+static inline void drm_master_legacy_init(struct drm_master *master) {}
212
+#endif
124213
125214 #endif /* __DRM_LEGACY_H__ */