[PATCH i-g-t 2/3] skl_ddb_allocation: Add checks on the DDB entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Damien Lespiau <damien.lespiau@xxxxxxxxx>
---
 tests/skl_ddb_allocation.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/tests/skl_ddb_allocation.c b/tests/skl_ddb_allocation.c
index 7faed0e..ba5f8ba 100644
--- a/tests/skl_ddb_allocation.c
+++ b/tests/skl_ddb_allocation.c
@@ -277,11 +277,38 @@ skl_allocate_pipe_ddb(struct drm_crtc *crtc,
 
 }
 
+static void skl_ddb_check_entry(struct skl_ddb_entry *entry, int16_t *cursor)
+{
+
+	if (skl_ddb_entry_size(entry) == 0)
+		return;
+
+	/* check that ->start is the next available block */
+	if (entry->start <= *cursor)
+		printf("error: allocation overlaps previous block\n");
+	else if (entry->start > *cursor + 1)
+		printf("warning: allocation leaves a hole\n");
+
+	*cursor = entry->end;
+}
+
+static void skl_ddb_check_last_allocation(int16_t cursor)
+{
+	uint16_t last_offset = SKL_DDB_SIZE - 1 - 4;
+
+	if (cursor < last_offset)
+		printf("warning: %d blocks not allocated\n",
+		       last_offset - cursor);
+	else if (cursor > last_offset)
+		printf("error: allocation greater than available space\n");
+}
+
 static void skl_ddb_print(struct skl_ddb_allocation *ddb)
 {
 	struct skl_ddb_entry *entry;
 	enum pipe pipe;
 	int plane;
+	int16_t cursor = -1;
 
 	printf("%-15s%8s%8s%8s\n", "", "Start", "End", "Size");
 
@@ -290,17 +317,22 @@ static void skl_ddb_print(struct skl_ddb_allocation *ddb)
 
 		for_each_plane(pipe, plane) {
 			entry = &ddb->plane[pipe][plane];
+
 			printf("  Plane%-8d%8u%8u%8u\n", plane + 1,
 			       entry->start, entry->end,
 			       skl_ddb_entry_size(entry));
+
+			skl_ddb_check_entry(entry, &cursor);
 		}
 
 		entry = &ddb->cursor[pipe];
 		printf("  %-13s%8u%8u%8u\n", "Cursor", entry->start,
 		       entry->end, skl_ddb_entry_size(entry));
-	}
 
+		skl_ddb_check_entry(entry, &cursor);
+	}
 
+	skl_ddb_check_last_allocation(cursor);
 }
 
 static struct drm_device drm_device;
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux