kms: remove commented out libudev code

Cc: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
main
Emil Velikov 2016-11-30 18:39:07 +00:00
parent 0c80fddd1d
commit 9b05d40399
2 changed files with 0 additions and 98 deletions

View File

@ -10,10 +10,6 @@ libkms_ladir = $(libdir)
libkms_la_LDFLAGS = -version-number 1:0:0 -no-undefined
libkms_la_LIBADD = ../libdrm.la
#if HAVE_LIBUDEV
#libkms_la_LIBADD += $(LIBUDEV_LIBS)
#endif
libkms_la_SOURCES = $(LIBKMS_FILES)
if HAVE_VMWGFX

View File

@ -141,105 +141,11 @@ linux_from_sysfs(int fd, struct kms_driver **out)
return ret;
}
#if 0
#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
#include <libudev.h>
struct create_record
{
unsigned vendor;
unsigned chip;
int (*func)(int fd, struct kms_driver **out);
};
static const struct create_record table[] = {
{ 0x8086, 0x2a42, intel_create }, /* i965 */
#ifdef HAVE_VMWGFX
{ 0x15ad, 0x0405, vmwgfx_create }, /* VMware vGPU */
#endif
{ 0, 0, NULL },
};
static int
linux_get_pciid_from_fd(int fd, unsigned *vendor_id, unsigned *chip_id)
{
struct udev *udev;
struct udev_device *device;
struct udev_device *parent;
const char *pci_id;
struct stat buffer;
int ret;
ret = fstat(fd, &buffer);
if (ret)
return -EINVAL;
if (!S_ISCHR(buffer.st_mode))
return -EINVAL;
udev = udev_new();
if (!udev)
return -ENOMEM;
device = udev_device_new_from_devnum(udev, 'c', buffer.st_rdev);
if (!device)
goto err_free_udev;
parent = udev_device_get_parent(device);
if (!parent)
goto err_free_device;
pci_id = udev_device_get_property_value(parent, "PCI_ID");
if (!pci_id)
goto err_free_device;
if (sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2)
goto err_free_device;
udev_device_unref(device);
udev_unref(udev);
return 0;
err_free_device:
udev_device_unref(device);
err_free_udev:
udev_unref(udev);
return -EINVAL;
}
static int
linux_from_udev(int fd, struct kms_driver **out)
{
unsigned vendor_id, chip_id;
int ret, i;
ret = linux_get_pciid_from_fd(fd, &vendor_id, &chip_id);
if (ret)
return ret;
for (i = 0; table[i].func; i++)
if (table[i].vendor == vendor_id && table[i].chip == chip_id)
return table[i].func(fd, out);
return -ENOSYS;
}
#else
static int
linux_from_udev(int fd, struct kms_driver **out)
{
return -ENOSYS;
}
#endif
drm_private int
linux_create(int fd, struct kms_driver **out)
{
if (!dumb_create(fd, out))
return 0;
if (!linux_from_udev(fd, out))
return 0;
return linux_from_sysfs(fd, out);
}