From patchwork Wed Jun 18 16:36:16 2014 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: 4377971 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8ECFC9F1C4 for ; Wed, 18 Jun 2014 16:36:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9DBA420357 for ; Wed, 18 Jun 2014 16:36:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C2E862011B for ; Wed, 18 Jun 2014 16:36:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3828F6E6D3; Wed, 18 Jun 2014 09:36:14 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 59F796E6E2 for ; Wed, 18 Jun 2014 09:36:10 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 18 Jun 2014 09:30:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,501,1400050800"; d="scan'208";a="530535279" Received: from bdvolkin-cube.ra.intel.com (HELO bdvolkin-ubuntu-desktop.ra.intel.com) ([10.10.34.187]) by orsmga001.jf.intel.com with ESMTP; 18 Jun 2014 09:35:24 -0700 From: bradley.d.volkin@intel.com To: intel-gfx@lists.freedesktop.org Date: Wed, 18 Jun 2014 09:36:16 -0700 Message-Id: <1403109376-23452-5-git-send-email-bradley.d.volkin@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1403109376-23452-1-git-send-email-bradley.d.volkin@intel.com> References: <1403109376-23452-1-git-send-email-bradley.d.volkin@intel.com> Subject: [Intel-gfx] [RFC 4/4] drm/i915: Dispatch the shadow batch buffer X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 This is useful for testing the batch pool code with aliasing PPGTT. It doesn't work with full PPGTT though; the GPU hangs and the whole UI is corrupted. We need fixes for the secure dispatch path to enable this for real. Signed-off-by: Brad Volkin --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 37 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 0b263aa..981f66b 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -1321,31 +1321,34 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, goto err; /* - * XXX: Actually do this when enabling batch copy... - * * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit * from MI_BATCH_BUFFER_START commands issued in the * dispatch_execbuffer implementations. We specifically don't * want that set when the command parser is enabled. */ + flags |= I915_DISPATCH_SECURE; } - /* snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure - * batch" bit. Hence we need to pin secure batches into the global gtt. - * hsw should have this fixed, but bdw mucks it up again. */ - if (flags & I915_DISPATCH_SECURE && - !batch_obj->has_global_gtt_mapping) { - /* When we have multiple VMs, we'll need to make sure that we - * allocate space first */ - struct i915_vma *vma = i915_gem_obj_to_ggtt(batch_obj); - BUG_ON(!vma); - vma->bind_vma(vma, batch_obj->cache_level, GLOBAL_BIND); - } + if (!shadow_batch_obj) { + /* snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure + * batch" bit. Hence we need to pin secure batches into the global gtt. + * hsw should have this fixed, but bdw mucks it up again. */ + if (flags & I915_DISPATCH_SECURE && + !batch_obj->has_global_gtt_mapping) { + /* When we have multiple VMs, we'll need to make sure that we + * allocate space first */ + struct i915_vma *vma = i915_gem_obj_to_ggtt(batch_obj); + BUG_ON(!vma); + vma->bind_vma(vma, batch_obj->cache_level, GLOBAL_BIND); + } - if (flags & I915_DISPATCH_SECURE) - exec_start += i915_gem_obj_ggtt_offset(batch_obj); - else - exec_start += i915_gem_obj_offset(batch_obj, vm); + if (flags & I915_DISPATCH_SECURE) + exec_start += i915_gem_obj_ggtt_offset(batch_obj); + else + exec_start += i915_gem_obj_offset(batch_obj, vm); + } else { + exec_start += i915_gem_obj_ggtt_offset(shadow_batch_obj); + } ret = i915_gem_execbuffer_move_to_gpu(ring, &eb->vmas); if (ret)