svn commit: r431708 - in head/graphics/libdrm: . files

Baptiste Daroussin bapt at FreeBSD.org
Mon Jan 16 23:05:25 UTC 2017


Author: bapt
Date: Mon Jan 16 23:05:23 2017
New Revision: 431708
URL: https://svnweb.freebsd.org/changeset/ports/431708

Log:
  Add support to find directly the drm device via libdevq the same
  way linux uses libudev
  
  PR:		214580
  Submitted by:	matthew at reztek.cz

Added:
  head/graphics/libdrm/files/Makefile.am   (contents, props changed)
  head/graphics/libdrm/files/configure.ac   (contents, props changed)
  head/graphics/libdrm/files/patch-Makefile.in   (contents, props changed)
  head/graphics/libdrm/files/patch-config.h.in   (contents, props changed)
  head/graphics/libdrm/files/patch-configure   (contents, props changed)
  head/graphics/libdrm/files/patch-xf86drm.c   (contents, props changed)
Modified:
  head/graphics/libdrm/Makefile
  head/graphics/libdrm/files/patch-xf86drmMode.c
  head/graphics/libdrm/pkg-plist

Modified: head/graphics/libdrm/Makefile
==============================================================================
--- head/graphics/libdrm/Makefile	Mon Jan 16 22:52:16 2017	(r431707)
+++ head/graphics/libdrm/Makefile	Mon Jan 16 23:05:23 2017	(r431708)
@@ -12,7 +12,9 @@ COMMENT=	Userspace interface to kernel D
 
 LICENSE=	MIT
 
+BUILD_DEPENDS=	libdevq>=0.0.4:devel/libdevq
 LIB_DEPENDS=	libpciaccess.so:devel/libpciaccess \
+		libdevq.so:devel/libdevq \
 		libpthread-stubs.so:devel/libpthread-stubs
 
 USES=		libtool pkgconfig tar:bzip2
@@ -33,10 +35,10 @@ USES+=		gmake
 # KMS support in the kernel is only build on these archs, disable others
 .if ${ARCH} == "amd64" || ${ARCH} == "i386"
 CONFIGURE_ARGS+=--enable-libkms
-PLIST_SUB+=	KMS="" NOUVEAU=""
+PLIST_SUB+=	KMS=""
 .else
 CONFIGURE_ARGS+=--disable-libkms
-PLIST_SUB+=	KMS="@comment " NOUVEAU="@comment "
+PLIST_SUB+=	KMS="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MMANPAGES}
@@ -51,13 +53,24 @@ PLIST_SUB+=	MAN="@comment "
 CONFIGURE_ARGS+=--disable-vmwgfx
 
 .if ${ARCH} == amd64 || ${ARCH} == i386
+PLIST_SUB+=	ARM_DRIVERS="@comment "
 PLIST_SUB+=	INTEL_DRIVER=""
+PLIST_SUB+=	NOUVEAU_DRIVER=""
 PLIST_SUB+=	RADEON_DRIVERS=""
-.elif ${ARCH} == ia64 || ${ARCH} == powerpc || ${ARCH} == powerpc64
+.elif ${ARCH} == powerpc || ${ARCH} == powerpc64
+PLIST_SUB+=	ARM_DRIVERS="@comment "
 PLIST_SUB+=	INTEL_DRIVER="@comment "
+PLIST_SUB+=	NOUVEAU_DRIVER=""
 PLIST_SUB+=	RADEON_DRIVERS=""
+.elif ${ARCH} == arm6 || ${ARCH} == aarch64
+PLIST_SUB+=	ARM_DRIVERS=""
+PLIST_SUB+=	INTEL_DRIVER="@comment "
+PLIST_SUB+=	NOUVEAU_DRIVER="@comment "
+PLIST_SUB+=	RADEON_DRIVERS="@comment "
 .else
+PLIST_SUB+=	ARM_DRIVERS="@comment "
 PLIST_SUB+=	INTEL_DRIVER="@comment "
+PLIST_SUB+=	NOUVEAU_DRIVER="@comment "
 PLIST_SUB+=	RADEON_DRIVERS="@comment "
 .endif
 

