[Intel-gfx] [PATCH] drm/i915: Optimize the i915_gem_gtt_finish_object function

Reese, Armin C armin.c.reese at intel.com
Fri Jul 11 19:29:48 CEST 2014


Originally, the function always executes do_idling() followed by undo_idling() regardless of whether obj->has_dma_mapping is TRUE or not.  This change idles the GPU only if needed.

However, if the intention of the function is to ALWAYS idle the GPU, then my change is a mistake.
- Armin

-----Original Message-----
From: Chris Wilson [mailto:chris at chris-wilson.co.uk] 
Sent: Friday, July 11, 2014 10:20 AM
To: Reese, Armin C
Cc: intel-gfx at lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Optimize the i915_gem_gtt_finish_object function

On Fri, Jul 11, 2014 at 10:15:36AM -0700, armin.c.reese at intel.com wrote:
> From: Armin Reese <armin.c.reese at intel.com>
> 
> Signed-off-by: Armin Reese <armin.c.reese at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index afd4eef..7e2190e 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1624,18 +1624,17 @@ static void ggtt_unbind_vma(struct i915_vma 
> *vma)
>  
>  void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj)  {
> -	struct drm_device *dev = obj->base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	bool interruptible;
> -
> -	interruptible = do_idling(dev_priv);
> +	if (!obj->has_dma_mapping) {
> +		struct drm_device *dev = obj->base.dev;
> +		struct drm_i915_private *dev_priv = dev->dev_private;
> +		bool interruptible = do_idling(dev_priv);
>  
> -	if (!obj->has_dma_mapping)
>  		dma_unmap_sg(&dev->pdev->dev,
>  			     obj->pages->sgl, obj->pages->nents,
>  			     PCI_DMA_BIDIRECTIONAL);
>  
> -	undo_idling(dev_priv, interruptible);
> +		undo_idling(dev_priv, interruptible);
> +	}

Are you really beating the compiler here?
-Chris

--
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list