aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-07-24 06:10:04 -0400
committerDavid Herrmann <dh.herrmann@gmail.com>2014-08-05 13:38:12 -0400
commite7b96070dd9e51a8b16340411a8643d8c7d5a001 (patch)
tree7e6eeda12ad5874ee088867fee61b49c1b25569a
parente17280758cc0b4f3d7065554006adcb87448f6c0 (diff)
drm: mark drm_context support as legacy
This renames all drm-context helpers to drm_legacy_*() and moves the internal definitions into the new drm_legacy.h header. This header is local to DRM-core and drivers shouldn't access it. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--drivers/gpu/drm/drm_context.c76
-rw-r--r--drivers/gpu/drm/drm_fops.c3
-rw-r--r--drivers/gpu/drm/drm_ioctl.c17
-rw-r--r--drivers/gpu/drm/drm_legacy.h51
-rw-r--r--drivers/gpu/drm/drm_lock.c1
-rw-r--r--drivers/gpu/drm/drm_stub.c7
-rw-r--r--include/drm/drmP.h35
7 files changed, 103 insertions, 87 deletions
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index c045505978f1..9b23525c0ed0 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -1,18 +1,13 @@
1/**
2 * \file drm_context.c
3 * IOCTLs for generic contexts
4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * \author Gareth Hughes <gareth@valinux.com>
7 */
8
9/* 1/*
10 * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com 2 * Legacy: Generic DRM Contexts
11 * 3 *
12 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. 4 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
13 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
14 * All Rights Reserved. 6 * All Rights Reserved.
15 * 7 *
8 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
9 * Author: Gareth Hughes <gareth@valinux.com>
10 *
16 * Permission is hereby granted, free of charge, to any person obtaining a 11 * Permission is hereby granted, free of charge, to any person obtaining a
17 * copy of this software and associated documentation files (the "Software"), 12 * copy of this software and associated documentation files (the "Software"),
18 * to deal in the Software without restriction, including without limitation 13 * to deal in the Software without restriction, including without limitation
@@ -33,14 +28,14 @@
33 * OTHER DEALINGS IN THE SOFTWARE. 28 * OTHER DEALINGS IN THE SOFTWARE.
34 */ 29 */
35 30
36/*
37 * ChangeLog:
38 * 2001-11-16 Torsten Duwe <duwe@caldera.de>
39 * added context constructor/destructor hooks,
40 * needed by SiS driver's memory management.
41 */
42
43#include <drm/drmP.h> 31#include <drm/drmP.h>
32#include "drm_legacy.h"
33
34struct drm_ctx_list {
35 struct list_head head;
36 drm_context_t handle;
37 struct drm_file *tag;
38};
44 39
45/******************************************************************/ 40/******************************************************************/
46/** \name Context bitmap support */ 41/** \name Context bitmap support */
@@ -56,7 +51,7 @@
56 * in drm_device::ctx_idr, while holding the drm_device::struct_mutex 51 * in drm_device::ctx_idr, while holding the drm_device::struct_mutex
57 * lock. 52 * lock.
58 */ 53 */
59void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle) 54void drm_legacy_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
60{ 55{
61 mutex_lock(&dev->struct_mutex); 56 mutex_lock(&dev->struct_mutex);
62 idr_remove(&dev->ctx_idr, ctx_handle); 57 idr_remove(&dev->ctx_idr, ctx_handle);
@@ -72,7 +67,7 @@ void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
72 * Allocate a new idr from drm_device::ctx_idr while holding the 67 * Allocate a new idr from drm_device::ctx_idr while holding the
73 * drm_device::struct_mutex lock. 68 * drm_device::struct_mutex lock.
74 */ 69 */
75static int drm_ctxbitmap_next(struct drm_device * dev) 70static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
76{ 71{
77 int ret; 72 int ret;
78 73
@@ -90,7 +85,7 @@ static int drm_ctxbitmap_next(struct drm_device * dev)
90 * 85 *
91 * Initialise the drm_device::ctx_idr 86 * Initialise the drm_device::ctx_idr
92 */ 87 */
93int drm_ctxbitmap_init(struct drm_device * dev) 88int drm_legacy_ctxbitmap_init(struct drm_device * dev)
94{ 89{
95 idr_init(&dev->ctx_idr); 90 idr_init(&dev->ctx_idr);
96 return 0; 91 return 0;
@@ -104,7 +99,7 @@ int drm_ctxbitmap_init(struct drm_device * dev)
104 * Free all idr members using drm_ctx_sarea_free helper function 99 * Free all idr members using drm_ctx_sarea_free helper function
105 * while holding the drm_device::struct_mutex lock. 100 * while holding the drm_device::struct_mutex lock.
106 */ 101 */
107void drm_ctxbitmap_cleanup(struct drm_device * dev) 102void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev)
108{ 103{
109 mutex_lock(&dev->struct_mutex); 104 mutex_lock(&dev->struct_mutex);
110 idr_destroy(&dev->ctx_idr); 105 idr_destroy(&dev->ctx_idr);
@@ -120,7 +115,7 @@ void drm_ctxbitmap_cleanup(struct drm_device * dev)
120 * @file. Note that after this call returns, new contexts might be added if 115 * @file. Note that after this call returns, new contexts might be added if
121 * the file is still alive. 116 * the file is still alive.
122 */ 117 */
123void drm_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file) 118void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file)
124{ 119{
125 struct drm_ctx_list *pos, *tmp; 120 struct drm_ctx_list *pos, *tmp;
126 121
@@ -132,7 +127,7 @@ void drm_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file)
132 if (dev->driver->context_dtor) 127 if (dev->driver->context_dtor)
133 dev->driver->context_dtor(dev, pos->handle); 128 dev->driver->context_dtor(dev, pos->handle);
134 129
135 drm_ctxbitmap_free(dev, pos->handle); 130 drm_legacy_ctxbitmap_free(dev, pos->handle);
136 list_del(&pos->head); 131 list_del(&pos->head);
137 kfree(pos); 132 kfree(pos);
138 } 133 }
@@ -159,8 +154,8 @@ void drm_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file)
159 * Gets the map from drm_device::ctx_idr with the handle specified and 154 * Gets the map from drm_device::ctx_idr with the handle specified and
160 * returns its handle. 155 * returns its handle.
161 */ 156 */
162int drm_getsareactx(struct drm_device *dev, void *data, 157int drm_legacy_getsareactx(struct drm_device *dev, void *data,
163 struct drm_file *file_priv) 158 struct drm_file *file_priv)
164{ 159{
165 struct drm_ctx_priv_map *request = data; 160 struct drm_ctx_priv_map *request = data;
166 struct drm_local_map *map; 161 struct drm_local_map *map;
@@ -203,8 +198,8 @@ int drm_getsareactx(struct drm_device *dev, void *data,
203 * Searches the mapping specified in \p arg and update the entry in 198 * Searches the mapping specified in \p arg and update the entry in
204 * drm_device::ctx_idr with it. 199 * drm_device::ctx_idr with it.
205 */ 200 */
206int drm_setsareactx(struct drm_device *dev, void *data, 201int drm_legacy_setsareactx(struct drm_device *dev, void *data,
207 struct drm_file *file_priv) 202 struct drm_file *file_priv)
208{ 203{
209 struct drm_ctx_priv_map *request = data; 204 struct drm_ctx_priv_map *request = data;
210 struct drm_local_map *map = NULL; 205 struct drm_local_map *map = NULL;
@@ -303,8 +298,8 @@ static int drm_context_switch_complete(struct drm_device *dev,
303 * \param arg user argument pointing to a drm_ctx_res structure. 298 * \param arg user argument pointing to a drm_ctx_res structure.
304 * \return zero on success or a negative number on failure. 299 * \return zero on success or a negative number on failure.
305 */ 300 */
306int drm_resctx(struct drm_device *dev, void *data, 301int drm_legacy_resctx(struct drm_device *dev, void *data,
307 struct drm_file *file_priv) 302 struct drm_file *file_priv)
308{ 303{
309 struct drm_ctx_res *res = data; 304 struct drm_ctx_res *res = data;
310 struct drm_ctx ctx; 305 struct drm_ctx ctx;
@@ -334,16 +329,16 @@ int drm_resctx(struct drm_device *dev, void *data,
334 * 329 *
335 * Get a new handle for the context and copy to userspace. 330 * Get a new handle for the context and copy to userspace.
336 */ 331 */
337int drm_addctx(struct drm_device *dev, void *data, 332int drm_legacy_addctx(struct drm_device *dev, void *data,
338 struct drm_file *file_priv) 333 struct drm_file *file_priv)
339{ 334{
340 struct drm_ctx_list *ctx_entry; 335 struct drm_ctx_list *ctx_entry;
341 struct drm_ctx *ctx = data; 336 struct drm_ctx *ctx = data;
342 337
343 ctx->handle = drm_ctxbitmap_next(dev); 338 ctx->handle = drm_legacy_ctxbitmap_next(dev);
344 if (ctx->handle == DRM_KERNEL_CONTEXT) { 339 if (ctx->handle == DRM_KERNEL_CONTEXT) {
345 /* Skip kernel's context and get a new one. */ 340 /* Skip kernel's context and get a new one. */
346 ctx->handle = drm_ctxbitmap_next(dev); 341 ctx->handle = drm_legacy_ctxbitmap_next(dev);
347 } 342 }
348 DRM_DEBUG("%d\n", ctx->handle); 343 DRM_DEBUG("%d\n", ctx->handle);
349 if (ctx->handle == -1) { 344 if (ctx->handle == -1) {
@@ -378,7 +373,8 @@ int drm_addctx(struct drm_device *dev, void *data,
378 * \param arg user argument pointing to a drm_ctx structure. 373 * \param arg user argument pointing to a drm_ctx structure.
379 * \return zero on success or a negative number on failure. 374 * \return zero on success or a negative number on failure.
380 */ 375 */
381int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv) 376int drm_legacy_getctx(struct drm_device *dev, void *data,
377 struct drm_file *file_priv)
382{ 378{
383 struct drm_ctx *ctx = data; 379 struct drm_ctx *ctx = data;
384 380
@@ -399,8 +395,8 @@ int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
399 * 395 *
400 * Calls context_switch(). 396 * Calls context_switch().
401 */ 397 */
402int drm_switchctx(struct drm_device *dev, void *data, 398int drm_legacy_switchctx(struct drm_device *dev, void *data,
403 struct drm_file *file_priv) 399 struct drm_file *file_priv)
404{ 400{
405 struct drm_ctx *ctx = data; 401 struct drm_ctx *ctx = data;
406 402
@@ -419,8 +415,8 @@ int drm_switchctx(struct drm_device *dev, void *data,
419 * 415 *
420 * Calls context_switch_complete(). 416 * Calls context_switch_complete().
421 */ 417 */
422int drm_newctx(struct drm_device *dev, void *data, 418int drm_legacy_newctx(struct drm_device *dev, void *data,
423 struct drm_file *file_priv) 419 struct drm_file *file_priv)
424{ 420{
425 struct drm_ctx *ctx = data; 421 struct drm_ctx *ctx = data;
426 422
@@ -441,8 +437,8 @@ int drm_newctx(struct drm_device *dev, void *data,
441 * 437 *
442 * If not the special kernel context, calls ctxbitmap_free() to free the specified context. 438 * If not the special kernel context, calls ctxbitmap_free() to free the specified context.
443 */ 439 */
444int drm_rmctx(struct drm_device *dev, void *data, 440int drm_legacy_rmctx(struct drm_device *dev, void *data,
445 struct drm_file *file_priv) 441 struct drm_file *file_priv)
446{ 442{
447 struct drm_ctx *ctx = data; 443 struct drm_ctx *ctx = data;
448 444
@@ -450,7 +446,7 @@ int drm_rmctx(struct drm_device *dev, void *data,
450 if (ctx->handle != DRM_KERNEL_CONTEXT) { 446 if (ctx->handle != DRM_KERNEL_CONTEXT) {
451 if (dev->driver->context_dtor) 447 if (dev->driver->context_dtor)
452 dev->driver->context_dtor(dev, ctx->handle); 448 dev->driver->context_dtor(dev, ctx->handle);
453 drm_ctxbitmap_free(dev, ctx->handle); 449 drm_legacy_ctxbitmap_free(dev, ctx->handle);
454 } 450 }
455 451
456 mutex_lock(&dev->ctxlist_mutex); 452 mutex_lock(&dev->ctxlist_mutex);
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 955f32cbce53..ed45ee628e3b 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -38,6 +38,7 @@
38#include <linux/poll.h> 38#include <linux/poll.h>
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/module.h> 40#include <linux/module.h>
41#include "drm_legacy.h"
41 42
42/* from BKL pushdown */ 43/* from BKL pushdown */
43DEFINE_MUTEX(drm_global_mutex); 44DEFINE_MUTEX(drm_global_mutex);
@@ -416,7 +417,7 @@ int drm_release(struct inode *inode, struct file *filp)
416 if (dev->driver->driver_features & DRIVER_GEM) 417 if (dev->driver->driver_features & DRIVER_GEM)
417 drm_gem_release(dev, file_priv); 418 drm_gem_release(dev, file_priv);
418 419
419 drm_ctxbitmap_flush(dev, file_priv); 420 drm_legacy_ctxbitmap_flush(dev, file_priv);
420 421
421 mutex_lock(&dev->master_mutex); 422 mutex_lock(&dev->master_mutex);
422 423
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 22ca14d67060..d3d1a8c72e98 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -30,6 +30,7 @@
30 30
31#include <drm/drmP.h> 31#include <drm/drmP.h>
32#include <drm/drm_core.h> 32#include <drm/drm_core.h>
33#include "drm_legacy.h"
33 34
34#include <linux/pci.h> 35#include <linux/pci.h>
35#include <linux/export.h> 36#include <linux/export.h>
@@ -64,19 +65,19 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
64 DRM_IOCTL_DEF(DRM_IOCTL_ADD_MAP, drm_addmap_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 65 DRM_IOCTL_DEF(DRM_IOCTL_ADD_MAP, drm_addmap_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
65 DRM_IOCTL_DEF(DRM_IOCTL_RM_MAP, drm_rmmap_ioctl, DRM_AUTH), 66 DRM_IOCTL_DEF(DRM_IOCTL_RM_MAP, drm_rmmap_ioctl, DRM_AUTH),
66 67
67 DRM_IOCTL_DEF(DRM_IOCTL_SET_SAREA_CTX, drm_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 68 DRM_IOCTL_DEF(DRM_IOCTL_SET_SAREA_CTX, drm_legacy_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
68 DRM_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX, drm_getsareactx, DRM_AUTH), 69 DRM_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX, drm_legacy_getsareactx, DRM_AUTH),
69 70
70 DRM_IOCTL_DEF(DRM_IOCTL_SET_MASTER, drm_setmaster_ioctl, DRM_ROOT_ONLY), 71 DRM_IOCTL_DEF(DRM_IOCTL_SET_MASTER, drm_setmaster_ioctl, DRM_ROOT_ONLY),
71 DRM_IOCTL_DEF(DRM_IOCTL_DROP_MASTER, drm_dropmaster_ioctl, DRM_ROOT_ONLY), 72 DRM_IOCTL_DEF(DRM_IOCTL_DROP_MASTER, drm_dropmaster_ioctl, DRM_ROOT_ONLY),
72 73
73 DRM_IOCTL_DEF(DRM_IOCTL_ADD_CTX, drm_addctx, DRM_AUTH|DRM_ROOT_ONLY), 74 DRM_IOCTL_DEF(DRM_IOCTL_ADD_CTX, drm_legacy_addctx, DRM_AUTH|DRM_ROOT_ONLY),
74 DRM_IOCTL_DEF(DRM_IOCTL_RM_CTX, drm_rmctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 75 DRM_IOCTL_DEF(DRM_IOCTL_RM_CTX, drm_legacy_rmctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
75 DRM_IOCTL_DEF(DRM_IOCTL_MOD_CTX, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 76 DRM_IOCTL_DEF(DRM_IOCTL_MOD_CTX, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
76 DRM_IOCTL_DEF(DRM_IOCTL_GET_CTX, drm_getctx, DRM_AUTH), 77 DRM_IOCTL_DEF(DRM_IOCTL_GET_CTX, drm_legacy_getctx, DRM_AUTH),
77 DRM_IOCTL_DEF(DRM_IOCTL_SWITCH_CTX, drm_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 78 DRM_IOCTL_DEF(DRM_IOCTL_SWITCH_CTX, drm_legacy_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
78 DRM_IOCTL_DEF(DRM_IOCTL_NEW_CTX, drm_newctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 79 DRM_IOCTL_DEF(DRM_IOCTL_NEW_CTX, drm_legacy_newctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
79 DRM_IOCTL_DEF(DRM_IOCTL_RES_CTX, drm_resctx, DRM_AUTH), 80 DRM_IOCTL_DEF(DRM_IOCTL_RES_CTX, drm_legacy_resctx, DRM_AUTH),
80 81
81 DRM_IOCTL_DEF(DRM_IOCTL_ADD_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 82 DRM_IOCTL_DEF(DRM_IOCTL_ADD_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
82 DRM_IOCTL_DEF(DRM_IOCTL_RM_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 83 DRM_IOCTL_DEF(DRM_IOCTL_RM_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
new file mode 100644
index 000000000000..d34f20a79b7c
--- /dev/null
+++ b/drivers/gpu/drm/drm_legacy.h
@@ -0,0 +1,51 @@
1#ifndef __DRM_LEGACY_H__
2#define __DRM_LEGACY_H__
3
4/*
5 * Copyright (c) 2014 David Herrmann <dh.herrmann@gmail.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26struct drm_device;
27struct drm_file;
28
29/*
30 * Generic DRM Contexts
31 */
32
33#define DRM_KERNEL_CONTEXT 0
34#define DRM_RESERVED_CONTEXTS 1
35
36int drm_legacy_ctxbitmap_init(struct drm_device *dev);
37void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev);
38void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
39void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);
40
41int drm_legacy_resctx(struct drm_device *d, void *v, struct drm_file *f);
42int drm_legacy_addctx(struct drm_device *d, void *v, struct drm_file *f);
43int drm_legacy_getctx(struct drm_device *d, void *v, struct drm_file *f);
44int drm_legacy_switchctx(struct drm_device *d, void *v, struct drm_file *f);
45int drm_legacy_newctx(struct drm_device *d, void *v, struct drm_file *f);
46int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f);
47
48int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f);
49int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
50
51#endif /* __DRM_LEGACY_H__ */
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 786401cd5f60..ea1572596578 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -35,6 +35,7 @@
35 35
36#include <linux/export.h> 36#include <linux/export.h>
37#include <drm/drmP.h> 37#include <drm/drmP.h>
38#include "drm_legacy.h"
38 39
39static int drm_notifier(void *priv); 40static int drm_notifier(void *priv);
40 41
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 09c6bfb86a66..92bc6b1d9646 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -34,6 +34,7 @@
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <drm/drmP.h> 35#include <drm/drmP.h>
36#include <drm/drm_core.h> 36#include <drm/drm_core.h>
37#include "drm_legacy.h"
37 38
38unsigned int drm_debug = 0; /* 1 to enable debug output */ 39unsigned int drm_debug = 0; /* 1 to enable debug output */
39EXPORT_SYMBOL(drm_debug); 40EXPORT_SYMBOL(drm_debug);
@@ -604,7 +605,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
604 if (drm_ht_create(&dev->map_hash, 12)) 605 if (drm_ht_create(&dev->map_hash, 12))
605 goto err_minors; 606 goto err_minors;
606 607
607 ret = drm_ctxbitmap_init(dev); 608 ret = drm_legacy_ctxbitmap_init(dev);
608 if (ret) { 609 if (ret) {
609 DRM_ERROR("Cannot allocate memory for context bitmap.\n"); 610 DRM_ERROR("Cannot allocate memory for context bitmap.\n");
610 goto err_ht; 611 goto err_ht;
@@ -621,7 +622,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
621 return dev; 622 return dev;
622 623
623err_ctxbitmap: 624err_ctxbitmap:
624 drm_ctxbitmap_cleanup(dev); 625 drm_legacy_ctxbitmap_cleanup(dev);
625err_ht: 626err_ht:
626 drm_ht_remove(&dev->map_hash); 627 drm_ht_remove(&dev->map_hash);
627err_minors: 628err_minors:
@@ -643,7 +644,7 @@ static void drm_dev_release(struct kref *ref)
643 if (dev->driver->driver_features & DRIVER_GEM) 644 if (dev->driver->driver_features & DRIVER_GEM)
644 drm_gem_destroy(dev); 645 drm_gem_destroy(dev);
645 646
646 drm_ctxbitmap_cleanup(dev); 647 drm_legacy_ctxbitmap_cleanup(dev);
647 drm_ht_remove(&dev->map_hash); 648 drm_ht_remove(&dev->map_hash);
648 drm_fs_inode_free(dev->anon_inode); 649 drm_fs_inode_free(dev->anon_inode);
649 650
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 458385ec15f3..a57646382086 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -151,8 +151,6 @@ int drm_err(const char *func, const char *format, ...);
151 also include looping detection. */ 151 also include looping detection. */
152 152
153#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ 153#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */
154#define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */
155#define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */
156 154
157#define DRM_MAP_HASH_OFFSET 0x10000000 155#define DRM_MAP_HASH_OFFSET 0x10000000
158 156
@@ -535,15 +533,6 @@ struct drm_map_list {
535 struct drm_master *master; 533 struct drm_master *master;
536}; 534};
537 535
538/**
539 * Context handle list
540 */
541struct drm_ctx_list {
542 struct list_head head; /**< list head */
543 drm_context_t handle; /**< context handle */
544 struct drm_file *tag; /**< associated fd private data */
545};
546
547/* location of GART table */ 536/* location of GART table */
548#define DRM_ATI_GART_MAIN 1 537#define DRM_ATI_GART_MAIN 1
549#define DRM_ATI_GART_FB 2 538#define DRM_ATI_GART_FB 2
@@ -1236,30 +1225,6 @@ extern int drm_setversion(struct drm_device *dev, void *data,
1236extern int drm_noop(struct drm_device *dev, void *data, 1225extern int drm_noop(struct drm_device *dev, void *data,
1237 struct drm_file *file_priv); 1226 struct drm_file *file_priv);
1238 1227
1239 /* Context IOCTL support (drm_context.h) */
1240extern int drm_resctx(struct drm_device *dev, void *data,
1241 struct drm_file *file_priv);
1242extern int drm_addctx(struct drm_device *dev, void *data,
1243 struct drm_file *file_priv);
1244extern int drm_getctx(struct drm_device *dev, void *data,
1245 struct drm_file *file_priv);
1246extern int drm_switchctx(struct drm_device *dev, void *data,
1247 struct drm_file *file_priv);
1248extern int drm_newctx(struct drm_device *dev, void *data,
1249 struct drm_file *file_priv);
1250extern int drm_rmctx(struct drm_device *dev, void *data,
1251 struct drm_file *file_priv);
1252
1253extern int drm_ctxbitmap_init(struct drm_device *dev);
1254extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
1255extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
1256extern void drm_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);
1257
1258extern int drm_setsareactx(struct drm_device *dev, void *data,
1259 struct drm_file *file_priv);
1260extern int drm_getsareactx(struct drm_device *dev, void *data,
1261 struct drm_file *file_priv);
1262
1263 /* Authentication IOCTL support (drm_auth.h) */ 1228 /* Authentication IOCTL support (drm_auth.h) */
1264extern int drm_getmagic(struct drm_device *dev, void *data, 1229extern int drm_getmagic(struct drm_device *dev, void *data,
1265 struct drm_file *file_priv); 1230 struct drm_file *file_priv);