From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Widawsky Subject: [PATCH 3/3] drm/i915: Make file default context persistent Date: Thu, 2 Jan 2014 19:50:29 -1000 Message-ID: <1388728235-20410-3-git-send-email-benjamin.widawsky@intel.com> References: <1388728235-20410-1-git-send-email-benjamin.widawsky@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 966CAFA29F for ; Thu, 2 Jan 2014 21:50:50 -0800 (PST) In-Reply-To: <1388728235-20410-1-git-send-email-benjamin.widawsky@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Intel GFX Cc: Ben Widawsky , Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org 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 --- 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