[Intel-gfx] [PATCH v5 13/35] drm/i915: Redirect execbuffer_final() via scheduler

Jesse Barnes jbarnes at virtuousgeek.org
Fri Feb 19 19:33:30 UTC 2016


On 02/18/2016 06:27 AM, John.C.Harrison at Intel.com wrote:
> From: John Harrison <John.C.Harrison at Intel.com>
> 
> Updated the execbuffer() code to pass the packaged up batch buffer
> information to the scheduler rather than calling execbuffer_final()
> directly. The scheduler queue() code is currently a stub which simply
> chains on to _final() immediately.
> 
> For: VIZ-1587
> Signed-off-by: John Harrison <John.C.Harrison at Intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 18 +++++++-----------
>  drivers/gpu/drm/i915/intel_lrc.c           | 12 ++++--------
>  2 files changed, 11 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 7978dae..09c5ce9 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -33,6 +33,7 @@
>  #include "intel_drv.h"
>  #include <linux/dma_remapping.h>
>  #include <linux/uaccess.h>
> +#include "i915_scheduler.h"
>  
>  #define  __EXEC_OBJECT_HAS_PIN (1<<31)
>  #define  __EXEC_OBJECT_HAS_FENCE (1<<30)
> @@ -1226,6 +1227,7 @@ i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params,
>  			       struct drm_i915_gem_execbuffer2 *args,
>  			       struct list_head *vmas)
>  {
> +	struct i915_scheduler_queue_entry *qe;
>  	struct drm_device *dev = params->dev;
>  	struct intel_engine_cs *ring = params->ring;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -1270,17 +1272,11 @@ i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params,
>  
>  	i915_gem_execbuffer_move_to_active(vmas, params->request);
>  
> -	ret = dev_priv->gt.execbuf_final(params);
> +	qe = container_of(params, typeof(*qe), params);
> +	ret = i915_scheduler_queue_execbuffer(qe);
>  	if (ret)
>  		return ret;
>  
> -	/*
> -	 * Free everything that was stored in the QE structure (until the
> -	 * scheduler arrives and does it instead):
> -	 */
> -	if (params->dispatch_flags & I915_DISPATCH_SECURE)
> -		i915_gem_execbuff_release_batch_obj(params->batch_obj);
> -
>  	return 0;
>  }
>  
> @@ -1420,8 +1416,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
>  	struct intel_engine_cs *ring;
>  	struct intel_context *ctx;
>  	struct i915_address_space *vm;
> -	struct i915_execbuffer_params params_master; /* XXX: will be removed later */
> -	struct i915_execbuffer_params *params = &params_master;
> +	struct i915_scheduler_queue_entry qe;
> +	struct i915_execbuffer_params *params = &qe.params;
>  	const u32 ctx_id = i915_execbuffer2_get_context_id(*args);
>  	u32 dispatch_flags;
>  	int ret;
> @@ -1529,7 +1525,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
>  	else
>  		vm = &dev_priv->gtt.base;
>  
> -	memset(&params_master, 0x00, sizeof(params_master));
> +	memset(&qe, 0x00, sizeof(qe));
>  
>  	eb = eb_create(args);
>  	if (eb == NULL) {
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 12e8949..ff4565f 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -136,6 +136,7 @@
>  #include <drm/i915_drm.h>
>  #include "i915_drv.h"
>  #include "intel_mocs.h"
> +#include "i915_scheduler.h"
>  
>  #define GEN9_LR_CONTEXT_RENDER_SIZE (22 * PAGE_SIZE)
>  #define GEN8_LR_CONTEXT_RENDER_SIZE (20 * PAGE_SIZE)
> @@ -910,6 +911,7 @@ int intel_execlists_submission(struct i915_execbuffer_params *params,
>  			       struct drm_i915_gem_execbuffer2 *args,
>  			       struct list_head *vmas)
>  {
> +	struct i915_scheduler_queue_entry *qe;
>  	struct drm_device       *dev = params->dev;
>  	struct intel_engine_cs  *ring = params->ring;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -952,17 +954,11 @@ int intel_execlists_submission(struct i915_execbuffer_params *params,
>  
>  	i915_gem_execbuffer_move_to_active(vmas, params->request);
>  
> -	ret = dev_priv->gt.execbuf_final(params);
> +	qe = container_of(params, typeof(*qe), params);
> +	ret = i915_scheduler_queue_execbuffer(qe);
>  	if (ret)
>  		return ret;
>  
> -	/*
> -	 * Free everything that was stored in the QE structure (until the
> -	 * scheduler arrives and does it instead):
> -	 */
> -	if (params->dispatch_flags & I915_DISPATCH_SECURE)
> -		i915_gem_execbuff_release_batch_obj(params->batch_obj);
> -
>  	return 0;
>  }
>  
> 

I think this is ok, but might need changes if some of the earlier patches see changes due to Joonas's reviews.

Reviewed-by: Jesse Barnes <jbarnes at virtuousgeek.org>


More information about the Intel-gfx mailing list