From 83a836765432dbc88b972588fb678aff17979a35 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 29 Jan 2012 13:49:08 +1100 Subject: [PATCH] Linux's ADL uses a busnumber in descending order for devices so enumerate them in the opposite order to windows. --- adl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/adl.c b/adl.c index 49bcd6b4..a2c6efee 100644 --- a/adl.c +++ b/adl.c @@ -238,13 +238,20 @@ void init_adl(int nDevs) } } + /* Windows has some kind of random ordering for bus number IDs and + * ordering the GPUs according to ascending order fixes it. Linux + * has usually sequential but decreasing order instead! */ for (i = 0; i < devices; i++) { int j, virtual_gpu = 0; for (j = 0; j < devices; j++) { if (i == j) continue; +#ifdef WIN32 if (adapters[j].iBusNumber < adapters[i].iBusNumber) +#else + if (adapters[j].iBusNumber > adapters[i].iBusNumber) +#endif virtual_gpu++; } vadapters[virtual_gpu].virtual_gpu = i;