[Intel-gfx] [PATCH 06/31] drm/i915: Use engine to refer to the user's BSD intel_engine_cs

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Mon Jul 25 08:42:19 UTC 2016


On ma, 2016-07-25 at 08:44 +0100, Chris Wilson wrote:
> This patch transitions the execbuf engine selection away from using the
> ring nomenclature - though we still refer to the user's incoming
> selector as their user_ring_id.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_drv.h            |  4 ++--
>  drivers/gpu/drm/i915/i915_gem.c            |  2 +-
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 15 ++++++++-------
>  3 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index d4c5c2edf252..b686b741ea87 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -402,7 +402,7 @@ struct drm_i915_file_private {
>  		unsigned boosts;
>  	} rps;
>  
> -	unsigned int bsd_ring;
> +	unsigned int bsd_engine;
>  };
>  
>  /* Used by dp and fdi links */
> @@ -1331,7 +1331,7 @@ struct i915_gem_mm {
>  	bool interruptible;
>  
>  	/* the indicator for dispatch video commands on two BSD rings */
> -	unsigned int bsd_ring_dispatch_index;
> +	unsigned int bsd_engine_dispatch_index;
>  
>  	/** Bit 6 swizzling required for X tiling */
>  	uint32_t bit_6_swizzle_x;
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 3730aecc1eae..e155e8dd28ed 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4782,7 +4782,7 @@ int i915_gem_open(struct drm_device *dev, struct drm_file *file)
>  	spin_lock_init(&file_priv->mm.lock);
>  	INIT_LIST_HEAD(&file_priv->mm.request_list);
>  
> -	file_priv->bsd_ring = -1;
> +	file_priv->bsd_engine = -1;
>  
>  	ret = i915_gem_context_open(dev, file);
>  	if (ret)
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index f8d8ae39fc2f..9ef68e86b483 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -1351,23 +1351,24 @@ i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params,
>  
>  /**
>   * Find one BSD ring to dispatch the corresponding BSD command.
> - * The ring index is returned.
> + * The engine index is returned.
>   */
>  static unsigned int
> -gen8_dispatch_bsd_ring(struct drm_i915_private *dev_priv, struct drm_file *file)
> +gen8_dispatch_bsd_engine(struct drm_i915_private *dev_priv,
> +			 struct drm_file *file)
>  {
>  	struct drm_i915_file_private *file_priv = file->driver_priv;
>  
>  	/* Check whether the file_priv has already selected one ring. */
> -	if ((int)file_priv->bsd_ring < 0) {
> +	if ((int)file_priv->bsd_engine < 0) {
>  		/* If not, use the ping-pong mechanism to select one. */
>  		mutex_lock(&dev_priv->drm.struct_mutex);
> -		file_priv->bsd_ring = dev_priv->mm.bsd_ring_dispatch_index;
> -		dev_priv->mm.bsd_ring_dispatch_index ^= 1;
> +		file_priv->bsd_engine = dev_priv->mm.bsd_engine_dispatch_index;
> +		dev_priv->mm.bsd_engine_dispatch_index ^= 1;
>  		mutex_unlock(&dev_priv->drm.struct_mutex);
>  	}
>  
> -	return file_priv->bsd_ring;
> +	return file_priv->bsd_engine;
>  }
>  
>  #define I915_USER_RINGS (4)
> @@ -1404,7 +1405,7 @@ eb_select_engine(struct drm_i915_private *dev_priv,
>  		unsigned int bsd_idx = args->flags & I915_EXEC_BSD_MASK;
>  
>  		if (bsd_idx == I915_EXEC_BSD_DEFAULT) {
> -			bsd_idx = gen8_dispatch_bsd_ring(dev_priv, file);
> +			bsd_idx = gen8_dispatch_bsd_engine(dev_priv, file);
>  		} else if (bsd_idx >= I915_EXEC_BSD_RING1 &&
>  			   bsd_idx <= I915_EXEC_BSD_RING2) {
>  			bsd_idx >>= I915_EXEC_BSD_SHIFT;
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list