From patchwork Wed May 25 11:48:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9135219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C390A6075C for ; Wed, 25 May 2016 11:49:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B64B2282D4 for ; Wed, 25 May 2016 11:49:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB26A282D8; Wed, 25 May 2016 11:49:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61C93282D4 for ; Wed, 25 May 2016 11:49:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 49F186E323; Wed, 25 May 2016 11:49:08 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A6576E323 for ; Wed, 25 May 2016 11:49:05 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id q62so14563603wmg.3 for ; Wed, 25 May 2016 04:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ItaFx4rQDIlYtKm+RvaK+n4TsAaWLuNS8QJMWIfJows=; b=rDvzwGVzLgDi9IgPidlLerIyaAErOzQOH+cfhI38COkU1UilF5RQxLXK1xwY9QSz4r eM94md+XQvBe4Dh8Ra/VVynbzQbteZH9XAU/oKc4ukyW9a2hNfO8B+ozs/54gT/iJSb/ d6sU4jXRKbgjlKuL6NeTAKTxv3C1fmJARfN1YrDbiJInT+Eu8YuLwrG33ToZn3LlkXT6 f64A8Iil3XpBVGCTW/+5HKbf7UPtwSZPfnbANOFLRgpQJThHIFDFTtTcnmaqTnnJ36g3 j9L6KDLRzRlr/ZYM3IAwArFD6gaQMKmd+aFk8tn7mBIYzEX38ucQ5lIBKwhhSWwD3K4W BLRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ItaFx4rQDIlYtKm+RvaK+n4TsAaWLuNS8QJMWIfJows=; b=e0km71/sxxHk2/XzyPrNXyfqwOvemEAC4vBnGxfcxYVGnQbL/H0wp+zMG7jOjwVhTJ I1KoVmePrruY8/BPu2iRcjWa4vVec/uWhUu/AUWVS0Ja2bAPer8LWZeknImoMd5dqwfz +Wn55ou/iWPVr6kln9XeUW9PgKzCGVFh7xHfpMSb8PFcOSDjbKaprKbQMnTuH+8mMqw/ 0p/ZH21ya0xiEX2d0pzihhBdmgkaU0I7rWrKKmFHqrDklPMSHr/meT3reaqhZ3iUkg94 km4LnrigsfmtLQtATrxjAhatLOgLquknNbZPvCZc2794tg7q88JTZ7m/4t1A4Oxv00XV KPNg== X-Gm-Message-State: ALyK8tJQS9dqE/cPDYLywx5OGTP86hyRwsXvKkfKtiGXREkNee8y+c8ja6UH0jpsI7OD7Q== X-Received: by 10.28.148.136 with SMTP id w130mr3120106wmd.10.1464176942728; Wed, 25 May 2016 04:49:02 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id n15sm8398666wjr.1.2016.05.25.04.49.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2016 04:49:01 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 25 May 2016 12:48:49 +0100 Message-Id: <1464176933-31067-3-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464176933-31067-1-git-send-email-chris@chris-wilson.co.uk> References: <1464176933-31067-1-git-send-email-chris@chris-wilson.co.uk> Cc: Mika Kuoppala Subject: [Intel-gfx] [PATCH 2/6] drm/i915: Treat kernel context as initialised X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The kernel context exists simply as a placeholder and should never be executed with a render context. It does not need the golden render state, as that will always be applied to a user context. By skipping the initialisation we can avoid issues in attempting to program the golden render context when trying to make the hardware idle. Testcase: igt/drm_module_reload_basic #byt Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95634 Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem_context.c | 45 +++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index a3b11aac23a4..3e3acd054f05 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -413,7 +413,8 @@ int i915_gem_context_init(struct drm_device *dev) return PTR_ERR(ctx); } - if (!i915.enable_execlists && ctx->engine[RCS].state) { + if (!i915.enable_execlists) { + struct intel_engine_cs *engine; int ret; /* We may need to do things with the shrinker which @@ -423,13 +424,28 @@ int i915_gem_context_init(struct drm_device *dev) * be available. To avoid this we always pin the default * context. */ - ret = i915_gem_obj_ggtt_pin(ctx->engine[RCS].state, - get_context_alignment(dev_priv), 0); - if (ret) { - DRM_ERROR("Failed to pinned default global context (error %d)\n", - ret); - i915_gem_context_unreference(ctx); - return ret; + for_each_engine(engine, dev_priv) { + struct intel_context *ce = &ctx->engine[engine->id]; + + ret = 0; + if (ce->state) + ret = i915_gem_obj_ggtt_pin(ce->state, + get_context_alignment(dev_priv), 0); + if (ret) { + DRM_ERROR("Failed to pinned default global context (error %d)\n", + ret); + i915_gem_context_unreference(ctx); + return ret; + } + + /* The kernel context is only used as a placeholder + * for flushing the active context. It is never used + * for submitting rendering and as such never requires + * the golden render context, and so we can skip + * emitting it when we switch to the kernel context + * (during eviction). + */ + ce->initialised = true; } } @@ -452,13 +468,16 @@ void i915_gem_context_lost(struct drm_i915_private *dev_priv) i915_gem_context_unpin(engine->last_context, engine); engine->last_context = NULL; } - - /* Force the GPU state to be reinitialised on enabling */ - dev_priv->kernel_context->engine[engine->id].initialised = - engine->init_context == NULL; } - /* Force the GPU state to be reinitialised on enabling */ + /* Force the GPU state to be restore on enabling */ + for_each_engine(engine, dev_priv) { + struct intel_context *ce = + &dev_priv->kernel_context->engine[engine->id]; + + ce->initialised = + !i915.enable_execlists || engine->init_context == NULL; + } dev_priv->kernel_context->remap_slice = ALL_L3_SLICES(dev_priv); }