All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak Rawat <drawat@vmware.com>
To: dri-devel@lists.freedesktop.org, linux-graphics-maintainer@vmware.com
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Deepak Rawat <drawat@vmware.com>,
	alexandru-cosmin.gheorghe@arm.com
Subject: [PATCH v2 1/2] drm/selftest: Refactor drm mode setting selftests
Date: Tue, 16 Oct 2018 13:46:08 -0700	[thread overview]
Message-ID: <20181016204609.1555-1-drawat@vmware.com> (raw)

With this patch split the kernel module specific code from actual
selftest code. This is done to allow adding more selftests as separate
file. Also added kernel module exit stub with this patch.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: alexandru-cosmin.gheorghe@arm.com
Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/selftests/Makefile            |  4 ++-
 ...lftests.h => drm_plane_helper_selftests.h} |  0
 .../drm/selftests/test-drm_modeset_common.c   | 23 ++++++++++++++
 .../drm/selftests/test-drm_modeset_common.h   | 18 +++++++++++
 ...t-drm-helper.c => test-drm_plane_helper.c} | 31 ++++++-------------
 5 files changed, 54 insertions(+), 22 deletions(-)
 rename drivers/gpu/drm/selftests/{drm_helper_selftests.h => drm_plane_helper_selftests.h} (100%)
 create mode 100644 drivers/gpu/drm/selftests/test-drm_modeset_common.c
 create mode 100644 drivers/gpu/drm/selftests/test-drm_modeset_common.h
 rename drivers/gpu/drm/selftests/{test-drm-helper.c => test-drm_plane_helper.c} (93%)

diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/selftests/Makefile
index 9fc349fa18e9..7e6581921da0 100644
--- a/drivers/gpu/drm/selftests/Makefile
+++ b/drivers/gpu/drm/selftests/Makefile
@@ -1 +1,3 @@
-obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm-helper.o
+test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o
+
+obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o
diff --git a/drivers/gpu/drm/selftests/drm_helper_selftests.h b/drivers/gpu/drm/selftests/drm_plane_helper_selftests.h
similarity index 100%
rename from drivers/gpu/drm/selftests/drm_helper_selftests.h
rename to drivers/gpu/drm/selftests/drm_plane_helper_selftests.h
diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.c b/drivers/gpu/drm/selftests/test-drm_modeset_common.c
new file mode 100644
index 000000000000..fad5209043f1
--- /dev/null
+++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.c
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Common file for modeset selftests.
+ */
+
+#include <linux/module.h>
+
+#include "test-drm_modeset_common.h"
+
+static int __init test_drm_modeset_init(void)
+{
+	return test_drm_plane_helper();
+}
+
+static void __exit test_drm_modeset_exit(void)
+{
+}
+
+module_init(test_drm_modeset_init);
+module_exit(test_drm_modeset_exit);
+
+MODULE_AUTHOR("Intel Corporation");
+MODULE_LICENSE("GPL");
diff --git a/drivers/gpu/drm/selftests/test-drm_modeset_common.h b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
new file mode 100644
index 000000000000..bdeba264661f
--- /dev/null
+++ b/drivers/gpu/drm/selftests/test-drm_modeset_common.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __TEST_DRM_MODESET_COMMON_H__
+#define __TEST_DRM_MODESET_COMMON_H__
+
+#define FAIL(test, msg, ...) \
+	do { \
+		if (test) { \
+			pr_err("%s/%u: " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+			return -EINVAL; \
+		} \
+	} while (0)
+
+#define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
+
+int test_drm_plane_helper(void);
+
+#endif
diff --git a/drivers/gpu/drm/selftests/test-drm-helper.c b/drivers/gpu/drm/selftests/test-drm_plane_helper.c
similarity index 93%
rename from drivers/gpu/drm/selftests/test-drm-helper.c
rename to drivers/gpu/drm/selftests/test-drm_plane_helper.c
index a015712b43e8..0dad2f812a27 100644
--- a/drivers/gpu/drm/selftests/test-drm-helper.c
+++ b/drivers/gpu/drm/selftests/test-drm_plane_helper.c
@@ -1,27 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Test cases for the drm_kms_helper functions
+ * Test cases for the drm_plane_helper functions
  */
 
-#define pr_fmt(fmt) "drm_kms_helper: " fmt
-
-#include <linux/module.h>
+#define pr_fmt(fmt) "drm_plane_helper: " fmt
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_modes.h>
 
-#define TESTS "drm_helper_selftests.h"
-#include "drm_selftest.h"
-
-#define FAIL(test, msg, ...) \
-	do { \
-		if (test) { \
-			pr_err("%s/%u: " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
-			return -EINVAL; \
-		} \
-	} while (0)
+#include "test-drm_modeset_common.h"
 
-#define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
+#define TESTS "drm_plane_helper_selftests.h"
+#include "drm_selftest.h"
 
 static void set_src(struct drm_plane_state *plane_state,
 		    unsigned src_x, unsigned src_y,
@@ -232,7 +223,10 @@ static int igt_check_plane_state(void *ignored)
 
 #include "drm_selftest.c"
 
-static int __init test_drm_helper_init(void)
+/**
+ * test_drm_plane_helper - Run drm plane helper selftests.
+ */
+int test_drm_plane_helper(void)
 {
 	int err;
 
@@ -240,8 +234,3 @@ static int __init test_drm_helper_init(void)
 
 	return err > 0 ? 0 : err;
 }
-
-module_init(test_drm_helper_init);
-
-MODULE_AUTHOR("Intel Corporation");
-MODULE_LICENSE("GPL");
-- 
2.17.1

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

             reply	other threads:[~2018-10-16 20:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 20:46 Deepak Rawat [this message]
2018-10-16 20:46 ` [PATCH v2 2/2] drm/selftest: Add drm damage helper selftest Deepak Rawat
2018-10-17  6:40   ` Daniel Vetter
2018-10-18 13:32     ` Deepak Singh Rawat
2018-10-19  9:21       ` Alexandru-Cosmin Gheorghe
2018-10-19  9:28         ` Daniel Vetter
2018-10-20 13:27         ` Deepak Singh Rawat
2018-10-22  9:21           ` Alexandru-Cosmin Gheorghe
2018-10-17  7:38 ` [PATCH v2 1/2] drm/selftest: Refactor drm mode setting selftests Daniel Vetter

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=20181016204609.1555-1-drawat@vmware.com \
    --to=drawat@vmware.com \
    --cc=alexandru-cosmin.gheorghe@arm.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-graphics-maintainer@vmware.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.