[Mesa-dev] [PATCH shader-db] add a new option for selecting the render node ID
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Sep 13 09:11:18 UTC 2016
On 09/13/2016 11:09 AM, Nicolai Hähnle wrote:
> 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.
Yes, that could be a good solution as well.
>
> This option is fine as well of course.
>
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Thanks!
>
> 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;
>> }
>>
>>
--
-Samuel
More information about the mesa-dev
mailing list