Commit 1d5ad989 authored by Dongwon Kim's avatar Dongwon Kim Committed by Kenneth Graunke

run: Make -p option accept numeric PCI IDs

This patch makes the -p option accept a numeric PCI ID (i.e. 0x1234)
as well as the existing shorthand names.

v2 (changes by Kenneth Graunke):
- Allow -p to accept any number, not just hex.
- Don't mention "GEN arch" - this tool is used for non-Intel GPUs too
- Minor formatting
Signed-off-by: 's avatarDongwon Kim <dongwon.kim@intel.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
parent 8d3ad52d
......@@ -356,7 +356,8 @@ const struct platform platforms[] = {
void print_usage(const char *prog_name)
{
fprintf(stderr,
"Usage: %s [-d <device>] [-j <max_threads>] [-o <driver>] [-p <platform>] <directories and *.shader_test files>\n",
"Usage: %s [-d <device>] [-j <max_threads>] [-o <driver>] [-p <pci"
" id or platform name> <directories and *.shader_test files>\n",
prog_name);
}
......@@ -463,17 +464,27 @@ main(int argc, char **argv)
}
}
if (platform == NULL) {
fprintf(stderr, "Invalid platform.\nValid platforms are:");
for (unsigned i = 0; i < ARRAY_SIZE(platforms); i++)
fprintf(stderr, " %s", platforms[i].name);
fprintf(stderr, "\n");
return -1;
if (platform) {
printf("### Compiling for %s(PCI_ID=%s) ###\n", platform->name,
platform->pci_id);
setenv("INTEL_DEVID_OVERRIDE", platform->pci_id, 1);
break;
}
printf("### Compiling for %s ###\n", platform->name);
setenv("INTEL_DEVID_OVERRIDE", platform->pci_id, 1);
break;
/* Also allow a numeric PCI ID */
if (strtol(optarg, NULL, 0) > 0) {
setenv("INTEL_DEVID_OVERRIDE", optarg, 1);
printf("### Compiling for PCI_ID=%s ###\n", optarg);
break;
}
fprintf(stderr, "Invalid platform.\nValid platforms are:");
for (unsigned i = 0; i < ARRAY_SIZE(platforms); i++)
fprintf(stderr, " %s", platforms[i].name);
fprintf(stderr, "\n");
fprintf(stderr, "Or\nPCI-ID of other supported platform.\n");
return -1;
}
case 'j':
max_threads = atoi(optarg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment