diff mbox

[RFC,2/2] drm/i915: Skip continguous dwords which are zeros

Message ID 1440699963-29495-2-git-send-email-arun.siluvery@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

arun.siluvery@linux.intel.com Aug. 27, 2015, 6:26 p.m. UTC
From: Peter Antoine <peter.antoine@intel.com>

To reduce the amount of data being output the dump removes continguous
zeros to try and reduce the dump size. Not all the pages of context
contain valid data so it helps to reduce dump output.

Signed-off-by: Peter Antoine <peter.antoine@intel.com>
Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 9c5c42d..11cdd2c 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1983,7 +1983,6 @@  static void i915_dump_lrc_obj(struct seq_file *m,
 	int i;
 	int j;
 	unsigned long ggtt_offset = 0;
-	int hws_page_index;
 
 	seq_printf(m, "CONTEXT: %s %u\n", ring->name,
 		   intel_execlists_ctx_id(ctx_obj));
@@ -1999,27 +1998,51 @@  static void i915_dump_lrc_obj(struct seq_file *m,
 	}
 
 	i = 0;
-	hws_page_index = LRC_PPHWSP_PN;
 	for_each_sg_page(ctx_obj->pages->sgl, &sg_iter,
 			 ctx_obj->pages->nents, 0) {
 		if (dump_type == LRC_CONTEXT_DUMP) {
-			if (i < hws_page_index) {
+			if (i < LRC_PPHWSP_PN) {
 				++i;
 				continue;
-			} else if (i > hws_page_index)
+			} else if (i > LRC_PPHWSP_PN)
 				break;
 		}
 
 		page = sg_page_iter_page(&sg_iter);
 		if (!WARN_ON(page == NULL)) {
+			int run_length = 0;
+			unsigned long page_offset = ggtt_offset + i*PAGE_SIZE;
+
 			reg_state = kmap_atomic(page);
 
+			seq_printf(m, "Context object Page: %d\n", i);
 			for (j = 0; j < PAGE_SIZE / sizeof(u32); j += 4) {
+				if (reg_state[j + 0] == 0 && reg_state[j + 1] == 0 &&
+				    reg_state[j + 2] == 0 && reg_state[j + 3] == 0) {
+					run_length += 4;
+					continue;
+				}
+
+				if (run_length > 0) {
+					seq_printf(m, "\t[0x%08lx - 0x%08lx]: 0x00000000\n",
+						   page_offset + (j * 4) - (run_length * 4),
+						   page_offset + (j * 4) - 1);
+
+					run_length = 0;
+				}
+
 				seq_printf(m, "\t[0x%08lx] 0x%08x 0x%08x 0x%08x 0x%08x\n",
-					   ggtt_offset + 4096 + (j * 4),
-					   reg_state[j], reg_state[j + 1],
+					   page_offset + (j * 4),
+					   reg_state[j + 0], reg_state[j + 1],
 					   reg_state[j + 2], reg_state[j + 3]);
 			}
+
+			if (run_length > 0) {
+				seq_printf(m, "\t[0x%08lx - 0x%08lx]: 0x00000000\n",
+					   page_offset + (j * 4) - (run_length * 4),
+					   page_offset + (j * 4) - 1);
+				run_length = 0;
+			}
 			kunmap_atomic(reg_state);
 		}
 		++i;