dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libdrm 1/2] kmstest: Use util_open()
@ 2015-12-20  5:52 Stefan Agner
  2015-12-20  5:52 ` [PATCH libdrm 2/2] tests: add fsl-dcu-drm to modules Stefan Agner
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2015-12-20  5:52 UTC (permalink / raw)
  To: dri-devel

Use the new util_open() helper instead of open-coding the method for
finding a usable device. While at it, make the command-line interface
more consistent with that of modetest by adding the -D and -M options.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 tests/kmstest/Makefile.am |  4 +++-
 tests/kmstest/main.c      | 45 +++++++++++++++++++++++++++++----------------
 2 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/tests/kmstest/Makefile.am b/tests/kmstest/Makefile.am
index fd21e61..100662e 100644
--- a/tests/kmstest/Makefile.am
+++ b/tests/kmstest/Makefile.am
@@ -2,6 +2,7 @@ AM_CFLAGS = \
 	$(WARN_CFLAGS)\
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/libkms/ \
+	-I$(top_srcdir)/tests/ \
 	-I$(top_srcdir)
 
 if HAVE_INSTALL_TESTS
@@ -17,7 +18,8 @@ kmstest_SOURCES = \
 
 kmstest_LDADD = \
 	$(top_builddir)/libdrm.la \
-	$(top_builddir)/libkms/libkms.la
+	$(top_builddir)/libkms/libkms.la \
+	$(top_builddir)/tests/util/libutil.la
 
 run: kmstest
 	./kmstest
diff --git a/tests/kmstest/main.c b/tests/kmstest/main.c
index 120bc0f..fe8f42e 100644
--- a/tests/kmstest/main.c
+++ b/tests/kmstest/main.c
@@ -25,12 +25,14 @@
  *
  **************************************************************************/
 
-
+#include <getopt.h>
 #include <stdio.h>
 #include <string.h>
 #include "xf86drm.h"
 #include "libkms.h"
 
+#include "util/kms.h"
+
 #define CHECK_RET_RETURN(ret, str) \
 	if (ret < 0) { \
 		printf("%s: %s (%s)\n", __func__, str, strerror(-ret)); \
@@ -56,26 +58,37 @@ static int test_bo(struct kms_driver *kms)
 	return 0;
 }
 
-static const char *drivers[] = {
-	"i915",
-	"radeon",
-	"nouveau",
-	"vmwgfx",
-	"exynos",
-	"amdgpu",
-	"imx-drm",
-	"rockchip",
-	"atmel-hlcdc",
-	NULL
-};
+static void usage(const char *program)
+{
+	fprintf(stderr, "Usage: %s [options]\n", program);
+	fprintf(stderr, "\n");
+	fprintf(stderr, "  -D DEVICE  open the given device\n");
+	fprintf(stderr, "  -M MODULE  open the given module\n");
+}
 
 int main(int argc, char** argv)
 {
+	static const char optstr[] = "D:M:";
 	struct kms_driver *kms;
-	int ret, fd, i;
+	int c, fd, ret;
+	char *device = NULL;
+	char *module = NULL;
+
+	while ((c = getopt(argc, argv, optstr)) != -1) {
+		switch (c) {
+		case 'D':
+			device = optarg;
+			break;
+		case 'M':
+			module = optarg;
+			break;
+		default:
+			usage(argv[0]);
+			return 0;
+		}
+	}
 
-	for (i = 0, fd = -1; fd < 0 && drivers[i]; i++)
-		fd = drmOpen(drivers[i], NULL);
+	fd = util_open(module, device);
 	CHECK_RET_RETURN(fd, "Could not open device");
 
 	ret = kms_create(fd, &kms);
-- 
2.6.4

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

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

* [PATCH libdrm 2/2] tests: add fsl-dcu-drm to modules
  2015-12-20  5:52 [PATCH libdrm 1/2] kmstest: Use util_open() Stefan Agner
@ 2015-12-20  5:52 ` Stefan Agner
  2016-01-26 20:56   ` Emil Velikov
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2015-12-20  5:52 UTC (permalink / raw)
  To: dri-devel

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 tests/util/kms.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/util/kms.c b/tests/util/kms.c
index 57b0191..dcd5a8e 100644
--- a/tests/util/kms.c
+++ b/tests/util/kms.c
@@ -139,6 +139,7 @@ static const char * const modules[] = {
 	"imx-drm",
 	"rockchip",
 	"atmel-hlcdc",
+	"fsl-dcu-drm",
 };
 
 int util_open(const char *device, const char *module)
-- 
2.6.4

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

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

* Re: [PATCH libdrm 2/2] tests: add fsl-dcu-drm to modules
  2015-12-20  5:52 ` [PATCH libdrm 2/2] tests: add fsl-dcu-drm to modules Stefan Agner
@ 2016-01-26 20:56   ` Emil Velikov
  0 siblings, 0 replies; 3+ messages in thread
From: Emil Velikov @ 2016-01-26 20:56 UTC (permalink / raw)
  To: Stefan Agner; +Cc: ML dri-devel

On 20 December 2015 at 05:52, Stefan Agner <stefan@agner.ch> wrote:
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  tests/util/kms.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/util/kms.c b/tests/util/kms.c
> index 57b0191..dcd5a8e 100644
> --- a/tests/util/kms.c
> +++ b/tests/util/kms.c
> @@ -139,6 +139,7 @@ static const char * const modules[] = {
>         "imx-drm",
>         "rockchip",
>         "atmel-hlcdc",
> +       "fsl-dcu-drm",

Thanks for the patches Stefan. I'll do a quick test and push them out shortly.
Although please take a look at adding platform device support to the
drm*Device API - if anything is unclear do ask. I won't bite :-)

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

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

end of thread, other threads:[~2016-01-26 20:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-20  5:52 [PATCH libdrm 1/2] kmstest: Use util_open() Stefan Agner
2015-12-20  5:52 ` [PATCH libdrm 2/2] tests: add fsl-dcu-drm to modules Stefan Agner
2016-01-26 20:56   ` Emil Velikov

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).