libdrm: drmCheckModesettingSupported: Fix for FreeBSD

Remove some useless busid rewritting.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
main
Emmanuel Vadot 2020-01-21 18:41:38 +01:00 committed by Emmanuel Vadot
parent 13c9de39a6
commit 24e68525dc
1 changed files with 2 additions and 10 deletions

View File

@ -800,19 +800,11 @@ drm_public int drmCheckModesettingSupported(const char *busid)
if (found)
return 0;
#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
char kbusid[1024], sbusid[1024];
char sbusid[1024];
char oid[128];
int domain, bus, dev, func;
int i, modesetting, ret;
size_t len;
ret = sscanf(busid, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev,
&func);
if (ret != 4)
return -EINVAL;
snprintf(kbusid, sizeof(kbusid), "pci:%04x:%02x:%02x.%d", domain, bus,
dev, func);
/* How many GPUs do we expect in the machine ? */
for (i = 0; i < 16; i++) {
snprintf(oid, sizeof(oid), "hw.dri.%d.busid", i);
@ -823,7 +815,7 @@ drm_public int drmCheckModesettingSupported(const char *busid)
continue;
return -EINVAL;
}
if (strcmp(sbusid, kbusid) != 0)
if (strcmp(sbusid, busid) != 0)
continue;
snprintf(oid, sizeof(oid), "hw.dri.%d.modesetting", i);
len = sizeof(modesetting);