Rev 4104 | Rev 4280 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4104 | Rev 4246 | ||
---|---|---|---|
Line 287... | Line 287... | ||
287 | * will be 2 (+1 from object creation and +1 from do_switch()). |
287 | * will be 2 (+1 from object creation and +1 from do_switch()). |
288 | * i915_gem_context_fini() will be called after gpu_idle() has switched |
288 | * i915_gem_context_fini() will be called after gpu_idle() has switched |
289 | * to default context. So we need to unreference the base object once |
289 | * to default context. So we need to unreference the base object once |
290 | * to offset the do_switch part, so that i915_gem_context_unreference() |
290 | * to offset the do_switch part, so that i915_gem_context_unreference() |
291 | * can then free the base object correctly. */ |
291 | * can then free the base object correctly. */ |
- | 292 | drm_gem_object_unreference(&dctx->obj->base); |
|
- | 293 | i915_gem_context_unreference(dctx); |
|
292 | } |
294 | } |
Line 293... | Line 295... | ||
293 | 295 | ||
294 | static int context_idr_cleanup(int id, void *p, void *data) |
296 | static int context_idr_cleanup(int id, void *p, void *data) |
295 | { |
297 | { |
Line 305... | Line 307... | ||
305 | void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) |
307 | void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) |
306 | { |
308 | { |
307 | struct drm_i915_file_private *file_priv = file->driver_priv; |
309 | struct drm_i915_file_private *file_priv = file->driver_priv; |
Line 308... | Line 310... | ||
308 | 310 | ||
309 | mutex_lock(&dev->struct_mutex); |
311 | mutex_lock(&dev->struct_mutex); |
310 | // idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL); |
312 | idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL); |
311 | idr_destroy(&file_priv->context_idr); |
313 | idr_destroy(&file_priv->context_idr); |
312 | mutex_unlock(&dev->struct_mutex); |
314 | mutex_unlock(&dev->struct_mutex); |
Line 313... | Line 315... | ||
313 | } |
315 | } |
Line 491... | Line 493... | ||
491 | } |
493 | } |
Line 492... | Line 494... | ||
492 | 494 | ||
493 | return do_switch(to); |
495 | return do_switch(to); |
Line 494... | Line -... | ||
494 | } |
- | |
495 | 496 | } |
|
496 | #if 0 |
497 | |
497 | int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, |
498 | int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, |
498 | struct drm_file *file) |
499 | struct drm_file *file) |
499 | { |
500 | { |
Line 543... | Line 544... | ||
543 | if (!ctx) { |
544 | if (!ctx) { |
544 | mutex_unlock(&dev->struct_mutex); |
545 | mutex_unlock(&dev->struct_mutex); |
545 | return -ENOENT; |
546 | return -ENOENT; |
546 | } |
547 | } |
Line 547... | Line -... | ||
547 | - | ||
- | 548 | ||
- | 549 | idr_remove(&ctx->file_priv->context_idr, ctx->id); |
|
548 | 550 | i915_gem_context_unreference(ctx); |
|
Line 549... | Line 551... | ||
549 | mutex_unlock(&dev->struct_mutex); |
551 | mutex_unlock(&dev->struct_mutex); |
550 | 552 | ||
551 | DRM_DEBUG_DRIVER("HW context %d destroyed\n", args->ctx_id); |
553 | DRM_DEBUG_DRIVER("HW context %d destroyed\n", args->ctx_id); |
552 | return 0; |
- | |
553 | } |
- |