Note that radeonsi can override the GPU family for which shaders are compiled with an environment variable (SI_FORCE_FAMILY). Maybe you could achieve even more than what this patch does in a similar way.

This option is fine as well of course.

Reviewed-by: Nicolai Hähnle <[email protected]>

On 12.09.2016 23:27, Samuel Pitoiset wrote:
When multiple GPUs are plugged in the same box, we might want to
use /dev/dri/renderD129 without updating/compiling the code. This
doesn't change the existing behaviour.
---
 run.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/run.c b/run.c
index c7f0be6..408049f 100644
--- a/run.c
+++ b/run.c
@@ -301,7 +301,7 @@ const struct platform platforms[] = {
 void print_usage(const char *prog_name)
 {
     fprintf(stderr,
-            "Usage: %s [-p <platform>] <directories and *.shader_test files>\n"
+            "Usage: %s [-d <device>] [-p <platform>] <directories and *.shader_test 
files>\n"
             "Other options: \n"
             " -1    Disable multi-threading\n",
             prog_name);
@@ -323,12 +323,24 @@ static void addenv(const char *name, const char *value)
 int
 main(int argc, char **argv)
 {
+    char device_path[64];
+    int device_id = 0;
     int opt;

     max_threads = omp_get_max_threads();

-    while((opt = getopt(argc, argv, "1p:")) != -1) {
+    while((opt = getopt(argc, argv, "1d:p:")) != -1) {
         switch(opt) {
+        case 'd': {
+            char *endptr;
+
+            device_id = strtol(optarg, &endptr, 10);
+            if (endptr == optarg) {
+                fprintf(stderr, "Invalid device ID.\n");
+                return -1;
+            }
+            break;
+        }
         case 'p': {
             const struct platform *platform = NULL;
             for (unsigned i = 0; i < ARRAY_SIZE(platforms); i++) {
@@ -386,9 +398,12 @@ main(int argc, char **argv)

     int ret = 0;

-    int fd = open("/dev/dri/renderD128", O_RDWR);
+    snprintf(device_path, sizeof(device_path),
+             "/dev/dri/renderD%d", device_id + 128);
+
+    int fd = open(device_path, O_RDWR);
     if (unlikely(fd < 0)) {
-        fprintf(stderr, "ERROR: Couldn't open /dev/dri/renderD128\n");
+        fprintf(stderr, "ERROR: Couldn't open %s\n", device_path);
         return -1;
     }


_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to