OSDN Git Service

libdrm: Fix issue about differrent domainID but same BDF
authorEmily Deng <Emily.Deng@amd.com>
Thu, 14 Feb 2019 07:53:38 +0000 (15:53 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 22 Feb 2019 21:02:12 +0000 (16:02 -0500)
commit56c21f877bda7b8c62c3d7925b070b5113d807f2
tree5ce2f8d4d2d92a2c2d25badc2b633fe1f86b6368
parent1592d471bba5eadc626dcdf3975d1fc07c70dfe0
libdrm: Fix issue about differrent domainID but same BDF

For multiple GPUs which has the same BDF, but has different domain ID,
the drmOpenByBusid will return the wrong fd when startx.

The reproduce sequence as below:
1. Call drmOpenByBusid to open Card0, then will return the right fd0, and the
fd0 is master privilege;
2. Call drmOpenByBusid to open Card1. In function drmOpenByBusid, it will
open Card0 first, this time, the fd1 for opening Card0 is not master
privilege, and will call drmSetInterfaceVersion to identify the
domain ID feature, as the fd1 is not master privilege, then drmSetInterfaceVersion
will fail, and then won't compare domain ID, then return the wrong fd for Card1.

Solution:
First loop search the best match fd about drm 1.4.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
xf86drm.c