Re: [PATCH 5/5] drm/i915: Add support for getting size of the stolen region

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 29, 2015 at 03:01:59PM +0530, ankitprasad.r.sharma@xxxxxxxxx wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@xxxxxxxxx>
> 
> This patch extends the get_aperture_ioctl to add support
> for getting total size of the stolen region and available
> size of the stolen region.
> 
> testcase: igt/gem_create_stolen
> 
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_drv.h |  6 ++++++
>  drivers/gpu/drm/i915/i915_gem.c | 15 ++++++++++++++-
>  include/uapi/drm/i915_drm.h     |  6 ++++++
>  3 files changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index a568cd1..a40b44f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3277,4 +3277,10 @@ inline static bool i915_gem_obj_is_prw_allowed(struct drm_i915_gem_object *obj)
>  	return !obj->userptr.mm;
>  }
>  
> +inline static bool i915_gem_obj_is_stolen_used(struct drm_i915_gem_object *obj)
> +{
> +	return obj->stolen && (i915_gem_obj_is_pinned(obj)
> +			       || obj->madv == I915_MADV_WILLNEED);
> +}
> +
>  #endif
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 3491bd3..ee93508 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -150,17 +150,30 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct drm_i915_gem_get_aperture *args = data;
>  	struct drm_i915_gem_object *obj;
> -	size_t pinned;
> +	size_t pinned, pinned_stolen;
>  
>  	pinned = 0;
> +	pinned_stolen = 0;
>  	mutex_lock(&dev->struct_mutex);
>  	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list)
>  		if (i915_gem_obj_is_pinned(obj))
>  			pinned += i915_gem_obj_ggtt_size(obj);
> +
> +	/* Calculating available stolen size */
> +	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list)
> +		if (i915_gem_obj_is_stolen_used(obj))
> +			pinned_stolen += i915_gem_obj_ggtt_size(obj);
> +
> +	list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list)
> +		if (i915_gem_obj_is_stolen_used(obj))
> +			pinned_stolen += i915_gem_obj_ggtt_size(obj);

Ah, here you will want to iterate over the stolen drm_mm range manager
to get an accurate count.

Could you respin this on top of
id:1422276205-8532-5-git-send-email-rodrigo.vivi@xxxxxxxxx ?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux