42
42
43
43
#include <drm/drmP.h>
44
44
45
+ /******************************************************************/
46
+ /** \name Context bitmap support */
47
+ /*@{*/
48
+
45
49
/**
46
50
* Free a handle from the context bitmap.
47
51
*
52
56
* in drm_device::ctx_idr, while holding the drm_device::struct_mutex
53
57
* lock.
54
58
*/
55
- static void drm_ctxbitmap_free (struct drm_device * dev , int ctx_handle )
59
+ void drm_ctxbitmap_free (struct drm_device * dev , int ctx_handle )
56
60
{
57
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
58
- return ;
59
-
60
61
mutex_lock (& dev -> struct_mutex );
61
62
idr_remove (& dev -> ctx_idr , ctx_handle );
62
63
mutex_unlock (& dev -> struct_mutex );
63
64
}
64
65
65
- /******************************************************************/
66
- /** \name Context bitmap support */
67
- /*@{*/
68
-
69
- void drm_legacy_ctxbitmap_release (struct drm_device * dev ,
70
- struct drm_file * file_priv )
71
- {
72
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
73
- return ;
74
-
75
- mutex_lock (& dev -> ctxlist_mutex );
76
- if (!list_empty (& dev -> ctxlist )) {
77
- struct drm_ctx_list * pos , * n ;
78
-
79
- list_for_each_entry_safe (pos , n , & dev -> ctxlist , head ) {
80
- if (pos -> tag == file_priv &&
81
- pos -> handle != DRM_KERNEL_CONTEXT ) {
82
- if (dev -> driver -> context_dtor )
83
- dev -> driver -> context_dtor (dev ,
84
- pos -> handle );
85
-
86
- drm_ctxbitmap_free (dev , pos -> handle );
87
-
88
- list_del (& pos -> head );
89
- kfree (pos );
90
- -- dev -> ctx_count ;
91
- }
92
- }
93
- }
94
- mutex_unlock (& dev -> ctxlist_mutex );
95
- }
96
-
97
66
/**
98
67
* Context bitmap allocation.
99
68
*
@@ -121,12 +90,10 @@ static int drm_ctxbitmap_next(struct drm_device * dev)
121
90
*
122
91
* Initialise the drm_device::ctx_idr
123
92
*/
124
- void drm_legacy_ctxbitmap_init (struct drm_device * dev )
93
+ int drm_ctxbitmap_init (struct drm_device * dev )
125
94
{
126
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
127
- return ;
128
-
129
95
idr_init (& dev -> ctx_idr );
96
+ return 0 ;
130
97
}
131
98
132
99
/**
@@ -137,7 +104,7 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev)
137
104
* Free all idr members using drm_ctx_sarea_free helper function
138
105
* while holding the drm_device::struct_mutex lock.
139
106
*/
140
- void drm_legacy_ctxbitmap_cleanup (struct drm_device * dev )
107
+ void drm_ctxbitmap_cleanup (struct drm_device * dev )
141
108
{
142
109
mutex_lock (& dev -> struct_mutex );
143
110
idr_destroy (& dev -> ctx_idr );
@@ -169,9 +136,6 @@ int drm_getsareactx(struct drm_device *dev, void *data,
169
136
struct drm_local_map * map ;
170
137
struct drm_map_list * _entry ;
171
138
172
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
173
- return - EINVAL ;
174
-
175
139
mutex_lock (& dev -> struct_mutex );
176
140
177
141
map = idr_find (& dev -> ctx_idr , request -> ctx_id );
@@ -216,9 +180,6 @@ int drm_setsareactx(struct drm_device *dev, void *data,
216
180
struct drm_local_map * map = NULL ;
217
181
struct drm_map_list * r_list = NULL ;
218
182
219
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
220
- return - EINVAL ;
221
-
222
183
mutex_lock (& dev -> struct_mutex );
223
184
list_for_each_entry (r_list , & dev -> maplist , head ) {
224
185
if (r_list -> map
@@ -319,9 +280,6 @@ int drm_resctx(struct drm_device *dev, void *data,
319
280
struct drm_ctx ctx ;
320
281
int i ;
321
282
322
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
323
- return - EINVAL ;
324
-
325
283
if (res -> count >= DRM_RESERVED_CONTEXTS ) {
326
284
memset (& ctx , 0 , sizeof (ctx ));
327
285
for (i = 0 ; i < DRM_RESERVED_CONTEXTS ; i ++ ) {
@@ -352,9 +310,6 @@ int drm_addctx(struct drm_device *dev, void *data,
352
310
struct drm_ctx_list * ctx_entry ;
353
311
struct drm_ctx * ctx = data ;
354
312
355
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
356
- return - EINVAL ;
357
-
358
313
ctx -> handle = drm_ctxbitmap_next (dev );
359
314
if (ctx -> handle == DRM_KERNEL_CONTEXT ) {
360
315
/* Skip kernel's context and get a new one. */
@@ -398,9 +353,6 @@ int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
398
353
{
399
354
struct drm_ctx * ctx = data ;
400
355
401
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
402
- return - EINVAL ;
403
-
404
356
/* This is 0, because we don't handle any context flags */
405
357
ctx -> flags = 0 ;
406
358
@@ -423,9 +375,6 @@ int drm_switchctx(struct drm_device *dev, void *data,
423
375
{
424
376
struct drm_ctx * ctx = data ;
425
377
426
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
427
- return - EINVAL ;
428
-
429
378
DRM_DEBUG ("%d\n" , ctx -> handle );
430
379
return drm_context_switch (dev , dev -> last_context , ctx -> handle );
431
380
}
@@ -446,9 +395,6 @@ int drm_newctx(struct drm_device *dev, void *data,
446
395
{
447
396
struct drm_ctx * ctx = data ;
448
397
449
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
450
- return - EINVAL ;
451
-
452
398
DRM_DEBUG ("%d\n" , ctx -> handle );
453
399
drm_context_switch_complete (dev , file_priv , ctx -> handle );
454
400
@@ -471,9 +417,6 @@ int drm_rmctx(struct drm_device *dev, void *data,
471
417
{
472
418
struct drm_ctx * ctx = data ;
473
419
474
- if (drm_core_check_feature (dev , DRIVER_MODESET ))
475
- return - EINVAL ;
476
-
477
420
DRM_DEBUG ("%d\n" , ctx -> handle );
478
421
if (ctx -> handle != DRM_KERNEL_CONTEXT ) {
479
422
if (dev -> driver -> context_dtor )
0 commit comments