[igt-dev] [PATCH i-g-t 16/36] i915/gem_userptr_blits: Nuke custom main function
Petri Latvala
petri.latvala at intel.com
Thu May 23 12:27:07 UTC 2019
The buffer count parameter, previously gotten from argv[1], is now the
parameter -c.
Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
tests/i915/gem_userptr_blits.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 8f8ddf43..1373f160 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -1776,13 +1776,25 @@ uint64_t total_ram;
uint64_t aperture_size;
int fd, 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;
+}
-int main(int argc, char **argv)
+const char *help_str = " -c\tBuffer count\n";
+
+igt_main_args("c:", NULL, help_str, opt_handler, NULL)
{
int size = sizeof(linear);
- igt_subtest_init(argc, argv);
-
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_assert(fd >= 0);
@@ -1793,8 +1805,6 @@ int main(int argc, char **argv)
aperture_size = gem_aperture_size(fd);
igt_info("Aperture size is %lu MiB\n", (long)(aperture_size / (1024*1024)));
- if (argc > 1)
- count = atoi(argv[1]);
if (count == 0)
count = 2 * aperture_size / (1024*1024) / 3;
@@ -2044,6 +2054,4 @@ int main(int argc, char **argv)
igt_subtest("access-control")
test_access_control(fd);
-
- igt_exit();
}
--
2.19.1
More information about the igt-dev
mailing list