From patchwork Tue Nov 26 16:51:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bradley.d.volkin@intel.com X-Patchwork-Id: 3239731 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 365B4C045B for ; Tue, 26 Nov 2013 16:53:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 916AB20416 for ; Tue, 26 Nov 2013 16:53:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 623A520412 for ; Tue, 26 Nov 2013 16:52:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 80CE3FB708; Tue, 26 Nov 2013 08:52:57 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 33DBBFB855 for ; Tue, 26 Nov 2013 08:52:27 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 26 Nov 2013 08:52:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,775,1378882800"; d="scan'208";a="415344935" Received: from bdvolkin-desk1.amr.corp.intel.com (HELO localhost.localdomain) ([10.10.34.110]) by orsmga001.jf.intel.com with ESMTP; 26 Nov 2013 08:52:24 -0800 From: bradley.d.volkin@intel.com To: intel-gfx@lists.freedesktop.org Date: Tue, 26 Nov 2013 08:51:38 -0800 Message-Id: <1385484699-51596-22-git-send-email-bradley.d.volkin@intel.com> X-Mailer: git-send-email 1.8.4.4 In-Reply-To: <1385484699-51596-1-git-send-email-bradley.d.volkin@intel.com> References: <1385484699-51596-1-git-send-email-bradley.d.volkin@intel.com> Subject: [Intel-gfx] [RFC 21/22] drm/i915: Clean up command parser enable decision 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@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Brad Volkin Signed-off-by: Brad Volkin --- drivers/gpu/drm/i915/i915_cmd_parser.c | 30 +++++++++++++++++++----------- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index 8481ef0..b3525ce 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c @@ -581,6 +581,25 @@ finish: return (u32*)addr; } +int i915_needs_cmd_parser(struct intel_ring_buffer *ring) +{ + drm_i915_private_t *dev_priv = + (drm_i915_private_t *)ring->dev->dev_private; + + /* No command tables indicates a platform without parsing */ + if (!ring->cmd_tables) + return 0; + + /* XXX: VLV is Gen7 and therefore has cmd_tables, but has PPGTT + * disabled. That will cause all of the parser's PPGTT checks to + * fail. For now, disable parsing when PPGTT is off. + */ + if(!dev_priv->mm.aliasing_ppgtt) + return 0; + + return i915_enable_cmd_parser; +} + #define LENGTH_BIAS 2 int i915_parse_cmds(struct intel_ring_buffer *ring, @@ -590,17 +609,6 @@ int i915_parse_cmds(struct intel_ring_buffer *ring, int ret = 0; u32 *cmd, *batch_base, *batch_end; struct drm_i915_cmd_descriptor default_desc = { 0 }; - drm_i915_private_t *dev_priv = - (drm_i915_private_t *)ring->dev->dev_private; - - /* XXX: this breaks VLV, which is Gen7, but no PPGTT - * Replace with better checks for when to call i915_parse_cmds? - */ - WARN_ON(!dev_priv->mm.aliasing_ppgtt); - - /* No command tables currently indicates a platform without parsing */ - if (!ring->cmd_tables) - return 0; batch_base = vmap_batch(batch_obj); if (!batch_base) { diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 161d9cd..e7fc31c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2412,6 +2412,7 @@ const char *i915_cache_level_str(int type); /* i915_cmd_parser.c */ void i915_cmd_parser_init_ring(struct intel_ring_buffer *ring); +int i915_needs_cmd_parser(struct intel_ring_buffer *ring); int i915_parse_cmds(struct intel_ring_buffer *ring, struct drm_i915_gem_object *batch_obj, u32 batch_start_offset); diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 06975c7..7b1453e 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -1143,7 +1143,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, } batch_obj->base.pending_read_domains |= I915_GEM_DOMAIN_COMMAND; - if (i915_enable_cmd_parser && !(flags & I915_DISPATCH_SECURE)) { + if (i915_needs_cmd_parser(ring) && !(flags & I915_DISPATCH_SECURE)) { ret = i915_parse_cmds(ring, batch_obj, args->batch_start_offset);