Skip to content

Commit 967ab6b

Browse files
icklejnikula
authored andcommitted
drm/i915: Only mark the ctx as initialised after a SET_CONTEXT operation
Fallout from commit 46470fc Author: Mika Kuoppala <mika.kuoppala@linux.intel.com> Date: Wed May 21 19:01:06 2014 +0300 drm/i915: Add null state batch to active list undid the earlier fix of only marking the ctx as initialised after it is saved by the hardware during a SET_CONTEXT operation: commit ad1d219 Author: Ben Widawsky <benjamin.widawsky@intel.com> Date: Sat Dec 28 13:31:49 2013 -0800 drm/i915: set ctx->initialized only after RCS Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Damien Lespiau <damien.lespiau@intel.com> Cc: Mika Kuoppala <mika.kuoppala@intel.com> Cc: Ben Widawsky <ben@bwidawsk.net> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Ben Widawsky <ben@bwidawsk.net> [Jani: add reference to the earlier fix in the commit messsage.] Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 56c4b63 commit 967ab6b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/gpu/drm/i915/i915_gem_context.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ static int do_switch(struct intel_engine_cs *ring,
598598
struct intel_context *from = ring->last_context;
599599
struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to);
600600
u32 hw_flags = 0;
601+
bool uninitialized = false;
601602
int ret, i;
602603

603604
if (from != NULL && ring == &dev_priv->ring[RCS]) {
@@ -696,19 +697,20 @@ static int do_switch(struct intel_engine_cs *ring,
696697
i915_gem_context_unreference(from);
697698
}
698699

700+
uninitialized = !to->is_initialized && from == NULL;
701+
to->is_initialized = true;
702+
699703
done:
700704
i915_gem_context_reference(to);
701705
ring->last_context = to;
702706
to->last_ring = ring;
703707

704-
if (ring->id == RCS && !to->is_initialized && from == NULL) {
708+
if (uninitialized) {
705709
ret = i915_gem_render_state_init(ring);
706710
if (ret)
707711
DRM_ERROR("init render state: %d\n", ret);
708712
}
709713

710-
to->is_initialized = true;
711-
712714
return 0;
713715

714716
unpin_out:

0 commit comments

Comments
 (0)