Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: bradley.d.volkin@intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [RFC 4/4] drm/i915: Dispatch the shadow batch buffer
Date: Wed, 18 Jun 2014 09:36:16 -0700	[thread overview]
Message-ID: <1403109376-23452-5-git-send-email-bradley.d.volkin@intel.com> (raw)
In-Reply-To: <1403109376-23452-1-git-send-email-bradley.d.volkin@intel.com>

From: Brad Volkin <bradley.d.volkin@intel.com>

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 <bradley.d.volkin@intel.com>
---
 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)
-- 
1.8.3.2

      parent reply	other threads:[~2014-06-18 16:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 16:36 [RFC 0/4] Command parser batch buffer copy bradley.d.volkin
2014-06-18 16:36 ` [RFC 1/4] drm/i915: Implement a framework for batch buffer pools bradley.d.volkin
2014-06-19  9:48   ` Tvrtko Ursulin
2014-06-19 17:35     ` Volkin, Bradley D
2014-06-19 19:07       ` Daniel Vetter
2014-06-20 13:25       ` Tvrtko Ursulin
2014-06-20 15:30         ` Volkin, Bradley D
2014-06-20 15:41           ` Tvrtko Ursulin
2014-06-20 16:06             ` Volkin, Bradley D
2014-06-18 16:36 ` [RFC 2/4] drm/i915: Use batch pools with the command parser bradley.d.volkin
2014-06-18 16:52   ` Chris Wilson
2014-06-18 17:49     ` Volkin, Bradley D
2014-06-18 18:11       ` Chris Wilson
2014-06-18 19:59         ` Daniel Vetter
2014-06-18 16:36 ` [RFC 3/4] drm/i915: Add a batch pool debugfs file bradley.d.volkin
2014-06-18 16:36 ` bradley.d.volkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403109376-23452-5-git-send-email-bradley.d.volkin@intel.com \
    --to=bradley.d.volkin@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox