intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, joonas.lahtinen@linux.intel.com
Subject: [PATCH 1/9] drm: kselftest for drm_mm_init()
Date: Fri,  9 Dec 2016 13:08:17 +0000	[thread overview]
Message-ID: <20161209130825.6854-1-chris@chris-wilson.co.uk> (raw)

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

             reply	other threads:[~2016-12-09 13:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09 13:08 Chris Wilson [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161209130825.6854-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).