Index: head/graphics/libdrm/Makefile =================================================================== --- head/graphics/libdrm/Makefile (revision 433859) +++ head/graphics/libdrm/Makefile (revision 433860) @@ -1,89 +1,88 @@ # Created by: lesi@FreeBSD.org # $FreeBSD$ PORTNAME= libdrm -PORTVERSION= 2.4.74 -PORTREVISION= 1 +PORTVERSION= 2.4.75 PORTEPOCH= 1 CATEGORIES= graphics x11 MASTER_SITES= http://dri.freedesktop.org/libdrm/ MAINTAINER= x11@FreeBSD.org COMMENT= Userspace interface to kernel Direct Rendering Module services 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 GNU_CONFIGURE= yes USE_LDCONFIG= yes INSTALL_TARGET= install-strip OPTIONS_DEFINE= MANPAGES .if defined(PACKAGE_BUILDING) OPTIONS_DEFAULT+= MANPAGES .endif USES+= gmake .include # 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="" .else CONFIGURE_ARGS+=--disable-libkms PLIST_SUB+= KMS="@comment " .endif .if ${PORT_OPTIONS:MMANPAGES} BUILD_DEPENDS+= ${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl USE_GNOME+= libxslt:build PLIST_SUB+= MAN="" .else CONFIGURE_ARGS+=--disable-manpages PLIST_SUB+= MAN="@comment " .endif 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} == powerpc || ${ARCH} == powerpc64 PLIST_SUB+= ARM_DRIVERS="@comment " PLIST_SUB+= INTEL_DRIVER="@comment " PLIST_SUB+= NOUVEAU_DRIVER="" PLIST_SUB+= RADEON_DRIVERS="" .elif ${ARCH} == armv6 || ${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 # This variable is not for users. So use a non-default name, intended for # people working on DRM kernel module development. .if !defined(LIBDRM_SKIP_RETURN_PATCH) EXTRA_PATCHES+= ${FILESDIR}/extra-xf86drm.c .endif pre-patch: @${REINPLACE_CMD} 's|{libdir}/pkgconfig|{prefix}/libdata/pkgconfig|g; \ s,i?86|x86_64),i?86|amd64|x86_64),g' \ ${WRKSRC}/configure .include Index: head/graphics/libdrm/distinfo =================================================================== --- head/graphics/libdrm/distinfo (revision 433859) +++ head/graphics/libdrm/distinfo (revision 433860) @@ -1,3 +1,3 @@ -TIMESTAMP = 1484389267 -SHA256 (libdrm-2.4.74.tar.bz2) = d80dd5a76c401f4c8756dcccd999c63d7e0a3bad258d96a829055cfd86ef840b -SIZE (libdrm-2.4.74.tar.bz2) = 781730 +TIMESTAMP = 1485779860 +SHA256 (libdrm-2.4.75.tar.bz2) = 2d5a500eef412cc287d12268eed79d571e262d4957a2ec9258073f305985054f +SIZE (libdrm-2.4.75.tar.bz2) = 774589 Index: head/graphics/libdrm/files/Makefile.am =================================================================== --- head/graphics/libdrm/files/Makefile.am (revision 433859) +++ head/graphics/libdrm/files/Makefile.am (revision 433860) @@ -1,14 +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 @@ +--- Makefile.am.orig 2016-12-13 03:45:20.000000000 +0100 ++++ Makefile.am 2017-01-30 14:02:04.821902000 +0100 +@@ -115,9 +115,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) Index: head/graphics/libdrm/files/configure.ac =================================================================== --- head/graphics/libdrm/files/configure.ac (revision 433859) +++ head/graphics/libdrm/files/configure.ac (revision 433860) @@ -1,39 +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 @@ +--- configure.ac.orig 2017-01-28 02:15:16.000000000 +0100 ++++ configure.ac 2017-01-30 14:00:14.452530000 +0100 +@@ -72,6 +72,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 @@ +@@ -322,6 +327,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]) +@@ -451,6 +460,13 @@ + AC_MSG_RESULT([$CAIRO]) + AM_CONDITIONAL(HAVE_CAIRO, [test "x$CAIRO" = 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@:>@]), Index: head/graphics/libdrm/files/extra-xf86drm.c =================================================================== --- head/graphics/libdrm/files/extra-xf86drm.c (revision 433859) +++ head/graphics/libdrm/files/extra-xf86drm.c (revision 433860) @@ -1,19 +1,19 @@ Error code 512 is being leaked from kernel space. While it should be converted to either EINTR or EAGAIN in the kernel. Teach libdrm to do this for now. Newer kernel modules will have this fixed included. dragonfly fixed this issue in, http://gitweb.dragonflybsd.org/dragonfly.git/commit/b922632f623ee2cc2c1346bb3a6894a7756676aa which will be included in the 4.4 release when it is released. ---- xf86drm.c.orig 2016-11-29 11:15:10 UTC +--- xf86drm.c.orig 2017-01-30 13:59:15.919081000 +0100 +++ xf86drm.c -@@ -173,7 +173,7 @@ drmIoctl(int fd, unsigned long request, +@@ -197,7 +197,7 @@ drmIoctl(int fd, unsigned long request, do { ret = ioctl(fd, request, arg); - } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); + } while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == 512)); return ret; } Index: head/graphics/libdrm/files/patch-Makefile.in =================================================================== --- head/graphics/libdrm/files/patch-Makefile.in (revision 433859) +++ head/graphics/libdrm/files/patch-Makefile.in (revision 433860) @@ -1,13 +1,13 @@ ---- Makefile.in.orig 2016-11-29 13:34:56 UTC +--- Makefile.in.orig 2017-01-28 02:00:33 UTC +++ Makefile.in -@@ -564,8 +564,8 @@ SUBDIRS = \ +@@ -562,8 +562,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) Index: head/graphics/libdrm/files/patch-config.h.in =================================================================== --- head/graphics/libdrm/files/patch-config.h.in (revision 433859) +++ head/graphics/libdrm/files/patch-config.h.in (revision 433860) @@ -1,22 +1,22 @@ ---- config.h.in.orig 2016-11-29 13:34:54 UTC +--- config.h.in.orig 2017-01-28 02:00:33 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 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 Index: head/graphics/libdrm/files/patch-configure =================================================================== --- head/graphics/libdrm/files/patch-configure (revision 433859) +++ head/graphics/libdrm/files/patch-configure (revision 433860) @@ -1,182 +1,254 @@ ---- configure.orig 2017-01-15 13:16:10 UTC +--- configure.orig 2017-01-30 19:04:05 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 + HAVE_CAIRO_FALSE + HAVE_CAIRO_TRUE + CAIRO_LIBS +@@ -838,6 +842,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 +@@ -877,6 +882,8 @@ CUNIT_CFLAGS + CUNIT_LIBS + CAIRO_CFLAGS CAIRO_LIBS - LIBUDEV_CFLAGS - LIBUDEV_LIBS +LIBDEVQ_CFLAGS +LIBDEVQ_LIBS VALGRIND_CFLAGS VALGRIND_LIBS' -@@ -1519,6 +1526,8 @@ Optional Features: +@@ -1511,6 +1518,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 +@@ -1586,6 +1595,10 @@ Some influential environment variables: + CAIRO_CFLAGS + C compiler flags for CAIRO, overriding pkg-config + CAIRO_LIBS linker flags for CAIRO, 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 +@@ -10092,7 +10105,7 @@ $as_echo_n "checking whether the $compil + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no +- link_all_deplibs=unknown ++ link_all_deplibs=no + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= +@@ -10391,7 +10404,7 @@ _LT_EOF + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + fi + ;; + +@@ -10410,7 +10423,7 @@ _LT_EOF + _LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + else + ld_shlibs=no + fi +@@ -10439,7 +10452,7 @@ _LT_EOF + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + else + ld_shlibs=no + fi +@@ -10457,7 +10470,7 @@ _LT_EOF + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + else + ld_shlibs=no + fi +@@ -11105,7 +11118,7 @@ $as_echo "$lt_cv_irix_exported_symbol" > + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' +- archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-version-script,$lib-ver' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + else +@@ -11954,7 +11967,7 @@ freebsd* | dragonfly*) + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) +- library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ++ library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no +@@ -13089,7 +13102,7 @@ striplib= + old_striplib= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 + $as_echo_n "checking whether stripping libraries is possible... " >&6; } +-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then ++if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +@@ -13217,6 +13230,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 +@@ -13873,6 +13894,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 +@@ -14331,6 +14358,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. +@@ -14737,6 +14850,10 @@ if test -z "${HAVE_CAIRO_TRUE}" && test + as_fn_error $? "conditional \"HAVE_CAIRO\" 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 Index: head/graphics/libdrm/files/patch-xf86drm.c =================================================================== --- head/graphics/libdrm/files/patch-xf86drm.c (revision 433859) +++ head/graphics/libdrm/files/patch-xf86drm.c (revision 433860) @@ -1,187 +1,193 @@ ---- xf86drm.c.orig 2017-01-15 13:16:10 UTC +--- xf86drm.c.orig 2017-01-30 19:04:05 UTC +++ xf86drm.c @@ -62,6 +62,10 @@ #endif #include +#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) +@@ -548,6 +556,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 +@@ -561,6 +570,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 +@@ -2833,6 +2843,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; + struct stat sbuf; + char buf[PATH_MAX + 1]; +@@ -2960,7 +2979,7 @@ static int drmParseSubsystemType(int maj + return DRM_BUS_HOST1X; 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; +-#elif defined(__OpenBSD__) ++#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) + return DRM_BUS_PCI; #else #warning "Missing implementation of drmParseSubsystemType" - return -EINVAL; +@@ -3023,6 +3042,61 @@ static int drmParsePciBusInfo(int maj, i #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 -+ ++#if defined(__FreeBSD__) || defined(__DragonFly__) +/* + * 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); ++ snprintf(hacked_path, length, "%s/card%i", DRM_DIR_NAME, 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); ++ snprintf(hacked_path, length, "%s/card%i", DRM_DIR_NAME, 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); + if (a == NULL || b == NULL) +@@ -3188,6 +3262,36 @@ static int drmParsePciDeviceInfo(int maj + #endif + } - return 0; -+#elif defined(__FreeBSD__) || defined(__DragonFly__) -+ int fd, vendor_id = 0, device_id = 0, subvendor_id = 0, ++#if defined(__FreeBSD__) || defined(__DragonFly__) ++static int drmParsePciDeviceInfoBSD(const char *path, ++ drmPciDeviceInfoPtr device, ++ uint32_t flags) ++{ ++ 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); ++ &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 ++} ++#endif ++ + static void drmFreePlatformDevice(drmDevicePtr device) + { + if (device->deviceinfo.platform) { +@@ -3308,7 +3412,11 @@ static int drmProcessPciDevice(drmDevice - (*device)->businfo.pci = (drmPciBusInfoPtr)addr; + dev->businfo.pci = (drmPciBusInfoPtr)addr; +#if defined(__FreeBSD__) || defined(__DragonFly__) -+ ret = drmParsePciBusInfoBSD(node, (*device)->businfo.pci); ++ ret = drmParsePciBusInfoBSD(node, dev->businfo.pci); +#else - ret = drmParsePciBusInfo(maj, min, (*device)->businfo.pci); + ret = drmParsePciBusInfo(maj, min, dev->businfo.pci); +#endif -+ if (ret) goto free_device; +@@ -3316,8 +3424,11 @@ static int drmProcessPciDevice(drmDevice + if (fetch_deviceinfo) { + addr += sizeof(drmPciBusInfo); + dev->deviceinfo.pci = (drmPciDeviceInfoPtr)addr; +- ++#if defined(__FreeBSD__) || defined(__DragonFly__) ++ ret = drmParsePciDeviceInfoBSD(node, dev->deviceinfo.pci, flags); ++#else + ret = drmParsePciDeviceInfo(maj, min, dev->deviceinfo.pci, flags); ++#endif + if (ret) + goto free_device; + } Index: head/graphics/libdrm/files/patch-xf86drmMode.c =================================================================== --- head/graphics/libdrm/files/patch-xf86drmMode.c (revision 433859) +++ head/graphics/libdrm/files/patch-xf86drmMode.c (revision 433860) @@ -1,54 +1,54 @@ Disable checking for hw.dri.%d.modesetting. 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 2016-11-29 11:15:10 UTC +--- xf86drmMode.c.orig 2017-01-28 01:15:16 UTC +++ xf86drmMode.c @@ -47,6 +47,7 @@ #include #include #ifdef HAVE_SYS_SYSCTL_H +#include #include #endif #include @@ -797,38 +798,7 @@ int drmCheckModesettingSupported(const c if (found) return 0; #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__) - char kbusid[1024], sbusid[1024]; - char oid[128]; - int domain, bus, dev, func; - int i, modesetting, ret; - size_t len; - - ret = sscanf(busid, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, - &func); - if (ret != 4) - return -EINVAL; - snprintf(kbusid, sizeof(kbusid), "pci:%04x:%02x:%02x.%d", domain, bus, - dev, func); - - /* How many GPUs do we expect in the machine ? */ - for (i = 0; i < 16; i++) { - snprintf(oid, sizeof(oid), "hw.dri.%d.busid", i); - len = sizeof(sbusid); - ret = sysctlbyname(oid, sbusid, &len, NULL, 0); - if (ret == -1) { - if (errno == ENOENT) - continue; - return -EINVAL; - } - if (strcmp(sbusid, kbusid) != 0) - continue; - snprintf(oid, sizeof(oid), "hw.dri.%d.modesetting", i); - len = sizeof(modesetting); - ret = sysctlbyname(oid, &modesetting, &len, NULL, 0); - if (ret == -1 || len != sizeof(modesetting)) - return -EINVAL; - return (modesetting ? 0 : -ENOSYS); - } + return 0; #elif defined(__DragonFly__) return 0; #endif