[09/20] drm/i915: Use intel_engine_lookup_user for probing HAS_BSD etc
diff mbox series

Message ID 20190718070024.21781-9-chris@chris-wilson.co.uk
State New
Headers show
Series
  • [01/20] drm/i915: Move aliasing_ppgtt underneath its i915_ggtt
Related show

Commit Message

Chris Wilson July 18, 2019, 7 a.m. UTC
Use the same mechanism to determine if a backend engine exists for a
uabi mapping as used internally.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Tvrtko Ursulin July 22, 2019, 12:49 p.m. UTC | #1
On 18/07/2019 08:00, Chris Wilson wrote:
> Use the same mechanism to determine if a backend engine exists for a
> uabi mapping as used internally.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/i915_drv.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index d1c3499c8e03..367bdc4689f1 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -61,6 +61,7 @@
>   
>   #include "gem/i915_gem_context.h"
>   #include "gem/i915_gem_ioctls.h"
> +#include "gt/intel_engine_user.h"
>   #include "gt/intel_gt.h"
>   #include "gt/intel_gt_pm.h"
>   #include "gt/intel_reset.h"
> @@ -371,16 +372,20 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
>   		value = dev_priv->overlay ? 1 : 0;
>   		break;
>   	case I915_PARAM_HAS_BSD:
> -		value = !!dev_priv->engine[VCS0];
> +		value = !!intel_engine_lookup_user(dev_priv,
> +						   I915_ENGINE_CLASS_VIDEO, 0);
>   		break;
>   	case I915_PARAM_HAS_BLT:
> -		value = !!dev_priv->engine[BCS0];
> +		value = !!intel_engine_lookup_user(dev_priv,
> +						   I915_ENGINE_CLASS_COPY, 0);
>   		break;
>   	case I915_PARAM_HAS_VEBOX:
> -		value = !!dev_priv->engine[VECS0];
> +		value = !!intel_engine_lookup_user(dev_priv,
> +						   I915_ENGINE_CLASS_VIDEO_ENHANCE, 0);
>   		break;
>   	case I915_PARAM_HAS_BSD2:
> -		value = !!dev_priv->engine[VCS1];
> +		value = !!intel_engine_lookup_user(dev_priv,
> +						   I915_ENGINE_CLASS_VIDEO, 1);
>   		break;
>   	case I915_PARAM_HAS_LLC:
>   		value = HAS_LLC(dev_priv);
> 

How do you see ABI semantics of these get_params - "GPU has engine X, or 
I915_EXEC_X will work"?

Regards,

Tvrtko
Chris Wilson July 22, 2019, 4:34 p.m. UTC | #2
Quoting Tvrtko Ursulin (2019-07-22 13:49:54)
> 
> On 18/07/2019 08:00, Chris Wilson wrote:
> > Use the same mechanism to determine if a backend engine exists for a
> > uabi mapping as used internally.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >   drivers/gpu/drm/i915/i915_drv.c | 13 +++++++++----
> >   1 file changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index d1c3499c8e03..367bdc4689f1 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -61,6 +61,7 @@
> >   
> >   #include "gem/i915_gem_context.h"
> >   #include "gem/i915_gem_ioctls.h"
> > +#include "gt/intel_engine_user.h"
> >   #include "gt/intel_gt.h"
> >   #include "gt/intel_gt_pm.h"
> >   #include "gt/intel_reset.h"
> > @@ -371,16 +372,20 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
> >               value = dev_priv->overlay ? 1 : 0;
> >               break;
> >       case I915_PARAM_HAS_BSD:
> > -             value = !!dev_priv->engine[VCS0];
> > +             value = !!intel_engine_lookup_user(dev_priv,
> > +                                                I915_ENGINE_CLASS_VIDEO, 0);
> >               break;
> >       case I915_PARAM_HAS_BLT:
> > -             value = !!dev_priv->engine[BCS0];
> > +             value = !!intel_engine_lookup_user(dev_priv,
> > +                                                I915_ENGINE_CLASS_COPY, 0);
> >               break;
> >       case I915_PARAM_HAS_VEBOX:
> > -             value = !!dev_priv->engine[VECS0];
> > +             value = !!intel_engine_lookup_user(dev_priv,
> > +                                                I915_ENGINE_CLASS_VIDEO_ENHANCE, 0);
> >               break;
> >       case I915_PARAM_HAS_BSD2:
> > -             value = !!dev_priv->engine[VCS1];
> > +             value = !!intel_engine_lookup_user(dev_priv,
> > +                                                I915_ENGINE_CLASS_VIDEO, 1);
> >               break;
> >       case I915_PARAM_HAS_LLC:
> >               value = HAS_LLC(dev_priv);
> > 
> 
> How do you see ABI semantics of these get_params - "GPU has engine X, or 
> I915_EXEC_X will work"?

I wish they never existed. I don't think we want to be any more
prescriptive than:

	if !HAS_foo: then I915_EXEC_foo (no ctx->engines[]) returns -EINVAL

so I think there's a link here with whatever default_engines() becomes.
May be best to punt these next to default_engines so we can try and keep
them in sync.
-Chris

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index d1c3499c8e03..367bdc4689f1 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -61,6 +61,7 @@ 
 
 #include "gem/i915_gem_context.h"
 #include "gem/i915_gem_ioctls.h"
+#include "gt/intel_engine_user.h"
 #include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_reset.h"
@@ -371,16 +372,20 @@  static int i915_getparam_ioctl(struct drm_device *dev, void *data,
 		value = dev_priv->overlay ? 1 : 0;
 		break;
 	case I915_PARAM_HAS_BSD:
-		value = !!dev_priv->engine[VCS0];
+		value = !!intel_engine_lookup_user(dev_priv,
+						   I915_ENGINE_CLASS_VIDEO, 0);
 		break;
 	case I915_PARAM_HAS_BLT:
-		value = !!dev_priv->engine[BCS0];
+		value = !!intel_engine_lookup_user(dev_priv,
+						   I915_ENGINE_CLASS_COPY, 0);
 		break;
 	case I915_PARAM_HAS_VEBOX:
-		value = !!dev_priv->engine[VECS0];
+		value = !!intel_engine_lookup_user(dev_priv,
+						   I915_ENGINE_CLASS_VIDEO_ENHANCE, 0);
 		break;
 	case I915_PARAM_HAS_BSD2:
-		value = !!dev_priv->engine[VCS1];
+		value = !!intel_engine_lookup_user(dev_priv,
+						   I915_ENGINE_CLASS_VIDEO, 1);
 		break;
 	case I915_PARAM_HAS_LLC:
 		value = HAS_LLC(dev_priv);