With full PPGTT and per file default contexts it no longer makes sense
to inhibit saving and restoring those hw contexts. The /real/ default
context is system wide and still benefits from not saving/restoring.

The upshot of this patch is that with a simple param, userspace will be
able to avoid allocating a new context and simply use the default
context instead.

Signed-off-by: Ben Widawsky <b...@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
b/drivers/gpu/drm/i915/i915_gem_context.c
index 8c7a5b2..d12d1a0 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -230,7 +230,7 @@ err_out:
 
 static inline bool is_default_context(struct i915_hw_context *ctx)
 {
-       return (ctx->id == DEFAULT_CONTEXT_ID);
+       return (ctx->file_priv == NULL);
 }
 
 /**
@@ -474,8 +474,10 @@ static int context_idr_cleanup(int id, void *p, void *data)
        struct i915_hw_context *ctx = p;
 
        /* Ignore the default context because close will handle it */
-       if (is_default_context(ctx))
+       if (ctx->id == DEFAULT_CONTEXT_ID) {
+               BUG_ON(!ctx->file_priv);
                return 0;
+       }
 
        i915_gem_context_unreference(ctx);
        return 0;
-- 
1.8.5.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to