Added: head/graphics/libdrm/files/Makefile.am
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/libdrm/files/Makefile.am	Mon Jan 16 23:05:23 2017	(r431708)
@@ -0,0 +1,14 @@
+--- Makefile.am.orig	2016-06-23 14:29:40.575882000 +0200
++++ Makefile.am	2016-06-23 14:38:48.752016000 +0200
+@@ -108,9 +108,9 @@
+ libdrm_la_LTLIBRARIES = libdrm.la
+ libdrm_ladir = $(libdir)
+ libdrm_la_LDFLAGS = -version-number 2:4:0 -no-undefined
+-libdrm_la_LIBADD = @CLOCK_LIB@ -lm
++libdrm_la_LIBADD = @CLOCK_LIB@ -lm @LIBDEVQ_LIBS@
+ 
+-libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm
++libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm @LIBDEVQ_CFLAGS@
+ AM_CFLAGS = \
+ 	$(WARN_CFLAGS) \
+ 	$(VALGRIND_CFLAGS)

Added: head/graphics/libdrm/files/configure.ac
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/libdrm/files/configure.ac	Mon Jan 16 23:05:23 2017	(r431708)
@@ -0,0 +1,39 @@
+--- configure.ac.orig	2016-04-28 02:52:47.000000000 +0200
++++ configure.ac	2016-07-09 18:53:39.021028000 +0200
+@@ -71,6 +71,11 @@
+                               [Enable support for using udev instead of mknod (default: disabled)])],
+               [UDEV=$enableval], [UDEV=no])
+ 
++AC_ARG_ENABLE([devq],
++              [AS_HELP_STRING([--enable-devq],
++                              [Enable support for using devq for device detection (default: disabled)])],
++              [DEVQ=$enableval], [DEVQ=no])
++
+ AC_ARG_ENABLE(libkms,
+ 	      AS_HELP_STRING([--disable-libkms],
+ 	      [Disable KMS mm abstraction library (default: auto, enabled on supported platforms)]),
+@@ -313,6 +318,10 @@
+ 	AC_DEFINE(UDEV, 1, [Have UDEV support])
+ fi
+ 
++if test "x$DEVQ" = xyes; then
++	AC_DEFINE(DEVQ, 1, [Have DEVQ support])
++fi
++
+ AC_CANONICAL_HOST
+ if test "x$LIBKMS" = xauto ; then
+ 	case $host_os in
+@@ -444,6 +453,13 @@
+ fi
+ AM_CONDITIONAL(HAVE_LIBUDEV, [test "x$HAVE_LIBUDEV" = xyes])
+ 
++# For FreeBSD support
++PKG_CHECK_MODULES([LIBDEVQ], [libdevq-1.0 >= 0.0.4], [HAVE_LIBDEVQ=yes], [HAVE_LIBDEVQ=no])
++if test "x$HAVE_LIBDEVQ" = xyes; then
++	AC_DEFINE(HAVE_LIBDEVQ, 1, [Have libdevq support])
++fi
++AM_CONDITIONAL(HAVE_LIBDEVQ, [test "x$HAVE_LIBDEVQ" = xyes])
++
+ # xsltproc for docbook manpages
+ AC_ARG_ENABLE([manpages],
+               AS_HELP_STRING([--enable-manpages], [enable manpages @<:@default=auto@:>@]),

Added: head/graphics/libdrm/files/patch-Makefile.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/libdrm/files/patch-Makefile.in	Mon Jan 16 23:05:23 2017	(r431708)
@@ -0,0 +1,13 @@
+--- Makefile.in.orig	2016-11-29 13:34:56 UTC
++++ Makefile.in
+@@ -564,8 +564,8 @@ SUBDIRS = \
+ libdrm_la_LTLIBRARIES = libdrm.la
+ libdrm_ladir = $(libdir)
+ libdrm_la_LDFLAGS = -version-number 2:4:0 -no-undefined
+-libdrm_la_LIBADD = @CLOCK_LIB@ -lm
+-libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm
++libdrm_la_LIBADD = @CLOCK_LIB@ -lm @LIBDEVQ_LIBS@
++libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm @LIBDEVQ_CFLAGS@
+ AM_CFLAGS = \
+ 	$(WARN_CFLAGS) \
+ 	$(VALGRIND_CFLAGS)

Added: head/graphics/libdrm/files/patch-config.h.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/libdrm/files/patch-config.h.in	Mon Jan 16 23:05:23 2017	(r431708)
@@ -0,0 +1,22 @@
+--- config.h.in.orig	2016-11-29 13:34:54 UTC
++++ config.h.in
+@@ -8,6 +8,9 @@
+ /* Define to 1 if using `alloca.c'. */
+ #undef C_ALLOCA
+ 
++/* Have DEVQ support */
++#undef DEVQ
++
+ /* Define to 1 if you have `alloca', as a function or macro. */
+ #undef HAVE_ALLOCA
+ 
+@@ -51,6 +54,9 @@
+ /* Define to 1 if you have the <inttypes.h> header file. */
+ #undef HAVE_INTTYPES_H
+ 
++/* Have libdevq support */
++#undef HAVE_LIBDEVQ
++
+ /* Enable if your compiler supports the Intel __sync_* atomic primitives */
+ #undef HAVE_LIBDRM_ATOMIC_PRIMITIVES
+ 

Added: head/graphics/libdrm/files/patch-configure
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/libdrm/files/patch-configure	Mon Jan 16 23:05:23 2017	(r431708)
@@ -0,0 +1,182 @@
+--- configure.orig	2017-01-15 13:16:10 UTC
++++ configure
+@@ -646,6 +646,10 @@ HAVE_MANPAGES_STYLESHEET_TRUE
+ MANPAGES_STYLESHEET
+ BUILD_MANPAGES_FALSE
+ BUILD_MANPAGES_TRUE
++HAVE_LIBDEVQ_FALSE
++HAVE_LIBDEVQ_TRUE
++LIBDEVQ_LIBS
++LIBDEVQ_CFLAGS
+ HAVE_LIBUDEV_FALSE
+ HAVE_LIBUDEV_TRUE
+ LIBUDEV_LIBS
+@@ -842,6 +846,7 @@ with_gnu_ld
+ with_sysroot
+ enable_libtool_lock
+ enable_udev
++enable_devq
+ enable_libkms
+ enable_intel
+ enable_radeon
+@@ -885,6 +890,8 @@ CAIRO_CFLAGS
+ CAIRO_LIBS
+ LIBUDEV_CFLAGS
+ LIBUDEV_LIBS
++LIBDEVQ_CFLAGS
++LIBDEVQ_LIBS
+ VALGRIND_CFLAGS
+ VALGRIND_LIBS'
+ 
+@@ -1519,6 +1526,8 @@ Optional Features:
+   --disable-libtool-lock  avoid locking (might break parallel builds)
+   --enable-udev           Enable support for using udev instead of mknod
+                           (default: disabled)
++  --enable-devq           Enable support for using devq for device detection
++                          (default: disabled)
+   --disable-libkms        Disable KMS mm abstraction library (default: auto,
+                           enabled on supported platforms)
+   --disable-intel         Enable support for intel's KMS API (default: auto,
+@@ -1602,6 +1611,10 @@ Some influential environment variables:
+               C compiler flags for LIBUDEV, overriding pkg-config
+   LIBUDEV_LIBS
+               linker flags for LIBUDEV, overriding pkg-config
++  LIBDEVQ_CFLAGS
++              C compiler flags for LIBDEVQ, overriding pkg-config
++  LIBDEVQ_LIBS
++              linker flags for LIBDEVQ, overriding pkg-config
+   VALGRIND_CFLAGS
+               C compiler flags for VALGRIND, overriding pkg-config
+   VALGRIND_LIBS
+@@ -13440,6 +13453,14 @@ else
+ fi
+ 
+ 
++# Check whether --enable-devq was given.
++if test "${enable_devq+set}" = set; then :
++  enableval=$enable_devq; DEVQ=$enableval
++else
++  DEVQ=no
++fi
++
++
+ # Check whether --enable-libkms was given.
+ if test "${enable_libkms+set}" = set; then :
+   enableval=$enable_libkms; LIBKMS=$enableval
+@@ -13976,6 +13997,12 @@ $as_echo "#define UDEV 1" >>confdefs.h
+ 
+ fi
+ 
++if test "x$DEVQ" = xyes; then
++
++$as_echo "#define DEVQ 1" >>confdefs.h
++
++fi
++
+ 
+ if test "x$LIBKMS" = xauto ; then
+ 	case $host_os in
+@@ -14520,6 +14547,92 @@ else
+ fi
+ 
+ 
++# For FreeBSD support
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDEVQ" >&5
++$as_echo_n "checking for LIBDEVQ... " >&6; }
++
++if test -n "$LIBDEVQ_CFLAGS"; then
++    pkg_cv_LIBDEVQ_CFLAGS="$LIBDEVQ_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0 >= 0.0.4\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libdevq-1.0 >= 0.0.4") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_LIBDEVQ_CFLAGS=`$PKG_CONFIG --cflags "libdevq-1.0 >= 0.0.4" 2>/dev/null`
++		      test "x$?" != "x0" && pkg_failed=yes
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
++if test -n "$LIBDEVQ_LIBS"; then
++    pkg_cv_LIBDEVQ_LIBS="$LIBDEVQ_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0 >= 0.0.4\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libdevq-1.0 >= 0.0.4") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_LIBDEVQ_LIBS=`$PKG_CONFIG --libs "libdevq-1.0 >= 0.0.4" 2>/dev/null`
++		      test "x$?" != "x0" && pkg_failed=yes
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++        _pkg_short_errors_supported=yes
++else
++        _pkg_short_errors_supported=no
++fi
++        if test $_pkg_short_errors_supported = yes; then
++	        LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdevq-1.0 >= 0.0.4" 2>&1`
++        else
++	        LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdevq-1.0 >= 0.0.4" 2>&1`
++        fi
++	# Put the nasty error message in config.log where it belongs
++	echo "$LIBDEVQ_PKG_ERRORS" >&5
++
++	HAVE_LIBDEVQ=no
++elif test $pkg_failed = untried; then
++     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++	HAVE_LIBDEVQ=no
++else
++	LIBDEVQ_CFLAGS=$pkg_cv_LIBDEVQ_CFLAGS
++	LIBDEVQ_LIBS=$pkg_cv_LIBDEVQ_LIBS
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++	HAVE_LIBDEVQ=yes
++fi
++if test "x$HAVE_LIBDEVQ" = xyes; then
++
++$as_echo "#define HAVE_LIBDEVQ 1" >>confdefs.h
++
++fi
++ if test "x$HAVE_LIBDEVQ" = xyes; then
++  HAVE_LIBDEVQ_TRUE=
++  HAVE_LIBDEVQ_FALSE='#'
++else
++  HAVE_LIBDEVQ_TRUE='#'
++  HAVE_LIBDEVQ_FALSE=
++fi
++
++
+ # xsltproc for docbook manpages
+ # Check whether --enable-manpages was given.
+ if test "${enable_manpages+set}" = set; then :
+@@ -14930,6 +15043,10 @@ if test -z "${HAVE_LIBUDEV_TRUE}" && tes
+   as_fn_error $? "conditional \"HAVE_LIBUDEV\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
++if test -z "${HAVE_LIBDEVQ_TRUE}" && test -z "${HAVE_LIBDEVQ_FALSE}"; then
++  as_fn_error $? "conditional \"HAVE_LIBDEVQ\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
++fi
+ if test -z "${BUILD_MANPAGES_TRUE}" && test -z "${BUILD_MANPAGES_FALSE}"; then
+   as_fn_error $? "conditional \"BUILD_MANPAGES\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5

