Signed-off-by: Ben Widawsky <ben at bwidawsk.net> --- drivers/gpu/drm/i915/i915_gem_context.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 8e218ad..8b2e73a 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -213,7 +213,7 @@ static int create_default_context(struct drm_i915_private *dev_priv) if (ret) goto err_unpin; - DRM_DEBUG_DRIVER("Default HW context loaded\n"); + DRM_DEBUG_DRIVER("Default HW context loaded (%p)\n", ctx); return 0; err_unpin: @@ -275,6 +275,7 @@ static int context_idr_cleanup(int id, void *p, void *data) BUG_ON(id == DEFAULT_CONTEXT_ID); + DRM_DEBUG_DRIVER("Context %d closed before destroy.\n", ctx->id); do_destroy(ctx); return 0; @@ -453,8 +454,11 @@ int i915_switch_context(struct intel_ring_buffer *ring, return -EINVAL; to = i915_gem_context_get(ring, file->driver_priv, to_id); - if (to == NULL) + if (unlikely(!to)) { + BUG_ON(to_id == DEFAULT_CONTEXT_ID); + DRM_DEBUG_DRIVER("Couldn't find context %d\n", to_id); return -ENOENT; + } return do_switch(to); } @@ -517,6 +521,6 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, mutex_unlock(&dev->struct_mutex); - DRM_DEBUG_DRIVER("HW context %d destroyed\n", args->ctx_id); + DRM_DEBUG_DRIVER("User destroyed context %d\n", args->ctx_id); return 0; } -- 1.8.2