public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 14/36] i915/gem_stress: Nuke custom main function
Date: Thu, 23 May 2019 15:27:05 +0300	[thread overview]
Message-ID: <20190523122727.6932-14-petri.latvala@intel.com> (raw)
In-Reply-To: <20190523122727.6932-1-petri.latvala@intel.com>

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
 tests/i915/gem_stress.c | 262 ++++++++++++++++++++--------------------
 1 file changed, 130 insertions(+), 132 deletions(-)

diff --git a/tests/i915/gem_stress.c b/tests/i915/gem_stress.c
index ef8316f2..57e2909c 100644
--- a/tests/i915/gem_stress.c
+++ b/tests/i915/gem_stress.c
@@ -112,13 +112,30 @@ struct option_struct {
     int use_signal_helper;
 };
 
-struct option_struct options;
-
 #define MAX_BUFS		4096
 #define SCRATCH_BUF_SIZE	1024*1024
 #define BUSY_BUF_SIZE		(256*4096)
 #define TILE_BYTES(size)	((size)*(size)*sizeof(uint32_t))
 
+struct option_struct options = {
+	.scratch_buf_size = BUSY_BUF_SIZE,
+	.no_hw = 0,
+	.use_signal_helper = 1,
+	.gpu_busy_load = 0,
+	.num_buffers = 0,
+	.trace_tile = -1,
+	.use_render = 1,
+	.use_blt = 1,
+	.forced_tiling = -1,
+	.use_cpu_maps = 0,
+	.total_rounds = 512,
+	.fail = 1,
+	.ducttape = 1,
+	.tile_size = 16,
+	.tiles_per_buf = BUSY_BUF_SIZE / TILE_BYTES(16),
+	.check_render_cpyfn = 0,
+};
+
 static struct igt_buf buffers[2][MAX_BUFS];
 /* tile i is at logical position tile_permutation[i] */
 static unsigned *tile_permutation;
