aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQiang Yu2016-06-06 11:29:16 -0500
committerAlex Deucher2016-06-06 11:29:16 -0500
commit70b64073f7d1bf56a30f7a809bd984d3ad688b9f (patch)
tree4ada527261de7ef82d2b725d75b9d93fa5f69c70 /xf86drm.c
parent361d0a88981628f0f20440262f02bfa3e175fa8b (diff)
downloadexternal-libgbm-70b64073f7d1bf56a30f7a809bd984d3ad688b9f.tar.gz
external-libgbm-70b64073f7d1bf56a30f7a809bd984d3ad688b9f.tar.xz
external-libgbm-70b64073f7d1bf56a30f7a809bd984d3ad688b9f.zip
drm: fix multi GPU drmGetDevices only return one device
When multi GPU present, after drmFoldDuplicatedDevices merge same busid deveces, two different devices may be seperated by zero in local_devices[]. The for loop should check all local_devices instead of exit when meet a zero. Reviewed-by: Jim Qu <Jim.Qu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Diffstat (limited to 'xf86drm.c')
-rw-r--r--xf86drm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xf86drm.c b/xf86drm.c
index 45aa5fc9..4fdcaf8f 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3267,7 +3267,10 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices)
3267 drmFoldDuplicatedDevices(local_devices, node_count); 3267 drmFoldDuplicatedDevices(local_devices, node_count);
3268 3268
3269 device_count = 0; 3269 device_count = 0;
3270 for (i = 0; i < node_count && local_devices[i]; i++) { 3270 for (i = 0; i < node_count; i++) {
3271 if (!local_devices[i])
3272 continue;
3273
3271 if ((devices != NULL) && (device_count < max_devices)) 3274 if ((devices != NULL) && (device_count < max_devices))
3272 devices[device_count] = local_devices[i]; 3275 devices[device_count] = local_devices[i];
3273 else 3276 else