[Intel-gfx] [PATCH] drm/i915: set ctx->initialized only after RCS
Daniel Vetter
daniel at ffwll.ch
Tue Jan 7 08:10:33 CET 2014
On Sat, Dec 28, 2013 at 01:31:49PM -0800, Ben Widawsky wrote:
> 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 at chris-wilson.co.uk>
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Do we have a testcase for this or a bug report?
-Daniel
> ---
> 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
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list