forked from Lainports/freebsd-ports
The port will switch to the newer version if hw context is available in the i915kms driver. - Get ride of WITH_NEW_XORG. - Use @comment in plist to ignore unwanted files in the stagedir, instead of trying to remove them in post-install. - Bump portrevision of 9.1.7 due to dependency changes. - Drop :keepla from USES=libtool. - Drop @dirrm[try] from plists - Give dri propper options, with pkg-help for additional information. - Make separate plist for dri for the different versions, the combined plist was headache inducing. - Add "workaround" patches to allow clang to build the dri port on i386 [1]. USE_GCC is now only needed for 8.x. - Add gbm port and USE_GL switch for it. PR: 192286 [1] Submitted by: Carlos Jacobo Puga Medina [1] Approved by: portmgr (bapt@) In collaberation with: dumbbell@ Obtained from: xorg-dev
90 lines
2 KiB
C
90 lines
2 KiB
C
--- src/loader/loader.c.orig 2014-08-21 01:27:47.000000000 +0200
|
|
+++ src/loader/loader.c 2014-09-04 19:57:56.384142575 +0200
|
|
@@ -67,7 +67,7 @@
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
-#ifdef HAVE_LIBUDEV
|
|
+#if defined(HAVE_LIBUDEV) || defined(HAVE_LIBDEVQ)
|
|
#include <assert.h>
|
|
#include <dlfcn.h>
|
|
#include <fcntl.h>
|
|
@@ -488,6 +488,53 @@
|
|
}
|
|
#endif
|
|
|
|
+#if defined(HAVE_LIBDEVQ)
|
|
+#include <libdevq.h>
|
|
+
|
|
+static void *devq_handle = NULL;
|
|
+
|
|
+static void *
|
|
+devq_dlopen_handle(void)
|
|
+{
|
|
+ if (!devq_handle) {
|
|
+ devq_handle = dlopen("libdevq.so.0", RTLD_LOCAL | RTLD_LAZY);
|
|
+ }
|
|
+
|
|
+ return devq_handle;
|
|
+}
|
|
+
|
|
+static void *
|
|
+asserted_dlsym(void *dlopen_handle, const char *name)
|
|
+{
|
|
+ void *result = dlsym(dlopen_handle, name);
|
|
+ assert(result);
|
|
+ return result;
|
|
+}
|
|
+
|
|
+#define DEVQ_SYMBOL(ret, name, args) \
|
|
+ ret (*name) args = asserted_dlsym(devq_dlopen_handle(), #name);
|
|
+
|
|
+static int
|
|
+devq_get_pci_id_from_fd(int fd, int *vendor_id, int *chip_id)
|
|
+{
|
|
+ int ret;
|
|
+ DEVQ_SYMBOL(int, devq_device_get_pciid_from_fd,
|
|
+ (int fd, int *vendor_id, int *chip_id));
|
|
+
|
|
+ *chip_id = -1;
|
|
+
|
|
+ ret = devq_device_get_pciid_from_fd(fd, vendor_id, chip_id);
|
|
+ if (ret < 0) {
|
|
+ log_(_LOADER_WARNING, "MESA-LOADER: could not get PCI ID\n");
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+out:
|
|
+ return (*chip_id >= 0);
|
|
+}
|
|
+
|
|
+#endif
|
|
+
|
|
#if !defined(__NOT_HAVE_DRM_H)
|
|
/* for i915 */
|
|
#include <i915_drm.h>
|
|
@@ -571,6 +618,10 @@
|
|
if (sysfs_get_pci_id_for_fd(fd, vendor_id, chip_id))
|
|
return 1;
|
|
#endif
|
|
+#if HAVE_LIBDEVQ
|
|
+ if (devq_get_pci_id_from_fd(fd, vendor_id, chip_id))
|
|
+ return 1;
|
|
+#endif
|
|
#if !defined(__NOT_HAVE_DRM_H)
|
|
if (drm_get_pci_id_for_fd(fd, vendor_id, chip_id))
|
|
return 1;
|
|
@@ -665,6 +716,13 @@
|
|
if ((result = sysfs_get_device_name_for_fd(fd)))
|
|
return result;
|
|
#endif
|
|
+#if HAVE_LIBDEVQ
|
|
+#if 0
|
|
+/* XXX implement this function in libdevq */
|
|
+ if ((result = devq_device_get_name_for_fd(fd)))
|
|
+ return result;
|
|
+#endif
|
|
+#endif
|
|
return result;
|
|
}
|
|
|