[Intel-gfx] [PATCH] drm/i915: Use the .release hook to drop the stolen drm_mm tracking

Daniel Vetter daniel at ffwll.ch
Fri Jun 6 18:30:22 CEST 2014


On Fri, Jun 06, 2014 at 10:22:54AM +0100, Chris Wilson wrote:
> Now that we have a release hook into i915_gem_object_free, we can move
> the explicit call to the internal stolen function and hook it up
> throught the callback instead.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Oh, pretty!

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

> ---
>  drivers/gpu/drm/i915/i915_drv.h        |  1 -
>  drivers/gpu/drm/i915/i915_gem.c        |  1 -
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 21 +++++++++++----------
>  3 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 580e9614e267..5f8006ecae02 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2488,7 +2488,6 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
>  					       u32 stolen_offset,
>  					       u32 gtt_offset,
>  					       u32 size);
> -void i915_gem_object_release_stolen(struct drm_i915_gem_object *obj);
>  
>  /* i915_gem_tiling.c */
>  static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj)
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 1ba0b5f5c94c..8dd7c4fb14b9 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4707,7 +4707,6 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
>  		obj->madv = I915_MADV_DONTNEED;
>  	i915_gem_object_put_pages(obj);
>  	i915_gem_object_free_mmap_offset(obj);
> -	i915_gem_object_release_stolen(obj);
>  
>  	BUG_ON(obj->pages);
>  
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 20bd839b5ef2..78fa532ea7ef 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -402,9 +402,20 @@ static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj)
>  	kfree(obj->pages);
>  }
>  
> +
> +static void
> +i915_gem_object_release_stolen(struct drm_i915_gem_object *obj)
> +{
> +	if (obj->stolen) {
> +		drm_mm_remove_node(obj->stolen);
> +		kfree(obj->stolen);
> +		obj->stolen = NULL;
> +	}
> +}
>  static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
>  	.get_pages = i915_gem_object_get_pages_stolen,
>  	.put_pages = i915_gem_object_put_pages_stolen,
> +	.release = i915_gem_object_release_stolen,
>  };
>  
>  static struct drm_i915_gem_object *
> @@ -660,13 +671,3 @@ err_out:
>  	drm_gem_object_unreference(&obj->base);
>  	return NULL;
>  }
> -
> -void
> -i915_gem_object_release_stolen(struct drm_i915_gem_object *obj)
> -{
> -	if (obj->stolen) {
> -		drm_mm_remove_node(obj->stolen);
> -		kfree(obj->stolen);
> -		obj->stolen = NULL;
> -	}
> -}
> -- 
> 2.0.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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



More information about the Intel-gfx mailing list