diff --git a/libkms/Makefile.am b/libkms/Makefile.am index 7c1debe2..461fc35b 100644 --- a/libkms/Makefile.am +++ b/libkms/Makefile.am @@ -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 diff --git a/libkms/linux.c b/libkms/linux.c index 69eb1aa4..0b50777e 100644 --- a/libkms/linux.c +++ b/libkms/linux.c @@ -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 - -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); }