Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* "Quick" mode
@ 2013-02-13 16:29 Damien Lespiau
  2013-02-13 16:29 ` [PATCH 1/2] lib: Add a way to specify values for "quick" runs Damien Lespiau
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Damien Lespiau @ 2013-02-13 16:29 UTC (permalink / raw)
  To: intel-gfx

In order to have the tests finish in a reasonable time in certain environments,
it'd be nice to have a "quick" mode that uses low loop and buffer counts.

Of course, more tests would be converted in the long run.

-- 
Damien

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

* [PATCH 1/2] lib: Add a way to specify values for "quick" runs
  2013-02-13 16:29 "Quick" mode Damien Lespiau
@ 2013-02-13 16:29 ` Damien Lespiau
  2013-02-13 16:29 ` [PATCH 2/2] tests: Add a quick variant to the gem_storedw_* tests Damien Lespiau
  2013-02-13 17:34 ` "Quick" mode Daniel Vetter
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Lespiau @ 2013-02-13 16:29 UTC (permalink / raw)
  To: intel-gfx

In some environments, we don't really want to loop 100000 times or
allocate 152352621 buffers because it makes the tests too long to run.

This adds a way to specify "quick" values to reduce the time taken by
certain tests.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 lib/drmtest.c |   22 +++++++++++++++++++++-
 lib/drmtest.h |    3 +++
 2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 8518bde..117fb31 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2007, 2011 Intel Corporation
+ * Copyright © 2007, 2011, 2013 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -37,6 +37,7 @@
 #include <pciaccess.h>
 #include <math.h>
 #include <getopt.h>
+#include <stdlib.h>
 
 #include "drmtest.h"
 #include "i915_drm.h"
@@ -573,6 +574,25 @@ bool drmtest_only_list_subtests(void)
 	return list_subtests;
 }
 
+bool drmtest_run_quick(void)
+{
+	static int run_quick = -1;
+
+	if (run_quick == -1) {
+		char *igt_quick;
+
+		igt_quick = getenv("IGT_QUICK");
+		if (!igt_quick) {
+			run_quick = 0;
+			goto out;
+		}
+
+		run_quick = atoi(igt_quick);
+	}
+out:
+	return run_quick;
+}
+
 /* other helpers */
 void drmtest_exchange_int(void *array, unsigned i, unsigned j)
 {
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 2000b70..78732a0 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -88,6 +88,9 @@ void drmtest_subtest_init(int argc, char **argv);
 bool drmtest_run_subtest(const char *subtest_name);
 bool drmtest_only_list_subtests(void);
 
+bool drmtest_run_quick(void);
+#define SLOW_QUICK(slow,quick) (drmtest_run_quick() ? (quick) : (slow))
+
 /* helpers based upon the libdrm buffer manager */
 void drmtest_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
 void drmtest_trash_aperture(void);
-- 
1.7.7.5

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

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

* [PATCH 2/2] tests: Add a quick variant to the gem_storedw_* tests
  2013-02-13 16:29 "Quick" mode Damien Lespiau
  2013-02-13 16:29 ` [PATCH 1/2] lib: Add a way to specify values for "quick" runs Damien Lespiau
@ 2013-02-13 16:29 ` Damien Lespiau
  2013-02-13 17:34 ` "Quick" mode Daniel Vetter
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Lespiau @ 2013-02-13 16:29 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 tests/gem_storedw_batches_loop.c |    2 +-
 tests/gem_storedw_loop_blt.c     |    2 +-
 tests/gem_storedw_loop_bsd.c     |    2 +-
 tests/gem_storedw_loop_render.c  |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/gem_storedw_batches_loop.c b/tests/gem_storedw_batches_loop.c
index 48490be..86c3469 100644
--- a/tests/gem_storedw_batches_loop.c
+++ b/tests/gem_storedw_batches_loop.c
@@ -60,7 +60,7 @@ store_dword_loop(int divider)
 	if (!has_ppgtt)
 		cmd |= MI_MEM_VIRTUAL;
 
-	for (i = 0; i < 0x80000; i++) {
+	for (i = 0; i < SLOW_QUICK(0x80000, 0x10); i++) {
 		cmd_bo = drm_intel_bo_alloc(bufmgr, "cmd bo", 4096, 4096);
 		if (!cmd_bo) {
 			fprintf(stderr, "failed to alloc cmd bo\n");
diff --git a/tests/gem_storedw_loop_blt.c b/tests/gem_storedw_loop_blt.c
index edf5057..cacae3a 100644
--- a/tests/gem_storedw_loop_blt.c
+++ b/tests/gem_storedw_loop_blt.c
@@ -63,7 +63,7 @@ store_dword_loop(int divider)
 	if (!has_ppgtt)
 		cmd |= MI_MEM_VIRTUAL;
 
-	for (i = 0; i < 0x100000; i++) {
+	for (i = 0; i < SLOW_QUICK(0x100000, 0x10); i++) {
 		BEGIN_BATCH(4);
 		OUT_BATCH(cmd);
 		OUT_BATCH(0); /* reserved */
diff --git a/tests/gem_storedw_loop_bsd.c b/tests/gem_storedw_loop_bsd.c
index 8d40d35..232c3a6 100644
--- a/tests/gem_storedw_loop_bsd.c
+++ b/tests/gem_storedw_loop_bsd.c
@@ -63,7 +63,7 @@ store_dword_loop(int divider)
 	if (!has_ppgtt)
 		cmd |= MI_MEM_VIRTUAL;
 
-	for (i = 0; i < 0x100000; i++) {
+	for (i = 0; i < SLOW_QUICK(0x100000, 0x10); i++) {
 		BEGIN_BATCH(4);
 		OUT_BATCH(cmd);
 		OUT_BATCH(0); /* reserved */
diff --git a/tests/gem_storedw_loop_render.c b/tests/gem_storedw_loop_render.c
index 2309432..fe09834 100644
--- a/tests/gem_storedw_loop_render.c
+++ b/tests/gem_storedw_loop_render.c
@@ -63,7 +63,7 @@ store_dword_loop(int divider)
 	if (!has_ppgtt)
 		cmd |= MI_MEM_VIRTUAL;
 
-	for (i = 0; i < 0x100000; i++) {
+	for (i = 0; i < SLOW_QUICK(0x100000, 0x10); i++) {
 		BEGIN_BATCH(4);
 		OUT_BATCH(cmd);
 		OUT_BATCH(0); /* reserved */
-- 
1.7.7.5

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

* Re: "Quick" mode
  2013-02-13 16:29 "Quick" mode Damien Lespiau
  2013-02-13 16:29 ` [PATCH 1/2] lib: Add a way to specify values for "quick" runs Damien Lespiau
  2013-02-13 16:29 ` [PATCH 2/2] tests: Add a quick variant to the gem_storedw_* tests Damien Lespiau
@ 2013-02-13 17:34 ` Daniel Vetter
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2013-02-13 17:34 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx

On Wed, Feb 13, 2013 at 04:29:00PM +0000, Damien Lespiau wrote:
> In order to have the tests finish in a reasonable time in certain environments,
> it'd be nice to have a "quick" mode that uses low loop and buffer counts.
> 
> Of course, more tests would be converted in the long run.

I like this, both patches merged.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

end of thread, other threads:[~2013-02-13 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 16:29 "Quick" mode Damien Lespiau
2013-02-13 16:29 ` [PATCH 1/2] lib: Add a way to specify values for "quick" runs Damien Lespiau
2013-02-13 16:29 ` [PATCH 2/2] tests: Add a quick variant to the gem_storedw_* tests Damien Lespiau
2013-02-13 17:34 ` "Quick" mode Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox