From: Ben Widawsky <benjamin.widawsky@intel.com>
To: Intel GFX <intel-gfx@lists.freedesktop.org>
Cc: Ben Widawsky <ben@bwidawsk.net>,
Ben Widawsky <benjamin.widawsky@intel.com>
Subject: [PATCH] drm/i915: set ctx->initialized only after RCS
Date: Sat, 28 Dec 2013 13:31:49 -0800 [thread overview]
Message-ID: <1388266309-1178-1-git-send-email-benjamin.widawsky@intel.com> (raw)
The initialized flag is used to specify a context has been initialized
and it's context is safe to load, ie. the 3d state is setup properly.
With full PPGTT, we emit the address space loads during context switch
and this currently marks a context as initialized. With full PPGTT
patches, if a client first emits a batch to !RCS, then later, RCS, the
code will mistake the context as initialized and try to reload an
uninitialized context.
1. context 1 blit // context initialized
2. context 2 <X operation> // saves context 1 random state
3. context 1 render // loads random state from step 2
It is really easy to hit this with a planned upcoming patch which makes
default context reuse possible.
NOTE: This should only effect full PPGTT branches, ie. current
drm-intel-nightly.
Thanks to Chris for helping me track this down.
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
drivers/gpu/drm/i915/i915_gem_context.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index ebe0f67..28b9f30 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -686,10 +686,11 @@ static int do_switch(struct intel_ring_buffer *ring,
i915_gem_context_unreference(from);
}
+ to->is_initialized = true;
+
done:
i915_gem_context_reference(to);
ring->last_context = to;
- to->is_initialized = true;
to->last_ring = ring;
return 0;
--
1.8.5.2
next reply other threads:[~2013-12-28 21:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-28 21:31 Ben Widawsky [this message]
2013-12-29 9:59 ` [PATCH] drm/i915: set ctx->initialized only after RCS Chris Wilson
2013-12-30 21:34 ` Ben Widawsky
2013-12-31 11:26 ` Chris Wilson
2014-01-01 18:10 ` Ben Widawsky
2014-01-07 7:10 ` Daniel Vetter
2014-01-07 10:47 ` Chris Wilson
2014-01-09 23:17 ` Ben Widawsky
2014-01-10 7:18 ` Daniel Vetter
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=1388266309-1178-1-git-send-email-benjamin.widawsky@intel.com \
--to=benjamin.widawsky@intel.com \
--cc=ben@bwidawsk.net \
--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