Added: head/graphics/libdrm/files/patch-xf86drm.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/libdrm/files/patch-xf86drm.c	Mon Jan 16 23:05:23 2017	(r431708)
@@ -0,0 +1,187 @@
+--- xf86drm.c.orig	2017-01-15 13:16:10 UTC
++++ xf86drm.c
+@@ -62,6 +62,10 @@
+ #endif
+ #include <math.h>
+ 
++#ifdef HAVE_LIBDEVQ
++#include "libdevq.h"
++#endif
++
+ /* Not all systems have MAP_FAILED defined */
+ #ifndef MAP_FAILED
+ #define MAP_FAILED ((void *)-1)
+@@ -82,8 +86,12 @@
+ #define DRM_RENDER_MINOR_NAME   "renderD"
+ #endif
+ 
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+-#define DRM_MAJOR 145
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#define DRM_MAJOR 0
++#endif
++
++#if defined(__DragonFly__)
++#define DRM_MAJOR 65 /* was 145 XXX needs checking */
+ #endif
+ 
+ #ifdef __NetBSD__
+@@ -532,6 +540,7 @@ static int drmGetMinorType(int minor)
+     }
+ }
+ 
++#if !defined(__FreeBSD__) && !defined(__DragonFly__)
+ static const char *drmGetMinorName(int type)
+ {
+     switch (type) {
+@@ -545,6 +554,7 @@ static const char *drmGetMinorName(int t
+         return NULL;
+     }
+ }
++#endif
+ 
+ /**
+  * Open the device by bus ID.
+@@ -2817,6 +2827,15 @@ static char *drmGetMinorNameForFD(int fd
+ 
+ out_close_dir:
+     closedir(sysdir);
++#elif defined(__FreeBSD__) || defined(__DragonFly__)
++    struct stat buf;
++    char name[64];
++
++    fstat(fd, &buf);
++    snprintf(name, sizeof(name), "/dev/%s",
++             devname(buf.st_rdev, S_IFCHR));
++
++    return strdup(name);
+ #else
+ #warning "Missing implementation of drmGetMinorNameForFD"
+ #endif
+@@ -2854,12 +2873,19 @@ static int drmParseSubsystemType(int maj
+         return DRM_BUS_PCI;
+ 
+     return -EINVAL;
++#elif defined(__FreeBSD__) || defined(__DragonFly__)
++    /* XXX: Don't know how to get the subsystem type, hardcode for now.
++     * The code following the call to this function needs depends on
++     * information provided by the /pci subsystem on linux. No replacement
++     * found yet for FreeBSD. */
++    return DRM_BUS_PCI;
+ #else
+ #warning "Missing implementation of drmParseSubsystemType"
+     return -EINVAL;
+ #endif
+ }
+ 
++#if !defined(__FreeBSD__) && !defined(__DragonFly__)
+ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
+ {
+ #ifdef __linux__
+@@ -2901,6 +2927,61 @@ static int drmParsePciBusInfo(int maj, i
+     return -EINVAL;
+ #endif
+ }
++#else
++
++/*
++ * XXX temporary workaround, because FreeBSD doesn't provide 
++ * pcibus device sysctl trees for renderD and controlD nodes (yet)
++ */
++static void
++drmBSDDeviceNameHack(const char *path, char *hacked_path, int length)
++{
++    int start, number;
++    const char *errstr;
++
++    if (strcmp(path, DRM_DIR_NAME "/controlD") > 0) {
++        start = 17;
++        number = strtonum(&path[start], 0, 256, &errstr) - 64;
++        snprintf(hacked_path, length, DRM_DIR_NAME "/card%i", number);
++    } else if (strcmp(path, DRM_DIR_NAME "/renderD") > 0) {
++        start = 16;
++        number = strtonum(&path[start], 0, 256, &errstr) - 128;
++        snprintf(hacked_path, length, DRM_DIR_NAME "/card%i", number);
++    } else
++        snprintf(hacked_path, length, "%s", path);
++
++  return;
++}
++
++static int
++drmParsePciBusInfoBSD(const char *path, drmPciBusInfoPtr info)
++{
++    int fd, ret;
++    int domain = 0, bus = 0, slot = 0, function = 0;
++    char hacked_path[PATH_MAX + 1];
++
++    drmBSDDeviceNameHack(path, hacked_path, PATH_MAX);
++    fd = open(hacked_path, O_RDONLY);
++
++    if (fd < 0)
++        return -errno;
++
++    ret = devq_device_get_pcibusaddr(fd, &domain, &bus, &slot, &function);
++
++    if (ret < 0) {
++        close(fd);
++        return -1;
++    }
++
++    info->domain = (uint16_t) domain;
++    info->bus = (uint8_t) bus;
++    info->dev = (uint8_t) slot;
++    info->func = (uint8_t) function;
++
++    close(fd);
++    return 0;
++}
++#endif
+ 
+ static int drmCompareBusInfo(drmDevicePtr a, drmDevicePtr b)
+ {
+@@ -2971,6 +3052,31 @@ static int drmParsePciDeviceInfo(const c
+     device->subdevice_id = config[46] | (config[47] << 8);
+ 
+     return 0;
++#elif defined(__FreeBSD__) || defined(__DragonFly__)
++    int fd, vendor_id = 0, device_id = 0, subvendor_id = 0, 
++        subdevice_id = 0, revision_id = 0;
++    char path[PATH_MAX + 1];
++    char hacked_path[PATH_MAX + 1];
++
++    snprintf(path, PATH_MAX, DRM_DIR_NAME "/%s", d_name);
++    drmBSDDeviceNameHack(path, hacked_path, PATH_MAX);
++
++    fd = open(hacked_path, O_RDONLY);
++
++    if (fd < 0)
++        return -errno;
++
++    devq_device_get_pciid_full_from_fd(fd, &vendor_id, &device_id,
++	&subvendor_id, &subdevice_id, &revision_id);
++
++    device->vendor_id = (uint16_t) vendor_id;
++    device->device_id = (uint16_t) device_id;
++    device->subvendor_id = (uint16_t) subvendor_id;
++    device->subdevice_id = (uint16_t) subdevice_id;
++    device->revision_id = (uint8_t) revision_id;
++
++    close(fd);
++    return 0;
+ #else
+ #warning "Missing implementation of drmParsePciDeviceInfo"
+     return -EINVAL;
+@@ -3030,7 +3136,12 @@ static int drmProcessPciDevice(drmDevice
+ 
+     (*device)->businfo.pci = (drmPciBusInfoPtr)addr;
+ 
++#if defined(__FreeBSD__) || defined(__DragonFly__)
++    ret = drmParsePciBusInfoBSD(node, (*device)->businfo.pci);
++#else
+     ret = drmParsePciBusInfo(maj, min, (*device)->businfo.pci);
++#endif
++
+     if (ret)
+         goto free_device;
+ 

Modified: head/graphics/libdrm/files/patch-xf86drmMode.c
==============================================================================
--- head/graphics/libdrm/files/patch-xf86drmMode.c	Mon Jan 16 22:52:16 2017	(r431707)
+++ head/graphics/libdrm/files/patch-xf86drmMode.c	Mon Jan 16 23:05:23 2017	(r431708)
@@ -2,8 +2,8 @@ Disable checking for hw.dri.%d.modesetti
 This sysctl is only available if a KMS module is loaded. But the libdrm
 check happens before X got a chance of loading the KMS module.
 
---- xf86drmMode.c.orig	2015-08-21 16:50:01.000000000 +0200
-+++ xf86drmMode.c	2015-10-20 17:34:48.000000000 +0200
+--- xf86drmMode.c.orig	2016-11-29 11:15:10 UTC
++++ xf86drmMode.c
 @@ -47,6 +47,7 @@
  #include <stdlib.h>
  #include <sys/ioctl.h>
@@ -12,7 +12,7 @@ check happens before X got a chance of l
  #include <sys/sysctl.h>
  #endif
  #include <stdio.h>
-@@ -781,38 +782,7 @@ int drmCheckModesettingSupported(const c
+@@ -797,38 +798,7 @@ int drmCheckModesettingSupported(const c
  	if (found)
  		return 0;
  #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)

Modified: head/graphics/libdrm/pkg-plist
==============================================================================
--- head/graphics/libdrm/pkg-plist	Mon Jan 16 22:52:16 2017	(r431707)
+++ head/graphics/libdrm/pkg-plist	Mon Jan 16 23:05:23 2017	(r431708)
@@ -10,14 +10,14 @@ include/libdrm/i915_drm.h
 %%INTEL_DRIVER%%include/libdrm/intel_debug.h
 include/libdrm/mach64_drm.h
 include/libdrm/mga_drm.h
-%%NOUVEAU%%include/libdrm/nouveau/nouveau.h
-%%NOUVEAU%%include/libdrm/nouveau/nvif/cl0080.h
-%%NOUVEAU%%include/libdrm/nouveau/nvif/cl9097.h
-%%NOUVEAU%%include/libdrm/nouveau/nvif/class.h
-%%NOUVEAU%%include/libdrm/nouveau/nvif/if0002.h
-%%NOUVEAU%%include/libdrm/nouveau/nvif/if0003.h
-%%NOUVEAU%%include/libdrm/nouveau/nvif/ioctl.h
-%%NOUVEAU%%include/libdrm/nouveau/nvif/unpack.h
+%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nouveau.h
+%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/cl0080.h
+%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/cl9097.h
+%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/class.h
+%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/if0002.h
+%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/if0003.h
+%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/ioctl.h
+%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/unpack.h
 include/libdrm/nouveau_drm.h
 include/libdrm/qxl_drm.h
 include/libdrm/r128_drm.h
@@ -33,11 +33,13 @@ include/libdrm/radeon_drm.h
 include/libdrm/savage_drm.h
 include/libdrm/sis_drm.h
 include/libdrm/tegra_drm.h
-include/libdrm/via_drm.h
 include/libdrm/vc4_drm.h
+%%ARM_DRIVERS%%include/libdrm/vc4_packet.h
+%%ARM_DRIVERS%%include/libdrm/vc4_gpq_defines.h
+include/libdrm/via_drm.h
 include/libdrm/virtgpu_drm.h
-include/libsync.h
 %%KMS%%include/libkms/libkms.h
+include/libsync.h
 include/xf86drm.h
 include/xf86drmMode.h
 lib/libdrm.so
@@ -49,20 +51,24 @@ lib/libdrm.so.2.4.0
 %%INTEL_DRIVER%%lib/libdrm_intel.so
 %%INTEL_DRIVER%%lib/libdrm_intel.so.1
 %%INTEL_DRIVER%%lib/libdrm_intel.so.1.0.0
-%%NOUVEAU%%lib/libdrm_nouveau.so
-%%NOUVEAU%%lib/libdrm_nouveau.so.2
-%%NOUVEAU%%lib/libdrm_nouveau.so.2.0.0
+%%NOUVEAU_DRIVER%%lib/libdrm_nouveau.so
+%%NOUVEAU_DRIVER%%lib/libdrm_nouveau.so.2
+%%NOUVEAU_DRIVER%%lib/libdrm_nouveau.so.2.0.0
 %%RADEON_DRIVERS%%lib/libdrm_radeon.so
 %%RADEON_DRIVERS%%lib/libdrm_radeon.so.1
 %%RADEON_DRIVERS%%lib/libdrm_radeon.so.1.0.1
+%%ARM_DRIVERS%%lib/libdrm_vc4.so
+%%ARM_DRIVERS%%lib/libdrm_vc4.so.1
+%%ARM_DRIVERS%%lib/libdrm_vc4.so.1.0.0
 %%KMS%%lib/libkms.so
 %%KMS%%lib/libkms.so.1
 %%KMS%%lib/libkms.so.1.0.0
 libdata/pkgconfig/libdrm.pc
 %%RADEON_DRIVERS%%libdata/pkgconfig/libdrm_amdgpu.pc
 %%INTEL_DRIVER%%libdata/pkgconfig/libdrm_intel.pc
-%%NOUVEAU%%libdata/pkgconfig/libdrm_nouveau.pc
+%%NOUVEAU_DRIVER%%libdata/pkgconfig/libdrm_nouveau.pc
 %%RADEON_DRIVERS%%libdata/pkgconfig/libdrm_radeon.pc
+%%ARM_DRIVERS%%libdata/pkgconfig/libdrm_vc4.pc
 %%KMS%%libdata/pkgconfig/libkms.pc
 %%MAN%%man/man3/drmAvailable.3.gz
 %%MAN%%man/man3/drmHandleEvent.3.gz


More information about the svn-ports-all mailing list