[Intel-gfx] [PATCH] drm/i915: Simplify i915_gem_release_all_mmaps()

Daniel Vetter daniel at ffwll.ch
Mon Jun 16 19:52:27 CEST 2014


On Mon, Jun 16, 2014 at 08:57:44AM +0100, Chris Wilson wrote:
> An object can only have an active gtt mapping if it is currently bound
> into the global gtt. Therefore we can simply walk the list of all bound
> objects and check the flag upon those for an active gtt mapping.
> 
> From commit 48018a57a8f5900e7e53ffaa0adeb784095accfb
> Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Date:   Fri Dec 13 15:22:31 2013 -0200
> 
>     drm/i915: release the GTT mmaps when going into D3
> 
> Also note that the WARN is inappropriate for this function as GPU
> activity is orthogonal to GTT mmap status. Rather it is the caller that
> relies upon this condition and so it should assert that the GPU is idle
> itself.
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=80081
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi at gmail.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Tested-by: Paulo Zanoni <paulo.r.zanoni at intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 25 +++++++++----------------
>  1 file changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 1d7893c982a8..f671216031e7 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1862,22 +1862,6 @@ out:
>  	return ret;
>  }
>  
> -void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv)
> -{
> -	struct i915_vma *vma;
> -
> -	/*
> -	 * Only the global gtt is relevant for gtt memory mappings, so restrict
> -	 * list traversal to objects bound into the global address space. Note
> -	 * that the active list should be empty, but better safe than sorry.
> -	 */
> -	WARN_ON(!list_empty(&dev_priv->gtt.base.active_list));
> -	list_for_each_entry(vma, &dev_priv->gtt.base.active_list, mm_list)
> -		i915_gem_release_mmap(vma->obj);
> -	list_for_each_entry(vma, &dev_priv->gtt.base.inactive_list, mm_list)
> -		i915_gem_release_mmap(vma->obj);
> -}
> -
>  /**
>   * i915_gem_release_mmap - remove physical page mappings
>   * @obj: obj in question
> @@ -1903,6 +1887,15 @@ i915_gem_release_mmap(struct drm_i915_gem_object *obj)
>  	obj->fault_mappable = false;
>  }
>  
> +void
> +i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv)
> +{
> +	struct drm_i915_gem_object *obj;
> +
> +	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list)
> +		i915_gem_release_mmap(obj);
> +}
> +
>  uint32_t
>  i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode)
>  {
> -- 
> 2.0.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list