diff mbox

drm/i915: Check intel_contexts to avoid one extra pointer chase

Message ID 20180601094002.13329-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson June 1, 2018, 9:40 a.m. UTC
As we store the intel_context on the request (rq->hw_context), we can
simply compare that against the local intel_context for the
i915->kernel_context rather than using the rq->gem_context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mika Kuoppala June 1, 2018, 10:05 a.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> As we store the intel_context on the request (rq->hw_context), we can
> simply compare that against the local intel_context for the
> i915->kernel_context rather than using the rq->gem_context.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 81f086397d10..94e4db1870aa 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -610,7 +610,7 @@ static bool engine_has_kernel_context_barrier(struct intel_engine_cs *engine)
>  
>  		any_active = true;
>  
> -		if (rq->gem_context == i915->kernel_context)
> +		if (rq->hw_context == ce)

We lose a little bit of readability due to that 'ce'.
But the function is compact enough so that it shows it's
nature in one eyeful. Tho you could introduce 'kec' :)

With or without,
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

>  			continue;
>  
>  		/*
> -- 
> 2.17.1
Chris Wilson June 1, 2018, 10:09 a.m. UTC | #2
Quoting Mika Kuoppala (2018-06-01 11:05:18)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > As we store the intel_context on the request (rq->hw_context), we can
> > simply compare that against the local intel_context for the
> > i915->kernel_context rather than using the rq->gem_context.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> > index 81f086397d10..94e4db1870aa 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> > @@ -610,7 +610,7 @@ static bool engine_has_kernel_context_barrier(struct intel_engine_cs *engine)
> >  
> >               any_active = true;
> >  
> > -             if (rq->gem_context == i915->kernel_context)
> > +             if (rq->hw_context == ce)
> 
> We lose a little bit of readability due to that 'ce'.
> But the function is compact enough so that it shows it's
> nature in one eyeful. Tho you could introduce 'kec' :)

kce; almost but ce is being used everywhere else so I hope the
familiarity will make it easier.

Not that ce is a great shorthand for intel_context; so if you have a
good idea for that, as I plan to make them more prevalent that would be
useful.
-Chris
Chris Wilson June 1, 2018, 12:54 p.m. UTC | #3
Quoting Chris Wilson (2018-06-01 10:40:02)
> As we store the intel_context on the request (rq->hw_context), we can
> simply compare that against the local intel_context for the
> i915->kernel_context rather than using the rq->gem_context.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Pushed the pair of switch-to-kernel-context related patches, thanks for
the review.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 81f086397d10..94e4db1870aa 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -610,7 +610,7 @@  static bool engine_has_kernel_context_barrier(struct intel_engine_cs *engine)
 
 		any_active = true;
 
-		if (rq->gem_context == i915->kernel_context)
+		if (rq->hw_context == ce)
 			continue;
 
 		/*