@@ -586,6 +586,7 @@ struct i915_hw_context {
struct i915_ctx_hang_stats hang_stats;
struct i915_hw_ppgtt ppgtt;
+ struct intel_ring_buffer *last_ring;
};
struct i915_fbc {
@@ -535,7 +535,7 @@ static int do_switch(struct intel_ring_buffer *ring,
BUG_ON(from->obj->pin_count == 0);
}
- if (from == to)
+ if (from == to && from->last_ring == ring)
return 0;
if (ring != &dev_priv->ring[RCS] && from) {
@@ -616,6 +616,7 @@ done:
i915_gem_context_reference(to);
ring->last_context = to;
to->is_initialized = true;
+ to->last_ring = ring;
return 0;
}
Previously we dropped the association of a context to a ring. It is however very important to know which ring a context ran on (we could have reused the other member, but I was nitpicky). This is very important when we switch address spaces, which unlike context objects, do change per ring. As an example, if we have: RCS BCS ctx A ctx A ctx B ctx B Without tracking the last ring B ran on, we wouldn't know to switch the address space on BCS in the last row. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_context.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)