summaryrefslogtreecommitdiff
path: root/tests/i915/gen3_render_mixed_blits.c
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2019-05-23 15:27:10 +0300
committerPetri Latvala <petri.latvala@intel.com>2019-05-27 12:47:43 +0300
commit2cd5adb5fd166852a45aa70580570e93c2266213 (patch)
treef071de1a866b712fb1b3690cb1f36c4135845b40 /tests/i915/gen3_render_mixed_blits.c
parentc5d59aab7a9277c1dbff3308446f7ba17f5cefd6 (diff)
i915/gen3_render_mixed_blits: Nuke custom main function
The buffer count parameter, previously gotten from argv[1], is now the parameter -c. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'tests/i915/gen3_render_mixed_blits.c')
-rw-r--r--tests/i915/gen3_render_mixed_blits.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/tests/i915/gen3_render_mixed_blits.c b/tests/i915/gen3_render_mixed_blits.c
index 6dd7392b..15895c21 100644
--- a/tests/i915/gen3_render_mixed_blits.c
+++ b/tests/i915/gen3_render_mixed_blits.c
@@ -336,21 +336,33 @@ check_bo(int fd, uint32_t handle, uint32_t val)
munmap(v, WIDTH*HEIGHT*4);
}
-int main(int argc, char **argv)
+int count;
+
+static int opt_handler(int opt, int opt_index, void *data)
+{
+ switch (opt) {
+ case 'c':
+ count = atoi(optarg);
+ break;
+ default:
+ return IGT_OPT_HANDLER_ERROR;
+ }
+
+ return IGT_OPT_HANDLER_SUCCESS;
+}
+
+const char *help_str = " -c\tBuffer count\n";
+
+igt_simple_main_args("c:", NULL, help_str, opt_handler, NULL)
{
uint32_t *handle, *tiling, *start_val;
uint32_t start = 0;
- int i, fd, count;
-
- igt_simple_init(argc, argv);
+ int i, fd;
fd = drm_open_driver(DRIVER_INTEL);
igt_require(IS_GEN3(intel_get_drm_devid(fd)));
- count = 0;
- if (argc > 1)
- count = atoi(argv[1]);
if (count == 0)
count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
igt_info("Using %d 1MiB buffers\n", count);
@@ -412,6 +424,4 @@ int main(int argc, char **argv)
for (i = 0; i < count; i++)
check_bo(fd, handle[i], start_val[i]);
igt_info("done\n");
-
- igt_exit();
}