drm/i915: Remove ctx->last_ring
Subsystems (2)
PATCH 1/1 drm/i915: Remove ctx->last_ring
From: Oscar Mateo <[email protected]>
The original comment that introduced it said:
commit 0009e46cd54324c4af20b0b52b89973b1b914167
Author: Ben Widawsky <[email protected]> Date: Fri Dec 6 14:11:02 2013 -0800
drm/i915: Track which ring a context ran on
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.
But this is not really true, because we are already checking to != from (with "from" being = ring->last_context) and that should be enough to make sure we switch to the right address space.
We would have a problem if we switched the context object for every ring (since then we would fail to do it in some situations) but we only switch it for the render ring, so we don't care.
--- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_gem_context.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -1
@@ -591,7 +591,6 @@ struct intel_context {bool is_initialized;uint8_t remap_slice;struct drm_i915_file_private *file_priv; -struct intel_engine_cs *last_ring;struct drm_i915_gem_object *obj;struct i915_ctx_hang_stats hang_stats;struct i915_address_space *vm;
drivers/gpu/drm/i915/i915_gem_context.c +1 -2
@@ -598,7 +598,7 @@ static int do_switch(struct intel_engine_cs *ring,BUG_ON (!i915_gem_obj_is_pinned (from->obj)); } -if (from == to && from->last_ring == ring && !to->remap_slice) +if (from == to && !to->remap_slice)return 0 ;/* Trying to pin first makes error handling easier. */
@@ -692,7 +692,6 @@ static int do_switch(struct intel_engine_cs *ring, done:i915_gem_context_reference (to); ring->last_context = to; - to->last_ring = ring;if (ring->id ==RCS && !to->is_initialized && from ==NULL ) { ret =i915_gem_render_state_init (ring);
Signature · 1 line
1.9.0
Quoted 32 lines · On Wed, Jun 18, 2014 at 05:16:03PM +0100, [email protected] wrote:
From: Oscar Mateo <[email protected]>
The original comment that introduced it said:
commit
0009e46cd54324c4af20b0b52b89973b1b914167Author: Ben Widawsky <[email protected]> Date: Fri Dec 6 14:11:02 2013 -0800drm/i915: Track which ring a context ran on
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 BWithout tracking the last ring B ran on, we wouldn't know to switch the address space on BCS in the last row.
But this is not really true, because we are already checking to != from (with "from" being =
ring->last_context) and that should be enough to make sure we switch to the right address space.
Quoted 5 lines
We would have a problem if we switched the context object for every ring (since then we would fail to do it in some situations) but we only switch it for the render ring, so we don't care.
Signed-off-by Oscar Mateo <[email protected]>
I have sent the very same patch, so
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Daniel Vetter
AppliedQuoted 33 lines · Chris Wilson
Quoted 32 lines · On Wed, Jun 18, 2014 at 05:16:03PM +0100, [email protected] wrote:
From: Oscar Mateo <[email protected]>
The original comment that introduced it said:
commit
0009e46cd54324c4af20b0b52b89973b1b914167Author: Ben Widawsky <[email protected]> Date: Fri Dec 6 14:11:02 2013 -0800drm/i915: Track which ring a context ran on
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 BWithout tracking the last ring B ran on, we wouldn't know to switch the address space on BCS in the last row.
But this is not really true, because we are already checking to != from (with "from" being =
ring->last_context) and that should be enough to make sure we switch to the right address space.
Quoted 8 lines
Quoted 5 lines
We would have a problem if we switched the context object for every ring (since then we would fail to do it in some situations) but we only switch it for the render ring, so we don't care.
Signed-off-by Oscar Mateo <[email protected]>I have sent the very same patch, so
Reviewed-by Chris Wilson <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch