aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_context.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-11-27 23:22:24 -0500
committerDave Airlie <airlied@linux.ie>2008-12-29 02:47:22 -0500
commit7c1c2871a6a3a114853ec6836e9035ac1c0c7f7a (patch)
tree1b5debcc86ff20bd5e11b42ea5c52da42214e376 /drivers/gpu/drm/drm_context.c
parente7f7ab45ebcb54fd5f814ea15ea079e079662f67 (diff)
drm: move to kref per-master structures.
This is step one towards having multiple masters sharing a drm device in order to get fast-user-switching to work. It splits out the information associated with the drm master into a separate kref counted structure, and allocates this when a master opens the device node. It also allows the current master to abdicate (say while VT switched), and a new master to take over the hardware. It moves the Intel and radeon drivers to using the sarea from within the new master structures. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_context.c')
-rw-r--r--drivers/gpu/drm/drm_context.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index d505f695421f..809ec0f03452 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -256,12 +256,13 @@ static int drm_context_switch(struct drm_device * dev, int old, int new)
256 * hardware lock is held, clears the drm_device::context_flag and wakes up 256 * hardware lock is held, clears the drm_device::context_flag and wakes up
257 * drm_device::context_wait. 257 * drm_device::context_wait.
258 */ 258 */
259static int drm_context_switch_complete(struct drm_device * dev, int new) 259static int drm_context_switch_complete(struct drm_device *dev,
260 struct drm_file *file_priv, int new)
260{ 261{
261 dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ 262 dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
262 dev->last_switch = jiffies; 263 dev->last_switch = jiffies;
263 264
264 if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { 265 if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock)) {
265 DRM_ERROR("Lock isn't held after context switch\n"); 266 DRM_ERROR("Lock isn't held after context switch\n");
266 } 267 }
267 268
@@ -420,7 +421,7 @@ int drm_newctx(struct drm_device *dev, void *data,
420 struct drm_ctx *ctx = data; 421 struct drm_ctx *ctx = data;
421 422
422 DRM_DEBUG("%d\n", ctx->handle); 423 DRM_DEBUG("%d\n", ctx->handle);
423 drm_context_switch_complete(dev, ctx->handle); 424 drm_context_switch_complete(dev, file_priv, ctx->handle);
424 425
425 return 0; 426 return 0;
426} 427}
@@ -442,9 +443,6 @@ int drm_rmctx(struct drm_device *dev, void *data,
442 struct drm_ctx *ctx = data; 443 struct drm_ctx *ctx = data;
443 444
444 DRM_DEBUG("%d\n", ctx->handle); 445 DRM_DEBUG("%d\n", ctx->handle);
445 if (ctx->handle == DRM_KERNEL_CONTEXT + 1) {
446 file_priv->remove_auth_on_close = 1;
447 }
448 if (ctx->handle != DRM_KERNEL_CONTEXT) { 446 if (ctx->handle != DRM_KERNEL_CONTEXT) {
449 if (dev->driver->context_dtor) 447 if (dev->driver->context_dtor)
450 dev->driver->context_dtor(dev, ctx->handle); 448 dev->driver->context_dtor(dev, ctx->handle);