intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] drm: kselftest for drm_mm_init()
@ 2016-12-09 13:08 Chris Wilson
  2016-12-09 13:08 ` [PATCH 2/9] drm: kselftest for drm_mm_reserve_node() Chris Wilson
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Chris Wilson @ 2016-12-09 13:08 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, joonas.lahtinen

Simple first test to just exercise initialisation of struct drm_mm.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_mm_selftests.h |  1 +
 drivers/gpu/drm/test-drm_mm.c      | 41 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/drm_mm_selftests.h b/drivers/gpu/drm/drm_mm_selftests.h
index 0a2e98a33ba0..8a9166f4626f 100644
--- a/drivers/gpu/drm/drm_mm_selftests.h
+++ b/drivers/gpu/drm/drm_mm_selftests.h
@@ -5,4 +5,5 @@
  *
  * Tests are executed in reverse order by igt/drm_mm
  */
+selftest(init, igt_init)
 selftest(sanitycheck, igt_sanitycheck) /* keep last */
diff --git a/drivers/gpu/drm/test-drm_mm.c b/drivers/gpu/drm/test-drm_mm.c
index 049f36b38868..d89615987303 100644
--- a/drivers/gpu/drm/test-drm_mm.c
+++ b/drivers/gpu/drm/test-drm_mm.c
@@ -20,6 +20,47 @@ static int igt_sanitycheck(void *ignored)
 	return 0;
 }
 
+static int igt_init(void *ignored)
+{
+	struct drm_mm mm;
+	struct drm_mm_node *hole;
+	struct drm_mm_node tmp;
+	u64 start, end;
+	int ret = -EINVAL;
+
+	memset(&mm, 0xff, sizeof(mm));
+	drm_mm_init(&mm, 0, 4096);
+	if (!drm_mm_clean(&mm)) {
+		pr_err("mm not empty on creation\n");
+		goto out;
+	}
+
+	drm_mm_for_each_hole(hole, &mm, start, end) {
+		if (start != 0 || end != 4096) {
+			pr_err("empty mm has incorrect hole, found (%llx, %llx), expect (%llx, %llx)\n",
+			       start, end,
+			       0ull, 4096ull);
+			goto out;
+		}
+	}
+
+	memset(&tmp, 0, sizeof(tmp));
+	tmp.start = 0;
+	tmp.size = 4096;
+	ret = drm_mm_reserve_node(&mm, &tmp);
+	if (ret) {
+		pr_err("failed to reserve whole drm_mm\n");
+		goto out;
+	}
+	drm_mm_remove_node(&tmp);
+
+out:
+	if (ret)
+		drm_mm_debug_table(&mm, __func__);
+	drm_mm_takedown(&mm);
+	return ret;
+}
+
 #include "drm_selftest.c"
 
 static int __init test_drm_mm_init(void)
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-12-09 16:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-09 13:08 [PATCH 1/9] drm: kselftest for drm_mm_init() Chris Wilson
2016-12-09 13:08 ` [PATCH 2/9] drm: kselftest for drm_mm_reserve_node() Chris Wilson
2016-12-09 14:31   ` Joonas Lahtinen
2016-12-09 14:43     ` Chris Wilson
2016-12-09 13:08 ` [PATCH 3/9] drm: kselftest for drm_mm_insert_node() Chris Wilson
2016-12-09 13:08 ` [PATCH 4/9] drm: kselftest for drm_mm_insert_node_in_range() Chris Wilson
2016-12-09 13:08 ` [PATCH 5/9] drm: kselftest for drm_mm and alignment Chris Wilson
2016-12-09 16:14   ` Joonas Lahtinen
2016-12-09 13:08 ` [PATCH 6/9] drm: kselftest for drm_mm and eviction Chris Wilson
2016-12-09 13:08 ` [PATCH 7/9] drm: kselftest for drm_mm and top-down allocation Chris Wilson
2016-12-09 13:08 ` [PATCH 8/9] drm: kselftest for drm_mm and top-down alignment Chris Wilson
2016-12-09 15:41   ` Joonas Lahtinen
2016-12-09 13:08 ` [PATCH 9/9] drm: kselftest for drm_mm and color adjustment Chris Wilson
2016-12-09 13:46 ` [PATCH 1/9] drm: kselftest for drm_mm_init() Joonas Lahtinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).