@@ -634,6 +634,16 @@ mi_set_context(struct intel_ring_buffer *ring,
return ret;
}
+static inline bool should_skip_switch(struct intel_ring_buffer *ring,
+ struct i915_hw_context *from,
+ struct i915_hw_context *to)
+{
+ if (from == to && from->last_ring == ring && !to->remap_slice)
+ return true;
+
+ return false;
+}
+
static int do_switch(struct intel_ring_buffer *ring,
struct i915_hw_context *to)
{
@@ -648,7 +658,7 @@ static int do_switch(struct intel_ring_buffer *ring,
BUG_ON(!i915_gem_obj_is_pinned(from->obj));
}
- if (from == to && from->last_ring == ring && !to->remap_slice)
+ if (should_skip_switch(ring, from, to))
return 0;
/* Trying to pin first makes error handling easier. */
We have some fanciness coming up. This patch just breaks out the logic. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> --- drivers/gpu/drm/i915/i915_gem_context.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)