@@ -627,93 +644,95 @@ static int parse_options(int opt, int opt_index, void *data)
 	int tmp;
 
 	switch(opt) {
-		case 'd':
-			options.no_hw = 1;
-			igt_info("no-hw debug mode\n");
-			break;
-		case 'S':
-			options.use_signal_helper = 0;
-			igt_info("disabling that pesky nuisance who keeps interrupting us\n");
-			break;
-		case 's':
-			tmp = atoi(optarg);
-			if (tmp < options.tile_size*8192)
-				igt_info("scratch buffer size needs to be at least %i\n", options.tile_size * 8192);
-			else if (tmp & (tmp - 1)) {
-				igt_info("scratch buffer size needs to be a power-of-two\n");
-			} else {
-				igt_info("fixed scratch buffer size to %u\n", tmp);
-				options.scratch_buf_size = tmp;
-				sanitize_tiles_per_buf();
-			}
-			break;
-		case 'g':
-			tmp = atoi(optarg);
-			if (tmp < 0 || tmp > 10)
-				igt_info("gpu busy load needs to be bigger than 0 and smaller than 10\n");
-			else {
-				igt_info("gpu busy load factor set to %i\n", tmp);
-				gpu_busy_load = options.gpu_busy_load = tmp;
-			}
-			break;
-		case 'c':
-			options.num_buffers = atoi(optarg);
-			igt_info("buffer count set to %i\n", options.num_buffers);
-			break;
-		case 't':
-			options.trace_tile = atoi(optarg);
-			igt_info("tracing tile %i\n", options.trace_tile);
-			break;
-		case 'r':
-			options.use_render = 0;
-			igt_info("disabling render copy\n");
-			break;
-		case 'b':
-			options.use_blt = 0;
-			igt_info("disabling blt copy\n");
-			break;
-		case 'u':
-			options.forced_tiling = I915_TILING_NONE;
-			igt_info("disabling tiling\n");
-			break;
-		case 'x':
-			if (options.use_cpu_maps) {
-				igt_info("tiling not possible with cpu maps\n");
-			} else {
-				options.forced_tiling = I915_TILING_X;
-				igt_info("using only X-tiling\n");
-			}
-			break;
-		case 'm':
-			options.use_cpu_maps = 1;
-			options.forced_tiling = I915_TILING_NONE;
-			igt_info("disabling tiling\n");
-			break;
-		case 'o':
-			options.total_rounds = atoi(optarg);
-			igt_info("total rounds %i\n", options.total_rounds);
-			break;
-		case 'f':
-			options.fail = 0;
-			igt_info("not failing when detecting errors\n");
-			break;
-		case 'p':
-			options.tiles_per_buf = atoi(optarg);
-			igt_info("tiles per buffer %i\n", options.tiles_per_buf);
-			break;
-		case DUCTAPE:
-			options.ducttape = 0;
-			igt_info("applying duct-tape\n");
-			break;
-		case TILESZ:
-			options.tile_size = atoi(optarg);
+	case 'd':
+		options.no_hw = 1;
+		igt_info("no-hw debug mode\n");
+		break;
+	case 'S':
+		options.use_signal_helper = 0;
+		igt_info("disabling that pesky nuisance who keeps interrupting us\n");
+		break;
+	case 's':
+		tmp = atoi(optarg);
+		if (tmp < options.tile_size*8192)
+			igt_info("scratch buffer size needs to be at least %i\n", options.tile_size * 8192);
+		else if (tmp & (tmp - 1)) {
+			igt_info("scratch buffer size needs to be a power-of-two\n");
+		} else {
+			igt_info("fixed scratch buffer size to %u\n", tmp);
+			options.scratch_buf_size = tmp;
 			sanitize_tiles_per_buf();
-			igt_info("til size %i\n", options.tile_size);
-			break;
-		case CHCK_RENDER:
-			options.check_render_cpyfn = 1;
-			igt_info("checking render copy function\n");
-			break;
+		}
+		break;
+	case 'g':
+		tmp = atoi(optarg);
+		if (tmp < 0 || tmp > 10)
+			igt_info("gpu busy load needs to be bigger than 0 and smaller than 10\n");
+		else {
+			igt_info("gpu busy load factor set to %i\n", tmp);
+			gpu_busy_load = options.gpu_busy_load = tmp;
+		}
+		break;
+	case 'c':
+		options.num_buffers = atoi(optarg);
+		igt_info("buffer count set to %i\n", options.num_buffers);
+		break;
+	case 't':
+		options.trace_tile = atoi(optarg);
+		igt_info("tracing tile %i\n", options.trace_tile);
+		break;
+	case 'r':
+		options.use_render = 0;
+		igt_info("disabling render copy\n");
+		break;
+	case 'b':
+		options.use_blt = 0;
+		igt_info("disabling blt copy\n");
+		break;
+	case 'u':
+		options.forced_tiling = I915_TILING_NONE;
+		igt_info("disabling tiling\n");
+		break;
+	case 'x':
+		if (options.use_cpu_maps) {
+			igt_info("tiling not possible with cpu maps\n");
+		} else {
+			options.forced_tiling = I915_TILING_X;
+			igt_info("using only X-tiling\n");
+		}
+		break;
+	case 'm':
+		options.use_cpu_maps = 1;
+		options.forced_tiling = I915_TILING_NONE;
+		igt_info("disabling tiling\n");
+		break;
+	case 'o':
+		options.total_rounds = atoi(optarg);
+		igt_info("total rounds %i\n", options.total_rounds);
+		break;
+	case 'f':
+		options.fail = 0;
+		igt_info("not failing when detecting errors\n");
+		break;
+	case 'p':
+		options.tiles_per_buf = atoi(optarg);
+		igt_info("tiles per buffer %i\n", options.tiles_per_buf);
+		break;
+	case DUCTAPE:
+		options.ducttape = 0;
+		igt_info("applying duct-tape\n");
+		break;
+	case TILESZ:
+		options.tile_size = atoi(optarg);
+		sanitize_tiles_per_buf();
+		igt_info("til size %i\n", options.tile_size);
+		break;
+	case CHCK_RENDER:
+		options.check_render_cpyfn = 1;
+		igt_info("checking render copy function\n");
+		break;
+	default:
+		return IGT_OPT_HANDLER_ERROR;
 	}
 
 	/* actually 32767, according to docs, but that kills our nice pot calculations. */
@@ -726,7 +745,7 @@ static int parse_options(int opt, int opt_index, void *data)
 	}
 	igt_info("Limiting buffer to %dx%d\n", options.max_dimension, options.max_dimension);
 
-	return 0;
+	return IGT_OPT_HANDLER_SUCCESS;
 }
 
 static void init(void)
@@ -809,51 +828,32 @@ static void check_render_copyfunc(void)
 	}
 }
 
+static struct option long_options[] = {
+	{"no-hw", 0, 0, 'd'},
+	{"buf-size", 1, 0, 's'},
+	{"gpu-busy-load", 1, 0, 'g'},
+	{"no-signals", 0, 0, 'S'},
+	{"buffer-count", 1, 0, 'c'},
+	{"trace-tile", 1, 0, 't'},
+	{"disable-blt", 0, 0, 'b'},
+	{"disable-render", 0, 0, 'r'},
+	{"untiled", 0, 0, 'u'},
+	{"x-tiled", 0, 0, 'x'},
+	{"use-cpu-maps", 0, 0, 'm'},
+	{"rounds", 1, 0, 'o'},
+	{"no-fail", 0, 0, 'f'},
+	{"tiles-per-buf", 0, 0, 'p'},
+	{"remove-duct-tape", 0, 0, DUCTAPE},
+	{"tile-size", 1, 0, TILESZ},
+	{"check-render-cpyfn", 0, 0, CHCK_RENDER},
+	{NULL, 0, 0, 0},
+};
 
