gpu: ion: Add better debugfs information
In debugfs, clients now show individual allocations.
Carveout heaps now give the number of bytes currently
allocated out of total possible bytes. The system heaps
just show the number of bytes currently allocated.
Change-Id: I4acfcdc1089c73c28041e09cb6b5a03b956e936a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index c37d952..930ba83 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -688,29 +688,25 @@
{
struct ion_client *client = s->private;
struct rb_node *n;
- size_t sizes[ION_NUM_HEAPS] = {0};
- const char *names[ION_NUM_HEAPS] = {0};
- int i;
+ seq_printf(s, "%16.16s: %16.16s : %16.16s : %16.16s\n", "heap_name",
+ "size_in_bytes", "handle refcount", "buffer");
mutex_lock(&client->lock);
for (n = rb_first(&client->handles); n; n = rb_next(n)) {
struct ion_handle *handle = rb_entry(n, struct ion_handle,
node);
- enum ion_heap_type type = handle->buffer->heap->type;
- if (!names[type])
- names[type] = handle->buffer->heap->name;
- sizes[type] += handle->buffer->size;
+ seq_printf(s, "%16.16s: %16u : %16d : %16p\n",
+ handle->buffer->heap->name,
+ handle->buffer->size,
+ atomic_read(&handle->ref.refcount),
+ handle->buffer);
}
+
+ seq_printf(s, "%16.16s %d\n", "client refcount:",
+ atomic_read(&client->ref.refcount));
mutex_unlock(&client->lock);
- seq_printf(s, "%16.16s: %16.16s\n", "heap_name", "size_in_bytes");
- for (i = 0; i < ION_NUM_HEAPS; i++) {
- if (!names[i])
- continue;
- seq_printf(s, "%16.16s: %16u %d\n", names[i], sizes[i],
- atomic_read(&client->ref.refcount));
- }
return 0;
}
@@ -1247,6 +1243,14 @@
seq_printf(s, "%16.s %16u %16u\n", client->name, client->pid,
size);
}
+ if (heap->ops->get_allocated) {
+ seq_printf(s, "total bytes currently allocated: %lx\n",
+ heap->ops->get_allocated(heap));
+ }
+ if (heap->ops->get_total) {
+ seq_printf(s, "total heap size: %lx\n",
+ heap->ops->get_total(heap));
+ }
return 0;
}