diff options
author | Emil Velikov | 2016-11-30 12:39:07 -0600 |
---|---|---|
committer | Emil Velikov | 2016-12-05 11:24:03 -0600 |
commit | 9b05d403992c0ca181a920561d27931871909eb7 (patch) | |
tree | 4847dc292a8fea2749d756bf75ff8d1418ba3a95 | |
parent | 0c80fddd1d01206756bf2a3227cdf1efbfb16aaf (diff) | |
download | external-libdrm-9b05d403992c0ca181a920561d27931871909eb7.tar.gz external-libdrm-9b05d403992c0ca181a920561d27931871909eb7.tar.xz external-libdrm-9b05d403992c0ca181a920561d27931871909eb7.zip |
kms: remove commented out libudev code
Cc: Jakob Bornecrantz <wallbraker@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r-- | libkms/Makefile.am | 4 | ||||
-rw-r--r-- | libkms/linux.c | 94 |
2 files changed, 0 insertions, 98 deletions
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) | |||
10 | libkms_la_LDFLAGS = -version-number 1:0:0 -no-undefined | 10 | libkms_la_LDFLAGS = -version-number 1:0:0 -no-undefined |
11 | libkms_la_LIBADD = ../libdrm.la | 11 | libkms_la_LIBADD = ../libdrm.la |
12 | 12 | ||
13 | #if HAVE_LIBUDEV | ||
14 | #libkms_la_LIBADD += $(LIBUDEV_LIBS) | ||
15 | #endif | ||
16 | |||
17 | libkms_la_SOURCES = $(LIBKMS_FILES) | 13 | libkms_la_SOURCES = $(LIBKMS_FILES) |
18 | 14 | ||
19 | if HAVE_VMWGFX | 15 | 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) | |||
141 | return ret; | 141 | return ret; |
142 | } | 142 | } |
143 | 143 | ||
144 | #if 0 | ||
145 | #define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE | ||
146 | #include <libudev.h> | ||
147 | |||
148 | struct create_record | ||
149 | { | ||
150 | unsigned vendor; | ||
151 | unsigned chip; | ||
152 | int (*func)(int fd, struct kms_driver **out); | ||
153 | }; | ||
154 | |||
155 | static const struct create_record table[] = { | ||
156 | { 0x8086, 0x2a42, intel_create }, /* i965 */ | ||
157 | #ifdef HAVE_VMWGFX | ||
158 | { 0x15ad, 0x0405, vmwgfx_create }, /* VMware vGPU */ | ||
159 | #endif | ||
160 | { 0, 0, NULL }, | ||
161 | }; | ||
162 | |||
163 | static int | ||
164 | linux_get_pciid_from_fd(int fd, unsigned *vendor_id, unsigned *chip_id) | ||
165 | { | ||
166 | struct udev *udev; | ||
167 | struct udev_device *device; | ||
168 | struct udev_device *parent; | ||
169 | const char *pci_id; | ||
170 | struct stat buffer; | ||
171 | int ret; | ||
172 | |||
173 | ret = fstat(fd, &buffer); | ||
174 | if (ret) | ||
175 | return -EINVAL; | ||
176 | |||
177 | if (!S_ISCHR(buffer.st_mode)) | ||
178 | return -EINVAL; | ||
179 | |||
180 | udev = udev_new(); | ||
181 | if (!udev) | ||
182 | return -ENOMEM; | ||
183 | |||
184 | device = udev_device_new_from_devnum(udev, 'c', buffer.st_rdev); | ||
185 | if (!device) | ||
186 | goto err_free_udev; | ||
187 | |||
188 | parent = udev_device_get_parent(device); | ||
189 | if (!parent) | ||
190 | goto err_free_device; | ||
191 | |||
192 | pci_id = udev_device_get_property_value(parent, "PCI_ID"); | ||
193 | if (!pci_id) | ||
194 | goto err_free_device; | ||
195 | |||
196 | if (sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2) | ||
197 | goto err_free_device; | ||
198 | |||
199 | udev_device_unref(device); | ||
200 | udev_unref(udev); | ||
201 | |||
202 | return 0; | ||
203 | |||
204 | err_free_device: | ||
205 | udev_device_unref(device); | ||
206 | err_free_udev: | ||
207 | udev_unref(udev); | ||
208 | return -EINVAL; | ||
209 | } | ||
210 | |||
211 | static int | ||
212 | linux_from_udev(int fd, struct kms_driver **out) | ||
213 | { | ||
214 | unsigned vendor_id, chip_id; | ||
215 | int ret, i; | ||
216 | |||
217 | ret = linux_get_pciid_from_fd(fd, &vendor_id, &chip_id); | ||
218 | if (ret) | ||
219 | return ret; | ||
220 | |||
221 | for (i = 0; table[i].func; i++) | ||
222 | if (table[i].vendor == vendor_id && table[i].chip == chip_id) | ||
223 | return table[i].func(fd, out); | ||
224 | |||
225 | return -ENOSYS; | ||
226 | } | ||
227 | #else | ||
228 | static int | ||
229 | linux_from_udev(int fd, struct kms_driver **out) | ||
230 | { | ||
231 | return -ENOSYS; | ||
232 | } | ||
233 | #endif | ||
234 | |||
235 | drm_private int | 144 | drm_private int |
236 | linux_create(int fd, struct kms_driver **out) | 145 | linux_create(int fd, struct kms_driver **out) |
237 | { | 146 | { |
238 | if (!dumb_create(fd, out)) | 147 | if (!dumb_create(fd, out)) |
239 | return 0; | 148 | return 0; |
240 | 149 | ||
241 | if (!linux_from_udev(fd, out)) | ||
242 | return 0; | ||
243 | |||
244 | return linux_from_sysfs(fd, out); | 150 | return linux_from_sysfs(fd, out); |
245 | } | 151 | } |