forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/gpu/drm/drm_context.c
....@@ -28,7 +28,13 @@
2828 * OTHER DEALINGS IN THE SOFTWARE.
2929 */
3030
31
-#include <drm/drmP.h>
31
+#include <linux/slab.h>
32
+#include <linux/uaccess.h>
33
+
34
+#include <drm/drm_drv.h>
35
+#include <drm/drm_file.h>
36
+#include <drm/drm_print.h>
37
+
3238 #include "drm_legacy.h"
3339
3440 struct drm_ctx_list {
....@@ -41,7 +47,7 @@
4147 /** \name Context bitmap support */
4248 /*@{*/
4349
44
-/**
50
+/*
4551 * Free a handle from the context bitmap.
4652 *
4753 * \param dev DRM device.
....@@ -62,7 +68,7 @@
6268 mutex_unlock(&dev->struct_mutex);
6369 }
6470
65
-/**
71
+/*
6672 * Context bitmap allocation.
6773 *
6874 * \param dev DRM device.
....@@ -82,7 +88,7 @@
8288 return ret;
8389 }
8490
85
-/**
91
+/*
8692 * Context bitmap initialization.
8793 *
8894 * \param dev DRM device.
....@@ -98,7 +104,7 @@
98104 idr_init(&dev->ctx_idr);
99105 }
100106
101
-/**
107
+/*
102108 * Context bitmap cleanup.
103109 *
104110 * \param dev DRM device.
....@@ -157,7 +163,7 @@
157163 /** \name Per Context SAREA Support */
158164 /*@{*/
159165
160
-/**
166
+/*
161167 * Get per-context SAREA.
162168 *
163169 * \param inode device inode.
....@@ -178,7 +184,7 @@
178184
179185 if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
180186 !drm_core_check_feature(dev, DRIVER_LEGACY))
181
- return -EINVAL;
187
+ return -EOPNOTSUPP;
182188
183189 mutex_lock(&dev->struct_mutex);
184190
....@@ -205,7 +211,7 @@
205211 return 0;
206212 }
207213
208
-/**
214
+/*
209215 * Set per-context SAREA.
210216 *
211217 * \param inode device inode.
....@@ -226,7 +232,7 @@
226232
227233 if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
228234 !drm_core_check_feature(dev, DRIVER_LEGACY))
229
- return -EINVAL;
235
+ return -EOPNOTSUPP;
230236
231237 mutex_lock(&dev->struct_mutex);
232238 list_for_each_entry(r_list, &dev->maplist, head) {
....@@ -257,7 +263,7 @@
257263 /** \name The actual DRM context handling routines */
258264 /*@{*/
259265
260
-/**
266
+/*
261267 * Switch context.
262268 *
263269 * \param dev DRM device.
....@@ -284,7 +290,7 @@
284290 return 0;
285291 }
286292
287
-/**
293
+/*
288294 * Complete context switch.
289295 *
290296 * \param dev DRM device.
....@@ -312,7 +318,7 @@
312318 return 0;
313319 }
314320
315
-/**
321
+/*
316322 * Reserve contexts.
317323 *
318324 * \param inode device inode.
....@@ -330,7 +336,7 @@
330336
331337 if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
332338 !drm_core_check_feature(dev, DRIVER_LEGACY))
333
- return -EINVAL;
339
+ return -EOPNOTSUPP;
334340
335341 if (res->count >= DRM_RESERVED_CONTEXTS) {
336342 memset(&ctx, 0, sizeof(ctx));
....@@ -345,7 +351,7 @@
345351 return 0;
346352 }
347353
348
-/**
354
+/*
349355 * Add context.
350356 *
351357 * \param inode device inode.
....@@ -365,7 +371,7 @@
365371
366372 if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
367373 !drm_core_check_feature(dev, DRIVER_LEGACY))
368
- return -EINVAL;
374
+ return -EOPNOTSUPP;
369375
370376 tmp_handle = drm_legacy_ctxbitmap_next(dev);
371377 if (tmp_handle == DRM_KERNEL_CONTEXT) {
....@@ -398,7 +404,7 @@
398404 return 0;
399405 }
400406
401
-/**
407
+/*
402408 * Get context.
403409 *
404410 * \param inode device inode.
....@@ -414,7 +420,7 @@
414420
415421 if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
416422 !drm_core_check_feature(dev, DRIVER_LEGACY))
417
- return -EINVAL;
423
+ return -EOPNOTSUPP;
418424
419425 /* This is 0, because we don't handle any context flags */
420426 ctx->flags = 0;
....@@ -422,7 +428,7 @@
422428 return 0;
423429 }
424430
425
-/**
431
+/*
426432 * Switch context.
427433 *
428434 * \param inode device inode.
....@@ -440,13 +446,13 @@
440446
441447 if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
442448 !drm_core_check_feature(dev, DRIVER_LEGACY))
443
- return -EINVAL;
449
+ return -EOPNOTSUPP;
444450
445451 DRM_DEBUG("%d\n", ctx->handle);
446452 return drm_context_switch(dev, dev->last_context, ctx->handle);
447453 }
448454
449
-/**
455
+/*
450456 * New context.
451457 *
452458 * \param inode device inode.
....@@ -464,7 +470,7 @@
464470
465471 if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
466472 !drm_core_check_feature(dev, DRIVER_LEGACY))
467
- return -EINVAL;
473
+ return -EOPNOTSUPP;
468474
469475 DRM_DEBUG("%d\n", ctx->handle);
470476 drm_context_switch_complete(dev, file_priv, ctx->handle);
....@@ -472,7 +478,7 @@
472478 return 0;
473479 }
474480
475
-/**
481
+/*
476482 * Remove context.
477483 *
478484 * \param inode device inode.
....@@ -490,7 +496,7 @@
490496
491497 if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
492498 !drm_core_check_feature(dev, DRIVER_LEGACY))
493
- return -EINVAL;
499
+ return -EOPNOTSUPP;
494500
495501 DRM_DEBUG("%d\n", ctx->handle);
496502 if (ctx->handle != DRM_KERNEL_CONTEXT) {