From patchwork Mon Jul 15 18:04:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2827703 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 39F8EC0AB2 for ; Mon, 15 Jul 2013 18:01:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECFE7201E4 for ; Mon, 15 Jul 2013 18:01:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9ABBB201E0 for ; Mon, 15 Jul 2013 18:01:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A82EE6380 for ; Mon, 15 Jul 2013 11:01:30 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from shiva.localdomain (unknown [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 346ECE5F6E for ; Mon, 15 Jul 2013 11:01:18 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 99) id E4A3588652; Mon, 15 Jul 2013 18:01:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lundgren.jf.intel.com (unknown [134.134.139.76]) by shiva.localdomain (Postfix) with ESMTPSA id 4478788167; Mon, 15 Jul 2013 18:01:17 +0000 (UTC) From: Ben Widawsky To: Intel GFX Date: Mon, 15 Jul 2013 11:04:38 -0700 Message-Id: <1373911478-15515-1-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <20130715102418.GA32386@cantiga.alporthouse.com> References: <20130715102418.GA32386@cantiga.alporthouse.com> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 2/9] [v2] drm/i915: Convert renderctx to a regular context X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Virus-Scanned: ClamAV using ClamSMTP The medium term plan is to just use the existing context code on ILK as well. The conversion just assists. Therefore, this is somewhat transient as I plan to kill renderctx quite soon. v2: Make NULL check style consistent (Chris) Ditch superfluous 'else' (Chris) Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_debugfs.c | 4 ++-- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/i915_gem_context.c | 2 +- drivers/gpu/drm/i915/intel_pm.c | 17 ++++++++++------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 8637979..5e88ef6 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1347,9 +1347,9 @@ static int i915_context_status(struct seq_file *m, void *unused) seq_putc(m, '\n'); } - if (dev_priv->ips.renderctx) { + if (dev_priv->ips.renderctx.obj) { seq_puts(m, "render context "); - describe_obj(m, dev_priv->ips.renderctx); + describe_obj(m, dev_priv->ips.renderctx.obj); seq_putc(m, '\n'); } diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 03ab05c..64c6ae0 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -789,7 +789,7 @@ struct intel_ilk_power_mgmt { int r_t; struct drm_i915_gem_object *pwrctx; - struct drm_i915_gem_object *renderctx; + struct i915_hw_context renderctx; }; /* Power well structure for haswell */ diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index ab72c72..2c25006 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -589,7 +589,7 @@ int ironlake_setup_rc6_hw_context(struct drm_i915_private *dev_priv) intel_ring_emit(ring, MI_SUSPEND_FLUSH | MI_SUSPEND_FLUSH_EN); intel_ring_emit(ring, MI_SET_CONTEXT); - intel_ring_emit(ring, i915_gem_obj_ggtt_offset(dev_priv->ips.renderctx) | + intel_ring_emit(ring, i915_gem_obj_ggtt_offset(dev_priv->ips.renderctx.obj) | MI_MM_SPACE_GTT | MI_SAVE_EXT_STATE_EN | MI_RESTORE_EXT_STATE_EN | diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 2673602..39db531 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -3615,10 +3615,10 @@ void ironlake_teardown_rc6(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - if (dev_priv->ips.renderctx) { - i915_gem_object_unpin(dev_priv->ips.renderctx); - drm_gem_object_unreference(&dev_priv->ips.renderctx->base); - dev_priv->ips.renderctx = NULL; + if (dev_priv->ips.renderctx.obj) { + i915_gem_object_unpin(dev_priv->ips.renderctx.obj); + drm_gem_object_unreference(&dev_priv->ips.renderctx.obj->base); + dev_priv->ips.renderctx.obj = NULL; } if (dev_priv->ips.pwrctx) { @@ -3650,9 +3650,12 @@ static int ironlake_setup_rc6(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - if (dev_priv->ips.renderctx == NULL) - dev_priv->ips.renderctx = intel_alloc_context_page(dev); - if (!dev_priv->ips.renderctx) + if (dev_priv->ips.renderctx.obj == NULL) { + dev_priv->ips.renderctx.id = DEFAULT_CONTEXT_ID; + dev_priv->ips.renderctx.ring = &dev_priv->ring[RCS]; + dev_priv->ips.renderctx.obj = intel_alloc_context_page(dev); + } + if (dev_priv->ips.renderctx.obj == NULL) return -ENOMEM; if (dev_priv->ips.pwrctx == NULL)