[Intel-gfx] [PATCH 31/55] drm/i915: Amalgamate GGTT/ppGTT vma debug list walkers

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Tue Jul 26 05:15:16 UTC 2016


On ma, 2016-07-25 at 18:32 +0100, Chris Wilson wrote:
> As we can now have multiple VMA inside the global GTT (with partial
> mappings, rotations, etc), it is no longer true that there may just be a
> single GGTT entry and so we should walk the full vma_list to count up
> the actual usage. In addition to unifying the two walkers, switch from
> multiplying the object size for each vma to summing the bound vma sizes.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 46 +++++++++++++++----------------------
>  1 file changed, 18 insertions(+), 28 deletions(-)
> 

<SNIP>

> 
> @@ -342,41 +343,30 @@ static int per_file_stats(int id, void *ptr, void *data)
>  	if (obj->base.name || obj->base.dma_buf)
>  		stats->shared += obj->base.size;
>  
> -	if (USES_FULL_PPGTT(obj->base.dev)) {
> -		list_for_each_entry(vma, &obj->vma_list, obj_link) {
> -			struct i915_hw_ppgtt *ppgtt;
> +	list_for_each_entry(vma, &obj->vma_list, obj_link) {
> +		if (!drm_mm_node_allocated(&vma->node))
> +			continue;
>  
> -			if (!drm_mm_node_allocated(&vma->node))
> -				continue;
> +		bound++;
>  
> -			if (vma->is_ggtt) {
> -				stats->global += obj->base.size;
> -				continue;
> -			}
> -
> -			ppgtt = container_of(vma->vm, struct i915_hw_ppgtt, base);
> +		if (vma->is_ggtt) {
> +			stats->global += vma->node.size;
> +		} else {
> +			struct i915_hw_ppgtt *ppgtt
> +				= container_of(vma->vm,
> +					       struct i915_hw_ppgtt,
> +					       base);

Use i915_vm_to_ppgtt(vma->vm). With that,

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list