diff mbox series

[1/3] drm/i915: Use render class for MI_SET_CONTEXT

Message ID 20190813174121.129593-1-stuart.summers@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/i915: Use render class for MI_SET_CONTEXT | expand

Commit Message

Summers, Stuart Aug. 13, 2019, 5:41 p.m. UTC
Replace GEM_BUG_ON with explicit check for render class
when doing the kernel context switch.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_ringbuffer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Chris Wilson Aug. 13, 2019, 5:54 p.m. UTC | #1
Quoting Stuart Summers (2019-08-13 18:41:19)
> Replace GEM_BUG_ON with explicit check for render class
> when doing the kernel context switch.
> 
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_ringbuffer.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> index 409d764f8c6d..04ea9bbb88ce 100644
> --- a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> @@ -1781,9 +1781,7 @@ static int switch_context(struct i915_request *rq)
>                 }
>         }
>  
> -       if (rq->hw_context->state) {
> -               GEM_BUG_ON(engine->id != RCS0);
> -
> +       if (engine->class == RENDER_CLASS && rq->hw_context->state) {

It would come as some surprise for this not to be rcs0. I don't think we
are prepared for that on legacy HW :)
-Chris
Summers, Stuart Aug. 13, 2019, 6 p.m. UTC | #2
On Tue, 2019-08-13 at 18:54 +0100, Chris Wilson wrote:
> Quoting Stuart Summers (2019-08-13 18:41:19)
> > Replace GEM_BUG_ON with explicit check for render class
> > when doing the kernel context switch.
> > 
> > Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> > ---
> >  drivers/gpu/drm/i915/gt/intel_ringbuffer.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> > b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> > index 409d764f8c6d..04ea9bbb88ce 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> > @@ -1781,9 +1781,7 @@ static int switch_context(struct i915_request
> > *rq)
> >                 }
> >         }
> >  
> > -       if (rq->hw_context->state) {
> > -               GEM_BUG_ON(engine->id != RCS0);
> > -
> > +       if (engine->class == RENDER_CLASS && rq->hw_context->state) 
> > {
> 
> It would come as some surprise for this not to be rcs0. I don't think
> we
> are prepared for that on legacy HW :)

Heh, I will admit that this isn't a strict requirement but thought it
would be nice to have. If you're opposed we can drop this.

Thanks,
Stuart

> -Chris
Chris Wilson Aug. 13, 2019, 6:05 p.m. UTC | #3
Quoting Stuart Summers (2019-08-13 19:00:18)
> On Tue, 2019-08-13 at 18:54 +0100, Chris Wilson wrote:
> > Quoting Stuart Summers (2019-08-13 18:41:19)
> > > Replace GEM_BUG_ON with explicit check for render class
> > > when doing the kernel context switch.
> > > 
> > > Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/gt/intel_ringbuffer.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> > > b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> > > index 409d764f8c6d..04ea9bbb88ce 100644
> > > --- a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> > > +++ b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
> > > @@ -1781,9 +1781,7 @@ static int switch_context(struct i915_request
> > > *rq)
> > >                 }
> > >         }
> > >  
> > > -       if (rq->hw_context->state) {
> > > -               GEM_BUG_ON(engine->id != RCS0);
> > > -
> > > +       if (engine->class == RENDER_CLASS && rq->hw_context->state) 
> > > {
> > 
> > It would come as some surprise for this not to be rcs0. I don't think
> > we
> > are prepared for that on legacy HW :)
> 
> Heh, I will admit that this isn't a strict requirement but thought it
> would be nice to have. If you're opposed we can drop this.

I think this is more a summation of what was going through the
programmers mind at the time "this had better be rcs0 or we've screwed
up badly and I have no idea what's going on or how the HW is going to
respond" :)
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
index 409d764f8c6d..04ea9bbb88ce 100644
--- a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c
@@ -1781,9 +1781,7 @@  static int switch_context(struct i915_request *rq)
 		}
 	}
 
-	if (rq->hw_context->state) {
-		GEM_BUG_ON(engine->id != RCS0);
-
+	if (engine->class == RENDER_CLASS && rq->hw_context->state) {
 		/*
 		 * The kernel context(s) is treated as pure scratch and is not
 		 * expected to retain any state (as we sacrifice it during