-int main(int argc, char **argv)
+igt_simple_main_args("ds:g:c:t:rbuxmo:fp:",
+		     long_options, NULL, parse_options, NULL)
 {
 	int i, j;
 	unsigned *current_permutation, *tmp_permutation;
-	static struct option long_options[] = {
-		{"no-hw", 0, 0, 'd'},
-		{"buf-size", 1, 0, 's'},
-		{"gpu-busy-load", 1, 0, 'g'},
-		{"no-signals", 0, 0, 'S'},
-		{"buffer-count", 1, 0, 'c'},
-		{"trace-tile", 1, 0, 't'},
-		{"disable-blt", 0, 0, 'b'},
-		{"disable-render", 0, 0, 'r'},
-		{"untiled", 0, 0, 'u'},
-		{"x-tiled", 0, 0, 'x'},
-		{"use-cpu-maps", 0, 0, 'm'},
-		{"rounds", 1, 0, 'o'},
-		{"no-fail", 0, 0, 'f'},
-		{"tiles-per-buf", 0, 0, 'p'},
-		{"remove-duct-tape", 0, 0, DUCTAPE},
-		{"tile-size", 1, 0, TILESZ},
-		{"check-render-cpyfn", 0, 0, CHCK_RENDER},
-		{NULL, 0, 0, 0},
-	};
-
-	options.scratch_buf_size = 256*4096;
-	options.no_hw = 0;
-	options.use_signal_helper = 1;
-	options.gpu_busy_load = 0;
-	options.num_buffers = 0;
-	options.trace_tile = -1;
-	options.use_render = 1;
-	options.use_blt = 1;
-	options.forced_tiling = -1;
-	options.use_cpu_maps = 0;
-	options.total_rounds = 512;
-	options.fail = 1;
-	options.ducttape = 1;
-	options.tile_size = 16;
-	options.tiles_per_buf = options.scratch_buf_size / TILE_BYTES(options.tile_size);
-	options.check_render_cpyfn = 0;
-
-	igt_simple_init_parse_opts(&argc, argv,"ds:g:c:t:rbuxmo:fp:",
-				   long_options, NULL, parse_options, NULL);
 
 	drm_fd = drm_open_driver(DRIVER_INTEL);
 	devid = intel_get_drm_devid(drm_fd);
@@ -910,6 +910,4 @@ int main(int argc, char **argv)
 	close(drm_fd);
 
 	igt_stop_signal_helper();
-
-	igt_exit();
 }
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-05-23 12:27 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 12:26 [igt-dev] [PATCH i-g-t 01/36] lib: Introduce main function macros with custom args Petri Latvala
2019-05-23 12:26 ` [igt-dev] [PATCH i-g-t 02/36] lib: Document igt_opt_handler_t semantics Petri Latvala
2019-05-23 12:26 ` [igt-dev] [PATCH i-g-t 03/36] i915/gem_exec_blt: Nuke custom main function Petri Latvala
2019-05-23 12:26 ` [igt-dev] [PATCH i-g-t 04/36] i915/gem_gtt_speed: " Petri Latvala
2019-05-23 12:26 ` [igt-dev] [PATCH i-g-t 05/36] i915/gem_hang: " Petri Latvala
2019-05-23 12:26 ` [igt-dev] [PATCH i-g-t 06/36] i915/gem_linear_blits: " Petri Latvala
2019-05-23 12:26 ` [igt-dev] [PATCH i-g-t 07/36] i915/gem_ppgtt: " Petri Latvala
2019-05-23 12:26 ` [igt-dev] [PATCH i-g-t 08/36] i915/gem_pread: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 09/36] i915/gem_pwrite: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 10/36] i915/gem_pwrite_pread: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 11/36] i915/gem_render_copy: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 12/36] i915/gem_render_copy_redux: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 13/36] i915/gem_request_retire: " Petri Latvala
2019-05-23 12:27 ` Petri Latvala [this message]
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 15/36] i915/gem_tiled_blits: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 16/36] i915/gem_userptr_blits: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 17/36] i915/gen3_mixed_blits: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 18/36] i915/gen3_render_linear_blits: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 19/36] i915/gen3_render_mixed_blits: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 20/36] i915/gen3_render_tiledx_blits: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 21/36] i915/gen3_render_tiledy_blits: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 22/36] i915/i915_pm_rpm: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 23/36] kms_concurrent: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 24/36] kms_cursor_edge_walk: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 25/36] kms_flip: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 26/36] kms_force_connector_basic: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 27/36] kms_frontbuffer_tracking: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 28/36] kms_mmap_write_crc: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 29/36] kms_plane_multiple: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 30/36] kms_psr2_su: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 31/36] kms_psr: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 32/36] kms_setmode: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 33/36] kms_tv_load_detect: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 34/36] prime_mmap_coherency: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 35/36] testdisplay: " Petri Latvala
2019-05-23 12:27 ` [igt-dev] [PATCH i-g-t 36/36] tests: Remove redundant igt_exit() calls Petri Latvala
2019-05-23 14:29 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/36] lib: Introduce main function macros with custom args Patchwork
2019-05-24 13:50 ` [igt-dev] [PATCH i-g-t 01/36] " Arkadiusz Hiler
2019-05-24 18:14   ` Daniel Vetter
2019-05-24 18:26 ` Hiatt, Don
2019-05-24 19:38 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,01/36] " Patchwork

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=20190523122727.6932-14-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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