public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: tim.gore@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: thomas.wood@intel.com
Subject: [PATCH i-g-t] tests/gem_render_linear_blits: split into two subtests
Date: Tue, 17 Feb 2015 11:40:17 +0000	[thread overview]
Message-ID: <1424173217-9188-1-git-send-email-tim.gore@intel.com> (raw)

From: Tim Gore <tim.gore@intel.com>

The gem_render_linear_blits test tends to get oom killed
on low memory (< 4GB) Android systems. This is because the
test tries to allocate (sysinfo.totalram * 9 / 10) in
buffer objects and the remaining 10% of memory is not
always enough for the Android system.
After a discussion with Chris Wilson I have split this
test into a "basic" and an "apperture-thrash" subtest,
in the same way as gem_linear_blits. The basic test
uses just two buffer objects and the apperture-thrash
test is skipped if there is insuffiecient memory.

Signed-off-by: Tim Gore <tim.gore@intel.com>
---
 tests/gem_render_linear_blits.c | 55 ++++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 25 deletions(-)

diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index 60ba831..3a548d3 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -80,18 +80,14 @@ check_bo(int fd, uint32_t handle, uint32_t val)
 	}
 }
 
-int main(int argc, char **argv)
+static void run_test (int fd, int count)
 {
 	drm_intel_bufmgr *bufmgr;
 	struct intel_batchbuffer *batch;
 	uint32_t *start_val;
 	drm_intel_bo **bo;
 	uint32_t start = 0;
-	int i, j, fd, count;
-
-	igt_simple_init(argc, argv);
-
-	fd = drm_open_any();
+	int i, j;
 
 	render_copy = igt_get_render_copyfunc(intel_get_drm_devid(fd));
 	igt_require(render_copy);
@@ -99,24 +95,6 @@ int main(int argc, char **argv)
 	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
 
-	count = 0;
-	if (igt_run_in_simulation())
-		count = 2;
-	if (argc > 1)
-		count = atoi(argv[1]);
-
-	if (count == 0)
-		count = 3 * gem_aperture_size(fd) / SIZE / 2;
-	else if (count < 2) {
-		igt_warn("count must be >= 2\n");
-		return 1;
-	}
-
-	if (count > intel_get_total_ram_mb() * 9 / 10) {
-		count = intel_get_total_ram_mb() * 9 / 10;
-		igt_info("not enough RAM to run test, reducing buffer count\n");
-	}
-
 	bo = malloc(sizeof(*bo)*count);
 	start_val = malloc(sizeof(*start_val)*count);
 
@@ -153,7 +131,7 @@ int main(int argc, char **argv)
 		check_bo(fd, bo[i]->handle, start_val[i]);
 
 	if (igt_run_in_simulation())
-		return 0;
+		return;
 
 	igt_info("Cyclic blits, backward...\n");
 	for (i = 0; i < count * 4; i++) {
@@ -200,5 +178,32 @@ int main(int argc, char **argv)
 	for (i = 0; i < count; i++)
 		check_bo(fd, bo[i]->handle, start_val[i]);
 
+	intel_batchbuffer_free(batch);
+	drm_intel_bufmgr_destroy(bufmgr);
+}
+
+int main(int argc, char **argv)
+{
+	static int fd = 0;
+	int count=0;
+
+	igt_subtest_init(argc, argv);
+	igt_fixture {
+		fd = drm_open_any();
+	}
+
+	igt_subtest("basic") {
+		run_test(fd, 2);
+	}
+
+	igt_subtest("apperture-thrash") {
+		if (argc > 1)
+			count = atoi(argv[1]);
+		if (count == 0)
+			count = 3 * gem_aperture_size(fd) / SIZE / 2;
+		igt_require(count > 1);
+		intel_require_memory(count, SIZE, CHECK_RAM);
+		run_test(fd, count);
+	}
 	igt_exit();
 }
-- 
2.3.0

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

             reply	other threads:[~2015-02-17 11:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17 11:40 tim.gore [this message]
2015-02-18 10:45 ` [PATCH i-g-t] tests/gem_render_linear_blits: split into two subtests Chris Wilson
2015-02-18 11:01   ` David Weinehall
2015-02-23  9:25   ` Gore, Tim
2015-02-23 11:46     ` Chris Wilson

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=1424173217-9188-1-git-send-email-tim.gore@intel.com \
    --to=tim.gore@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thomas.wood@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