Commit 894eeecc authored by Chris Wilson's avatar Chris Wilson

drm/i915: Amalgamate GGTT/ppGTT vma debug list walkers

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: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470293567-10811-1-git-send-email-chris@chris-wilson.co.uk
parent 8dac1e1f
...@@ -335,6 +335,7 @@ static int per_file_stats(int id, void *ptr, void *data) ...@@ -335,6 +335,7 @@ static int per_file_stats(int id, void *ptr, void *data)
struct drm_i915_gem_object *obj = ptr; struct drm_i915_gem_object *obj = ptr;
struct file_stats *stats = data; struct file_stats *stats = data;
struct i915_vma *vma; struct i915_vma *vma;
int bound = 0;
stats->count++; stats->count++;
stats->total += obj->base.size; stats->total += obj->base.size;
...@@ -342,41 +343,28 @@ static int per_file_stats(int id, void *ptr, void *data) ...@@ -342,41 +343,28 @@ static int per_file_stats(int id, void *ptr, void *data)
if (obj->base.name || obj->base.dma_buf) if (obj->base.name || obj->base.dma_buf)
stats->shared += obj->base.size; stats->shared += obj->base.size;
if (USES_FULL_PPGTT(obj->base.dev)) { list_for_each_entry(vma, &obj->vma_list, obj_link) {
list_for_each_entry(vma, &obj->vma_list, obj_link) { if (!drm_mm_node_allocated(&vma->node))
struct i915_hw_ppgtt *ppgtt; continue;
if (!drm_mm_node_allocated(&vma->node)) bound++;
continue;
if (vma->is_ggtt) { if (vma->is_ggtt) {
stats->global += obj->base.size; stats->global += vma->node.size;
continue; } else {
} struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vma->vm);
ppgtt = container_of(vma->vm, struct i915_hw_ppgtt, base);
if (ppgtt->file_priv != stats->file_priv) if (ppgtt->file_priv != stats->file_priv)
continue; continue;
if (obj->active) /* XXX per-vma statistic */
stats->active += obj->base.size;
else
stats->inactive += obj->base.size;
return 0;
}
} else {
if (i915_gem_obj_ggtt_bound(obj)) {
stats->global += obj->base.size;
if (obj->active)
stats->active += obj->base.size;
else
stats->inactive += obj->base.size;
return 0;
} }
if (obj->active) /* XXX per-vma statistic */
stats->active += vma->node.size;
else
stats->inactive += vma->node.size;
} }
if (!list_empty(&obj->global_list)) if (!bound)
stats->unbound += obj->base.size; stats->unbound += obj->base.size;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment