Update libdrm to 2.4.75

Approved by:	swills (mentor)
Differential Revision:	https://reviews.freebsd.org/D9437
This commit is contained in:
Matthew Rezny 2017-02-11 13:16:52 +00:00
parent d6024e89ad
commit fa8519d5a6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=433860
10 changed files with 166 additions and 89 deletions

View file

@ -2,8 +2,7 @@
# $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/

View file

@ -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

View file

@ -1,6 +1,6 @@
--- 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

View file

@ -1,6 +1,6 @@
--- 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])
@ -12,7 +12,7 @@
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
@ -23,9 +23,9 @@
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])

View file

@ -6,9 +6,9 @@ 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);

View file

@ -1,6 +1,6 @@
--- 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

View file

@ -1,4 +1,4 @@
--- 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'. */

View file

@ -1,4 +1,4 @@
--- 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
@ -8,10 +8,10 @@
+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
@ -19,16 +19,16 @@
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)
@ -37,10 +37,10 @@
--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
@ -48,7 +48,79 @@
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
@ -63,7 +135,7 @@
# 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
@ -76,7 +148,7 @@
if test "x$LIBKMS" = xauto ; then
case $host_os in
@@ -14520,6 +14547,92 @@ else
@@ -14331,6 +14358,92 @@ else
fi
@ -169,8 +241,8 @@
# 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

View file

@ -1,4 +1,4 @@
--- 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
@ -26,7 +26,7 @@
#endif
#ifdef __NetBSD__
@@ -532,6 +540,7 @@ static int drmGetMinorType(int minor)
@@ -548,6 +556,7 @@ static int drmGetMinorType(int minor)
}
}
@ -34,7 +34,7 @@
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;
}
}
@ -42,7 +42,7 @@
/**
* 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);
@ -56,34 +56,22 @@
+
+ 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)
@ -97,11 +85,11 @@
+ 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);
+
@ -137,51 +125,69 @@
+ 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
(*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
+
static void drmFreePlatformDevice(drmDevicePtr device)
{
if (device->deviceinfo.platform) {
@@ -3308,7 +3412,11 @@ static int drmProcessPciDevice(drmDevice
dev->businfo.pci = (drmPciBusInfoPtr)addr;
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+ ret = drmParsePciBusInfoBSD(node, dev->businfo.pci);
+#else
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;
}

View file

@ -2,7 +2,7 @@ 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 <stdlib.h>