diff mbox

Patch to show debugfs output for every heap->id instead of heap->type

Message ID CAD0L9vY_19BUaBB0SZSn2Ha1bRhMDaxSb-7Ou+Tm8u82uL6_3A@mail.gmail.com
State New
Headers show

Commit Message

Nishanth Peethambaran Aug. 28, 2012, 2:46 a.m. UTC
Hi,

ION debugfs currently shows/groups output based on type.
But, it is possible to have multiple heaps of the same type - for CMA
and carveout types.
It is more useful to get usage information for individual heaps.

 - Nishanth Peethambaran


From fa819b42fb69321a8e5db260ba9fd8ce7a2f16d2 Mon Sep 17 00:00:00 2001
From: Nishanth Peethambaran <nishanth@broadcom.com>
Date: Tue, 28 Aug 2012 07:57:37 +0530
Subject: [PATCH] gpu: ion: Update debugfs to show for each id

Update the debugfs read of client and heap to show
based on 'id' instead of 'type'.
Multiple heaps of the same type can be present, but
id is unique.
---
 drivers/gpu/ion/ion.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)


@@ -1121,7 +1121,7 @@ static const struct file_operations ion_fops = {
 };

 static size_t ion_debug_heap_total(struct ion_client *client,
-				   enum ion_heap_type type)
+				   int id)
 {
 	size_t size = 0;
 	struct rb_node *n;
@@ -1131,7 +1131,7 @@ static size_t ion_debug_heap_total(struct
ion_client *client,
 		struct ion_handle *handle = rb_entry(n,
 						     struct ion_handle,
 						     node);
-		if (handle->buffer->heap->type == type)
+		if (handle->buffer->heap->id == id)
 			size += handle->buffer->size;
 	}
 	mutex_unlock(&client->lock);
@@ -1149,7 +1149,7 @@ static int ion_debug_heap_show(struct seq_file
*s, void *unused)
 	for (n = rb_first(&dev->clients); n; n = rb_next(n)) {
 		struct ion_client *client = rb_entry(n, struct ion_client,
 						     node);
-		size_t size = ion_debug_heap_total(client, heap->type);
+		size_t size = ion_debug_heap_total(client, heap->id);
 		if (!size)
 			continue;
 		if (client->task) {
diff mbox

Patch

diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index 34c12df..65cedee 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -547,11 +547,11 @@  static int ion_debug_client_show(struct seq_file
*s, void *unused)
 	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;
+		int id = handle->buffer->heap->id;

-		if (!names[type])
-			names[type] = handle->buffer->heap->name;
-		sizes[type] += handle->buffer->size;
+		if (!names[id])
+			names[id] = handle->buffer->heap->name;
+		sizes[id] += handle->buffer->size;
 	}
 	mutex_unlock(&client->lock);