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 2/3] drm/i915: set ctx->initialized only after RCS
Date: Thu, 2 Jan 2014 19:50:28 -1000 [thread overview]
Message-ID: <1388728235-20410-2-git-send-email-benjamin.widawsky@intel.com> (raw)
In-Reply-To: <1388728235-20410-1-git-send-email-benjamin.widawsky@intel.com>
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 marked as initialized
2. context 1 render // loads random state
It is really easy to hit this with a planned upcoming patch which makes
default context reuse possible. See the mailing list thread in
references for more details about the issue.
Thanks to Chris for helping me track this down.
References: <1388266309-1178-1-git-send-email-benjamin.widawsky@intel.com>
Reviewed-by: 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 44dddc00..8c7a5b2 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -692,10 +692,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 prev parent reply other threads:[~2014-01-03 5:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <to=1388555170-19936-1-git-send-email-benjamin.widawsky@intel.com>
2014-01-03 5:50 ` [PATCH] [v2] drm/i915/ppgtt: Never return a NULL context Ben Widawsky
2014-01-03 5:50 ` Ben Widawsky [this message]
2014-01-03 5:50 ` [PATCH 3/3] drm/i915: Make file default context persistent Ben Widawsky
2014-01-03 5:50 ` [PATCH 1/5] intel: squash unused variable 'bo_gem' Ben Widawsky
2014-01-03 5:50 ` [PATCH 2/5] intel: Handle malloc fails in context create Ben Widawsky
2014-01-03 5:50 ` [PATCH 3/5] intel: Merge latest i915_drm.h Ben Widawsky
2014-01-03 5:50 ` [PATCH 4/5] intel: Intel full PPGTT param Ben Widawsky
2014-01-07 7:53 ` Daniel Vetter
2014-01-09 23:20 ` Ben Widawsky
2014-01-03 5:50 ` [PATCH 5/5] configure.ac: bump version to 2.4.51 for release Ben Widawsky
2014-01-03 5:50 ` [PATCH] i965: Use default contexts when possible Ben Widawsky
2014-02-23 20:32 ` [Intel-gfx] " Ben Widawsky
2014-01-03 12:07 ` [PATCH] [v2] drm/i915/ppgtt: Never return a NULL context Mika Kuoppala
2014-01-07 7:51 ` Daniel Vetter
[not found] ` <CALNAZXq8EZ4Wmq2ONz08gNFcEv4Bi-JzBasEvnAKWEfEWyf_xw@mail.gmail.com>
[not found] ` <CAKMK7uE9aai27U7jwGe0jK5AzjxKx40z8VyS1D4mr__a5x-Qeg@mail.gmail.com>
2014-01-10 23:20 ` 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=1388728235-20410-2-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