mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-20 21:02:59 +00:00
lib: Add a user data pointer to the argument parsing functions
It can be useful to have one of those to carry state between the handler parsing the options and the rest of the test. Right now the only thing we can do is to use global variables for that. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
@@ -120,7 +120,7 @@ static void *work(void *arg)
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
static int opt_handler(int opt, int opt_index)
|
||||
static int opt_handler(int opt, int opt_index, void *data)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'i':
|
||||
@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
|
||||
int i;
|
||||
|
||||
igt_simple_init_parse_opts(&argc, argv, "i:c:n:mu", NULL, NULL,
|
||||
opt_handler);
|
||||
opt_handler, NULL);
|
||||
|
||||
fd = drm_open_any_render();
|
||||
devid = intel_get_drm_devid(fd);
|
||||
|
||||
@@ -120,7 +120,7 @@ scratch_buf_check(data_t *data, struct igt_buf *buf, int x, int y,
|
||||
color, val, x, y);
|
||||
}
|
||||
|
||||
static int opt_handler(int opt, int opt_index)
|
||||
static int opt_handler(int opt, int opt_index, void *data)
|
||||
{
|
||||
if (opt == 'd') {
|
||||
opt_dump_png = true;
|
||||
@@ -141,7 +141,8 @@ int main(int argc, char **argv)
|
||||
igt_render_copyfunc_t render_copy = NULL;
|
||||
int opt_dump_aub = igt_aub_dump_enabled();
|
||||
|
||||
igt_simple_init_parse_opts(&argc, argv, "da", NULL, NULL, opt_handler);
|
||||
igt_simple_init_parse_opts(&argc, argv, "da", NULL, NULL,
|
||||
opt_handler, NULL);
|
||||
|
||||
igt_fixture {
|
||||
data.drm_fd = drm_open_any_render();
|
||||
|
||||
@@ -434,7 +434,7 @@ static void background_run_once(void)
|
||||
sleep(3);
|
||||
}
|
||||
|
||||
static int parse_options(int opt, int opt_index)
|
||||
static int parse_options(int opt, int opt_index, void *data)
|
||||
{
|
||||
switch(opt) {
|
||||
case 'b':
|
||||
@@ -504,7 +504,7 @@ int main(int argc, char **argv)
|
||||
options.buffers = 10;
|
||||
|
||||
igt_simple_init_parse_opts(&argc, argv, "n:bvt:dp:ri:", long_options,
|
||||
help, parse_options);
|
||||
help, parse_options, NULL);
|
||||
|
||||
card_index = drm_get_card();
|
||||
|
||||
|
||||
+2
-2
@@ -624,7 +624,7 @@ static void sanitize_tiles_per_buf(void)
|
||||
options.tiles_per_buf = options.scratch_buf_size / TILE_BYTES(options.tile_size);
|
||||
}
|
||||
|
||||
static int parse_options(int opt, int opt_index)
|
||||
static int parse_options(int opt, int opt_index, void *data)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
@@ -855,7 +855,7 @@ int main(int argc, char **argv)
|
||||
options.check_render_cpyfn = 0;
|
||||
|
||||
igt_simple_init_parse_opts(&argc, argv,"ds:g:c:t:rbuxmo:fp:",
|
||||
long_options, NULL, parse_options);
|
||||
long_options, NULL, parse_options, NULL);
|
||||
|
||||
drm_fd = drm_open_any();
|
||||
devid = intel_get_drm_devid(drm_fd);
|
||||
|
||||
@@ -537,7 +537,7 @@ static void dpms_off_on(data_t data)
|
||||
DRM_MODE_DPMS_ON);
|
||||
}
|
||||
|
||||
static int opt_handler(int opt, int opt_index)
|
||||
static int opt_handler(int opt, int opt_index, void *data)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
@@ -562,7 +562,7 @@ int main(int argc, char *argv[])
|
||||
enum operations op;
|
||||
|
||||
igt_subtest_init_parse_opts(&argc, argv, "", long_options,
|
||||
help_str, opt_handler);
|
||||
help_str, opt_handler, NULL);
|
||||
igt_skip_on_simulation();
|
||||
|
||||
igt_fixture {
|
||||
|
||||
+2
-2
@@ -662,7 +662,7 @@ static void run_test(const struct test_config *tconf)
|
||||
test_combinations(tconf, connector_num);
|
||||
}
|
||||
|
||||
static int opt_handler(int opt, int opt_index)
|
||||
static int opt_handler(int opt, int opt_index, void *data)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
@@ -700,7 +700,7 @@ int main(int argc, char **argv)
|
||||
int ret;
|
||||
|
||||
ret = igt_subtest_init_parse_opts(&argc, argv, "dt:", NULL, help_str,
|
||||
opt_handler);
|
||||
opt_handler, NULL);
|
||||
if (ret < 0)
|
||||
return ret == -1 ? 0 : ret;
|
||||
|
||||
|
||||
+2
-2
@@ -1791,7 +1791,7 @@ static void fences_subtest(bool dpms)
|
||||
int rounds = 40;
|
||||
bool stay = false;
|
||||
|
||||
static int opt_handler(int opt, int opt_index)
|
||||
static int opt_handler(int opt, int opt_index, void *data)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'q':
|
||||
@@ -1819,7 +1819,7 @@ int main(int argc, char *argv[])
|
||||
};
|
||||
|
||||
igt_subtest_init_parse_opts(&argc, argv, "", long_options,
|
||||
help_str, opt_handler);
|
||||
help_str, opt_handler, NULL);
|
||||
|
||||
/* Skip instead of failing in case the machine is not prepared to reach
|
||||
* PC8+. We don't want bug reports from cases where the machine is just
|
||||
|
||||
Reference in New Issue
Block a user