From: Ben Widawsky <benjamin.widawsky@intel.com>
To: Intel GFX <intel-gfx@lists.freedesktop.org>
Subject: [PATCH 1/3] drm/i915/ppgtt: Load address space after mi_set_context
Date: Tue, 1 Apr 2014 17:37:30 -0700 [thread overview]
Message-ID: <1396399052-20612-1-git-send-email-benjamin.widawsky@intel.com> (raw)
In-Reply-To: <20140401231242.GA28657@bwidawsk.net>
On GEN8 the PDPs are saved and restored with context, which means we
must set them after the context switch has occurred. If we do not do
this, we end up saving the new PDPs for the old context.
The next patch will go one step further and actually only load the PDPs
once.
Example of a problem
LRI PDPs 1
MI_SET_CONTEXT bar
LRI_PDPs 2
MI_SET_CONTEXT foo // save PDPs 2 to bar's context
// load foos PDPs
LRI PDPs 1
MI_SET_CONTEXT bar // save PDPs 1 to foo's context
It's all wacky. This should allow full PPGTT on Broadwell to work.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
drivers/gpu/drm/i915/i915_gem_context.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 8fe7d72..0e8fd1e 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -667,13 +667,12 @@ static int do_switch(struct intel_ring_buffer *ring,
*/
from = ring->last_context;
- if (USES_FULL_PPGTT(ring->dev)) {
- ret = ppgtt->switch_mm(ppgtt, ring, false);
- if (ret)
- goto unpin_out;
- }
-
if (ring != &dev_priv->ring[RCS]) {
+ if (USES_FULL_PPGTT(ring->dev)) {
+ ret = ppgtt->switch_mm(ppgtt, ring, false);
+ if (ret)
+ goto unpin_out;
+ }
if (from)
i915_gem_context_unreference(from);
goto done;
@@ -711,6 +710,19 @@ static int do_switch(struct intel_ring_buffer *ring,
if (ret)
goto unpin_out;
+ if (USES_FULL_PPGTT(ring->dev)) {
+ ret = ppgtt->switch_mm(ppgtt, ring, false);
+ /* The hardware context switch is emitted, but we haven't
+ * actually changed the state - so it's probably safe to bail
+ * here. Still, let the user know something dangerous has
+ * happened.
+ */
+ if (ret) {
+ DRM_ERROR("Failed to change address space on context switch\n");
+ goto unpin_out;
+ }
+ }
+
for (i = 0; i < MAX_L3_SLICES; i++) {
if (!(to->remap_slice & (1<<i)))
continue;
--
1.9.1
next prev parent reply other threads:[~2014-04-02 0:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-01 15:55 [PATCH] drm/i915/bdw: Enable full PPGTT Ben Widawsky
2014-04-01 23:12 ` Ben Widawsky
2014-04-02 0:37 ` Ben Widawsky [this message]
2014-04-02 0:37 ` [PATCH 2/3] drm/i915/bdw: Render ring PDP is restored with context Ben Widawsky
2014-04-02 0:43 ` [PATCH 2/3] [v2] " Ben Widawsky
2014-04-02 3:35 ` Ben Widawsky
2014-04-02 0:37 ` [PATCH 3/3] drm/i915/bdw: Enable full PPGTT Ben Widawsky
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=1396399052-20612-1-git-send-email-benjamin.widawsky@intel.com \
--to=benjamin.widawsky@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