[Mesa-dev] [PATCH shaderdb] run: -p option accepts hex format pci-id
Dongwon Kim
dongwon.kim at intel.com
Thu Mar 15 00:49:35 UTC 2018
-p option now takes hex format pci-id of target architecture.
Signed-off-by: Dongwon Kim <dongwon.kim at intel.com>
---
run.c | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/run.c b/run.c
index 69e64c7..3db97ec 100644
--- a/run.c
+++ b/run.c
@@ -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 <platform name "\
+ "or pci-id in hex format(e.g. 0x1234)>] <directories and *.shader_test files>\n",
prog_name);
}
@@ -456,6 +457,7 @@ main(int argc, char **argv)
break;
case 'p': {
const struct platform *platform = NULL;
+
for (unsigned i = 0; i < ARRAY_SIZE(platforms); i++) {
if (strcasecmp(optarg, platforms[i].name) == 0) {
platform = platforms + i;
@@ -463,17 +465,30 @@ 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;
+ if (optarg[0] == '0' && optarg[1] == 'x') {
+ /* check if rest of given string indicates hex number */
+ if (strtol(optarg, NULL, 16) > 0) {
+ setenv("INTEL_DEVID_OVERRIDE", optarg, 1);
+ printf("### Compiling for GEN arch with 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);
--
2.16.2
More information about the mesa-dev
mailing list