View | Details | Raw Unified | Return to bug 214580 | Differences between
and this patch

Collapse All | Expand All

(-)graphics/libdrm/Makefile (-3 / +16 lines)
Lines 12-18 Link Here
12
12
13
LICENSE=	MIT
13
LICENSE=	MIT
14
14
15
BUILD_DEPENDS=	libdevq>=0.0.4:devel/libdevq
15
LIB_DEPENDS=	libpciaccess.so:devel/libpciaccess \
16
LIB_DEPENDS=	libpciaccess.so:devel/libpciaccess \
17
		libdevq.so:devel/libdevq \
16
		libpthread-stubs.so:devel/libpthread-stubs
18
		libpthread-stubs.so:devel/libpthread-stubs
17
19
18
USES=		libtool pkgconfig tar:bzip2
20
USES=		libtool pkgconfig tar:bzip2
Lines 33-42 Link Here
33
# KMS support in the kernel is only build on these archs, disable others
35
# KMS support in the kernel is only build on these archs, disable others
34
.if ${ARCH} == "amd64" || ${ARCH} == "i386"
36
.if ${ARCH} == "amd64" || ${ARCH} == "i386"
35
CONFIGURE_ARGS+=--enable-libkms
37
CONFIGURE_ARGS+=--enable-libkms
36
PLIST_SUB+=	KMS="" NOUVEAU=""
38
PLIST_SUB+=	KMS=""
37
.else
39
.else
38
CONFIGURE_ARGS+=--disable-libkms
40
CONFIGURE_ARGS+=--disable-libkms
39
PLIST_SUB+=	KMS="@comment " NOUVEAU="@comment "
41
PLIST_SUB+=	KMS="@comment "
40
.endif
42
.endif
41
43
42
.if ${PORT_OPTIONS:MMANPAGES}
44
.if ${PORT_OPTIONS:MMANPAGES}
Lines 51-63 Link Here
51
CONFIGURE_ARGS+=--disable-vmwgfx
53
CONFIGURE_ARGS+=--disable-vmwgfx
52
54
53
.if ${ARCH} == amd64 || ${ARCH} == i386
55
.if ${ARCH} == amd64 || ${ARCH} == i386
56
PLIST_SUB+=	ARM_DRIVERS="@comment "
54
PLIST_SUB+=	INTEL_DRIVER=""
57
PLIST_SUB+=	INTEL_DRIVER=""
58
PLIST_SUB+=	NOUVEAU_DRIVER=""
55
PLIST_SUB+=	RADEON_DRIVERS=""
59
PLIST_SUB+=	RADEON_DRIVERS=""
56
.elif ${ARCH} == ia64 || ${ARCH} == powerpc || ${ARCH} == powerpc64
60
.elif ${ARCH} == powerpc || ${ARCH} == powerpc64
61
PLIST_SUB+=	ARM_DRIVERS="@comment "
57
PLIST_SUB+=	INTEL_DRIVER="@comment "
62
PLIST_SUB+=	INTEL_DRIVER="@comment "
63
PLIST_SUB+=	NOUVEAU_DRIVER=""
58
PLIST_SUB+=	RADEON_DRIVERS=""
64
PLIST_SUB+=	RADEON_DRIVERS=""
65
.elif ${ARCH} == arm6 || ${ARCH} == aarch64
66
PLIST_SUB+=	ARM_DRIVERS=""
67
PLIST_SUB+=	INTEL_DRIVER="@comment "
68
PLIST_SUB+=	NOUVEAU_DRIVER="@comment "
69
PLIST_SUB+=	RADEON_DRIVERS="@comment "
59
.else
70
.else
71
PLIST_SUB+=	ARM_DRIVERS="@comment "
60
PLIST_SUB+=	INTEL_DRIVER="@comment "
72
PLIST_SUB+=	INTEL_DRIVER="@comment "
73
PLIST_SUB+=	NOUVEAU_DRIVER="@comment "
61
PLIST_SUB+=	RADEON_DRIVERS="@comment "
74
PLIST_SUB+=	RADEON_DRIVERS="@comment "
62
.endif
75
.endif
63
76
(-)graphics/libdrm/files/Makefile.am (+14 lines)
Line 0 Link Here
1
--- Makefile.am.orig	2016-06-23 14:29:40.575882000 +0200
2
+++ Makefile.am	2016-06-23 14:38:48.752016000 +0200
3
@@ -108,9 +108,9 @@
4
 libdrm_la_LTLIBRARIES = libdrm.la
5
 libdrm_ladir = $(libdir)
6
 libdrm_la_LDFLAGS = -version-number 2:4:0 -no-undefined
7
-libdrm_la_LIBADD = @CLOCK_LIB@ -lm
8
+libdrm_la_LIBADD = @CLOCK_LIB@ -lm @LIBDEVQ_LIBS@
9
 
10
-libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm
11
+libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm @LIBDEVQ_CFLAGS@
12
 AM_CFLAGS = \
13
 	$(WARN_CFLAGS) \
14
 	$(VALGRIND_CFLAGS)
(-)graphics/libdrm/files/configure.ac (+39 lines)
Line 0 Link Here
1
--- configure.ac.orig	2016-04-28 02:52:47.000000000 +0200
2
+++ configure.ac	2016-07-09 18:53:39.021028000 +0200
3
@@ -71,6 +71,11 @@
4
                               [Enable support for using udev instead of mknod (default: disabled)])],
5
               [UDEV=$enableval], [UDEV=no])
6
 
7
+AC_ARG_ENABLE([devq],
8
+              [AS_HELP_STRING([--enable-devq],
9
+                              [Enable support for using devq for device detection (default: disabled)])],
10
+              [DEVQ=$enableval], [DEVQ=no])
11
+
12
 AC_ARG_ENABLE(libkms,
13
 	      AS_HELP_STRING([--disable-libkms],
14
 	      [Disable KMS mm abstraction library (default: auto, enabled on supported platforms)]),
15
@@ -313,6 +318,10 @@
16
 	AC_DEFINE(UDEV, 1, [Have UDEV support])
17
 fi
18
 
19
+if test "x$DEVQ" = xyes; then
20
+	AC_DEFINE(DEVQ, 1, [Have DEVQ support])
21
+fi
22
+
23
 AC_CANONICAL_HOST
24
 if test "x$LIBKMS" = xauto ; then
25
 	case $host_os in
26
@@ -444,6 +453,13 @@
27
 fi
28
 AM_CONDITIONAL(HAVE_LIBUDEV, [test "x$HAVE_LIBUDEV" = xyes])
29
 
30
+# For FreeBSD support
31
+PKG_CHECK_MODULES([LIBDEVQ], [libdevq-1.0 >= 0.0.4], [HAVE_LIBDEVQ=yes], [HAVE_LIBDEVQ=no])
32
+if test "x$HAVE_LIBDEVQ" = xyes; then
33
+	AC_DEFINE(HAVE_LIBDEVQ, 1, [Have libdevq support])
34
+fi
35
+AM_CONDITIONAL(HAVE_LIBDEVQ, [test "x$HAVE_LIBDEVQ" = xyes])
36
+
37
 # xsltproc for docbook manpages
38
 AC_ARG_ENABLE([manpages],
39
               AS_HELP_STRING([--enable-manpages], [enable manpages @<:@default=auto@:>@]),
(-)graphics/libdrm/files/patch-Makefile.in (+13 lines)
Line 0 Link Here
1
--- Makefile.in.orig	2016-11-29 13:34:56 UTC
2
+++ Makefile.in
3
@@ -564,8 +564,8 @@ SUBDIRS = \
4
 libdrm_la_LTLIBRARIES = libdrm.la
5
 libdrm_ladir = $(libdir)
6
 libdrm_la_LDFLAGS = -version-number 2:4:0 -no-undefined
7
-libdrm_la_LIBADD = @CLOCK_LIB@ -lm
8
-libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm
9
+libdrm_la_LIBADD = @CLOCK_LIB@ -lm @LIBDEVQ_LIBS@
10
+libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm @LIBDEVQ_CFLAGS@
11
 AM_CFLAGS = \
12
 	$(WARN_CFLAGS) \
13
 	$(VALGRIND_CFLAGS)
(-)graphics/libdrm/files/patch-config.h.in (+22 lines)
Line 0 Link Here
1
--- config.h.in.orig	2016-11-29 13:34:54 UTC
2
+++ config.h.in
3
@@ -8,6 +8,9 @@
4
 /* Define to 1 if using `alloca.c'. */
5
 #undef C_ALLOCA
6
 
7
+/* Have DEVQ support */
8
+#undef DEVQ
9
+
10
 /* Define to 1 if you have `alloca', as a function or macro. */
11
 #undef HAVE_ALLOCA
12
 
13
@@ -51,6 +54,9 @@
14
 /* Define to 1 if you have the <inttypes.h> header file. */
15
 #undef HAVE_INTTYPES_H
16
 
17
+/* Have libdevq support */
18
+#undef HAVE_LIBDEVQ
19
+
20
 /* Enable if your compiler supports the Intel __sync_* atomic primitives */
21
 #undef HAVE_LIBDRM_ATOMIC_PRIMITIVES
22
 
(-)graphics/libdrm/files/patch-configure (+182 lines)
Line 0 Link Here
1
--- configure.orig	2017-01-15 13:16:10 UTC
2
+++ configure
3
@@ -646,6 +646,10 @@ HAVE_MANPAGES_STYLESHEET_TRUE
4
 MANPAGES_STYLESHEET
5
 BUILD_MANPAGES_FALSE
6
 BUILD_MANPAGES_TRUE
7
+HAVE_LIBDEVQ_FALSE
8
+HAVE_LIBDEVQ_TRUE
9
+LIBDEVQ_LIBS
10
+LIBDEVQ_CFLAGS
11
 HAVE_LIBUDEV_FALSE
12
 HAVE_LIBUDEV_TRUE
13
 LIBUDEV_LIBS
14
@@ -842,6 +846,7 @@ with_gnu_ld
15
 with_sysroot
16
 enable_libtool_lock
17
 enable_udev
18
+enable_devq
19
 enable_libkms
20
 enable_intel
21
 enable_radeon
22
@@ -885,6 +890,8 @@ CAIRO_CFLAGS
23
 CAIRO_LIBS
24
 LIBUDEV_CFLAGS
25
 LIBUDEV_LIBS
26
+LIBDEVQ_CFLAGS
27
+LIBDEVQ_LIBS
28
 VALGRIND_CFLAGS
29
 VALGRIND_LIBS'
30
 
31
@@ -1519,6 +1526,8 @@ Optional Features:
32
   --disable-libtool-lock  avoid locking (might break parallel builds)
33
   --enable-udev           Enable support for using udev instead of mknod
34
                           (default: disabled)
35
+  --enable-devq           Enable support for using devq for device detection
36
+                          (default: disabled)
37
   --disable-libkms        Disable KMS mm abstraction library (default: auto,
38
                           enabled on supported platforms)
39
   --disable-intel         Enable support for intel's KMS API (default: auto,
40
@@ -1602,6 +1611,10 @@ Some influential environment variables:
41
               C compiler flags for LIBUDEV, overriding pkg-config
42
   LIBUDEV_LIBS
43
               linker flags for LIBUDEV, overriding pkg-config
44
+  LIBDEVQ_CFLAGS
45
+              C compiler flags for LIBDEVQ, overriding pkg-config
46
+  LIBDEVQ_LIBS
47
+              linker flags for LIBDEVQ, overriding pkg-config
48
   VALGRIND_CFLAGS
49
               C compiler flags for VALGRIND, overriding pkg-config
50
   VALGRIND_LIBS
51
@@ -13440,6 +13453,14 @@ else
52
 fi
53
 
54
 
55
+# Check whether --enable-devq was given.
56
+if test "${enable_devq+set}" = set; then :
57
+  enableval=$enable_devq; DEVQ=$enableval
58
+else
59
+  DEVQ=no
60
+fi
61
+
62
+
63
 # Check whether --enable-libkms was given.
64
 if test "${enable_libkms+set}" = set; then :
65
   enableval=$enable_libkms; LIBKMS=$enableval
66
@@ -13976,6 +13997,12 @@ $as_echo "#define UDEV 1" >>confdefs.h
67
 
68
 fi
69
 
70
+if test "x$DEVQ" = xyes; then
71
+
72
+$as_echo "#define DEVQ 1" >>confdefs.h
73
+
74
+fi
75
+
76
 
77
 if test "x$LIBKMS" = xauto ; then
78
 	case $host_os in
79
@@ -14520,6 +14547,92 @@ else
80
 fi
81
 
82
 
83
+# For FreeBSD support
84
+
85
+pkg_failed=no
86
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDEVQ" >&5
87
+$as_echo_n "checking for LIBDEVQ... " >&6; }
88
+
89
+if test -n "$LIBDEVQ_CFLAGS"; then
90
+    pkg_cv_LIBDEVQ_CFLAGS="$LIBDEVQ_CFLAGS"
91
+ elif test -n "$PKG_CONFIG"; then
92
+    if test -n "$PKG_CONFIG" && \
93
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0 >= 0.0.4\""; } >&5
94
+  ($PKG_CONFIG --exists --print-errors "libdevq-1.0 >= 0.0.4") 2>&5
95
+  ac_status=$?
96
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
97
+  test $ac_status = 0; }; then
98
+  pkg_cv_LIBDEVQ_CFLAGS=`$PKG_CONFIG --cflags "libdevq-1.0 >= 0.0.4" 2>/dev/null`
99
+		      test "x$?" != "x0" && pkg_failed=yes
100
+else
101
+  pkg_failed=yes
102
+fi
103
+ else
104
+    pkg_failed=untried
105
+fi
106
+if test -n "$LIBDEVQ_LIBS"; then
107
+    pkg_cv_LIBDEVQ_LIBS="$LIBDEVQ_LIBS"
108
+ elif test -n "$PKG_CONFIG"; then
109
+    if test -n "$PKG_CONFIG" && \
110
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0 >= 0.0.4\""; } >&5
111
+  ($PKG_CONFIG --exists --print-errors "libdevq-1.0 >= 0.0.4") 2>&5
112
+  ac_status=$?
113
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
114
+  test $ac_status = 0; }; then
115
+  pkg_cv_LIBDEVQ_LIBS=`$PKG_CONFIG --libs "libdevq-1.0 >= 0.0.4" 2>/dev/null`
116
+		      test "x$?" != "x0" && pkg_failed=yes
117
+else
118
+  pkg_failed=yes
119
+fi
120
+ else
121
+    pkg_failed=untried
122
+fi
123
+
124
+
125
+
126
+if test $pkg_failed = yes; then
127
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
128
+$as_echo "no" >&6; }
129
+
130
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
131
+        _pkg_short_errors_supported=yes
132
+else
133
+        _pkg_short_errors_supported=no
134
+fi
135
+        if test $_pkg_short_errors_supported = yes; then
136
+	        LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdevq-1.0 >= 0.0.4" 2>&1`
137
+        else
138
+	        LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdevq-1.0 >= 0.0.4" 2>&1`
139
+        fi
140
+	# Put the nasty error message in config.log where it belongs
141
+	echo "$LIBDEVQ_PKG_ERRORS" >&5
142
+
143
+	HAVE_LIBDEVQ=no
144
+elif test $pkg_failed = untried; then
145
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
146
+$as_echo "no" >&6; }
147
+	HAVE_LIBDEVQ=no
148
+else
149
+	LIBDEVQ_CFLAGS=$pkg_cv_LIBDEVQ_CFLAGS
150
+	LIBDEVQ_LIBS=$pkg_cv_LIBDEVQ_LIBS
151
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
152
+$as_echo "yes" >&6; }
153
+	HAVE_LIBDEVQ=yes
154
+fi
155
+if test "x$HAVE_LIBDEVQ" = xyes; then
156
+
157
+$as_echo "#define HAVE_LIBDEVQ 1" >>confdefs.h
158
+
159
+fi
160
+ if test "x$HAVE_LIBDEVQ" = xyes; then
161
+  HAVE_LIBDEVQ_TRUE=
162
+  HAVE_LIBDEVQ_FALSE='#'
163
+else
164
+  HAVE_LIBDEVQ_TRUE='#'
165
+  HAVE_LIBDEVQ_FALSE=
166
+fi
167
+
168
+
169
 # xsltproc for docbook manpages
170
 # Check whether --enable-manpages was given.
171
 if test "${enable_manpages+set}" = set; then :
172
@@ -14930,6 +15043,10 @@ if test -z "${HAVE_LIBUDEV_TRUE}" && tes
173
   as_fn_error $? "conditional \"HAVE_LIBUDEV\" was never defined.
174
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
175
 fi
176
+if test -z "${HAVE_LIBDEVQ_TRUE}" && test -z "${HAVE_LIBDEVQ_FALSE}"; then
177
+  as_fn_error $? "conditional \"HAVE_LIBDEVQ\" was never defined.
178
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
179
+fi
180
 if test -z "${BUILD_MANPAGES_TRUE}" && test -z "${BUILD_MANPAGES_FALSE}"; then
181
   as_fn_error $? "conditional \"BUILD_MANPAGES\" was never defined.
182
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
(-)graphics/libdrm/files/patch-xf86drm.c (+187 lines)
Line 0 Link Here
1
--- xf86drm.c.orig	2017-01-15 13:16:10 UTC
2
+++ xf86drm.c
3
@@ -62,6 +62,10 @@
4
 #endif
5
 #include <math.h>
6
 
7
+#ifdef HAVE_LIBDEVQ
8
+#include "libdevq.h"
9
+#endif
10
+
11
 /* Not all systems have MAP_FAILED defined */
12
 #ifndef MAP_FAILED
13
 #define MAP_FAILED ((void *)-1)
14
@@ -82,8 +86,12 @@
15
 #define DRM_RENDER_MINOR_NAME   "renderD"
16
 #endif
17
 
18
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
19
-#define DRM_MAJOR 145
20
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
21
+#define DRM_MAJOR 0
22
+#endif
23
+
24
+#if defined(__DragonFly__)
25
+#define DRM_MAJOR 65 /* was 145 XXX needs checking */
26
 #endif
27
 
28
 #ifdef __NetBSD__
29
@@ -532,6 +540,7 @@ static int drmGetMinorType(int minor)
30
     }
31
 }
32
 
33
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
34
 static const char *drmGetMinorName(int type)
35
 {
36
     switch (type) {
37
@@ -545,6 +554,7 @@ static const char *drmGetMinorName(int t
38
         return NULL;
39
     }
40
 }
41
+#endif
42
 
43
 /**
44
  * Open the device by bus ID.
45
@@ -2817,6 +2827,15 @@ static char *drmGetMinorNameForFD(int fd
46
 
47
 out_close_dir:
48
     closedir(sysdir);
49
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
50
+    struct stat buf;
51
+    char name[64];
52
+
53
+    fstat(fd, &buf);
54
+    snprintf(name, sizeof(name), "/dev/%s",
55
+             devname(buf.st_rdev, S_IFCHR));
56
+
57
+    return strdup(name);
58
 #else
59
 #warning "Missing implementation of drmGetMinorNameForFD"
60
 #endif
61
@@ -2854,12 +2873,19 @@ static int drmParseSubsystemType(int maj
62
         return DRM_BUS_PCI;
63
 
64
     return -EINVAL;
65
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
66
+    /* XXX: Don't know how to get the subsystem type, hardcode for now.
67
+     * The code following the call to this function needs depends on
68
+     * information provided by the /pci subsystem on linux. No replacement
69
+     * found yet for FreeBSD. */
70
+    return DRM_BUS_PCI;
71
 #else
72
 #warning "Missing implementation of drmParseSubsystemType"
73
     return -EINVAL;
74
 #endif
75
 }
76
 
77
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
78
 static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
79
 {
80
 #ifdef __linux__
81
@@ -2901,6 +2927,61 @@ static int drmParsePciBusInfo(int maj, i
82
     return -EINVAL;
83
 #endif
84
 }
85
+#else
86
+
87
+/*
88
+ * XXX temporary workaround, because FreeBSD doesn't provide 
89
+ * pcibus device sysctl trees for renderD and controlD nodes (yet)
90
+ */
91
+static void
92
+drmBSDDeviceNameHack(const char *path, char *hacked_path, int length)
93
+{
94
+    int start, number;
95
+    const char *errstr;
96
+
97
+    if (strcmp(path, DRM_DIR_NAME "/controlD") > 0) {
98
+        start = 17;
99
+        number = strtonum(&path[start], 0, 256, &errstr) - 64;
100
+        snprintf(hacked_path, length, DRM_DIR_NAME "/card%i", number);
101
+    } else if (strcmp(path, DRM_DIR_NAME "/renderD") > 0) {
102
+        start = 16;
103
+        number = strtonum(&path[start], 0, 256, &errstr) - 128;
104
+        snprintf(hacked_path, length, DRM_DIR_NAME "/card%i", number);
105
+    } else
106
+        snprintf(hacked_path, length, "%s", path);
107
+
108
+  return;
109
+}
110
+
111
+static int
112
+drmParsePciBusInfoBSD(const char *path, drmPciBusInfoPtr info)
113
+{
114
+    int fd, ret;
115
+    int domain = 0, bus = 0, slot = 0, function = 0;
116
+    char hacked_path[PATH_MAX + 1];
117
+
118
+    drmBSDDeviceNameHack(path, hacked_path, PATH_MAX);
119
+    fd = open(hacked_path, O_RDONLY);
120
+
121
+    if (fd < 0)
122
+        return -errno;
123
+
124
+    ret = devq_device_get_pcibusaddr(fd, &domain, &bus, &slot, &function);
125
+
126
+    if (ret < 0) {
127
+        close(fd);
128
+        return -1;
129
+    }
130
+
131
+    info->domain = (uint16_t) domain;
132
+    info->bus = (uint8_t) bus;
133
+    info->dev = (uint8_t) slot;
134
+    info->func = (uint8_t) function;
135
+
136
+    close(fd);
137
+    return 0;
138
+}
139
+#endif
140
 
141
 static int drmCompareBusInfo(drmDevicePtr a, drmDevicePtr b)
142
 {
143
@@ -2971,6 +3052,31 @@ static int drmParsePciDeviceInfo(const c
144
     device->subdevice_id = config[46] | (config[47] << 8);
145
 
146
     return 0;
147
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
148
+    int fd, vendor_id = 0, device_id = 0, subvendor_id = 0, 
149
+        subdevice_id = 0, revision_id = 0;
150
+    char path[PATH_MAX + 1];
151
+    char hacked_path[PATH_MAX + 1];
152
+
153
+    snprintf(path, PATH_MAX, DRM_DIR_NAME "/%s", d_name);
154
+    drmBSDDeviceNameHack(path, hacked_path, PATH_MAX);
155
+
156
+    fd = open(hacked_path, O_RDONLY);
157
+
158
+    if (fd < 0)
159
+        return -errno;
160
+
161
+    devq_device_get_pciid_full_from_fd(fd, &vendor_id, &device_id,
162
+	&subvendor_id, &subdevice_id, &revision_id);
163
+
164
+    device->vendor_id = (uint16_t) vendor_id;
165
+    device->device_id = (uint16_t) device_id;
166
+    device->subvendor_id = (uint16_t) subvendor_id;
167
+    device->subdevice_id = (uint16_t) subdevice_id;
168
+    device->revision_id = (uint8_t) revision_id;
169
+
170
+    close(fd);
171
+    return 0;
172
 #else
173
 #warning "Missing implementation of drmParsePciDeviceInfo"
174
     return -EINVAL;
175
@@ -3030,7 +3136,12 @@ static int drmProcessPciDevice(drmDevice
176
 
177
     (*device)->businfo.pci = (drmPciBusInfoPtr)addr;
178
 
179
+#if defined(__FreeBSD__) || defined(__DragonFly__)
180
+    ret = drmParsePciBusInfoBSD(node, (*device)->businfo.pci);
181
+#else
182
     ret = drmParsePciBusInfo(maj, min, (*device)->businfo.pci);
183
+#endif
184
+
185
     if (ret)
186
         goto free_device;
187
 
(-)graphics/libdrm/files/patch-xf86drmMode.c (-3 / +3 lines)
Lines 2-9 Link Here
2
This sysctl is only available if a KMS module is loaded. But the libdrm
2
This sysctl is only available if a KMS module is loaded. But the libdrm
3
check happens before X got a chance of loading the KMS module.
3
check happens before X got a chance of loading the KMS module.
4
4
5
--- xf86drmMode.c.orig	2015-08-21 16:50:01.000000000 +0200
5
--- xf86drmMode.c.orig	2016-11-29 11:15:10 UTC
6
+++ xf86drmMode.c	2015-10-20 17:34:48.000000000 +0200
6
+++ xf86drmMode.c
7
@@ -47,6 +47,7 @@
7
@@ -47,6 +47,7 @@
8
 #include <stdlib.h>
8
 #include <stdlib.h>
9
 #include <sys/ioctl.h>
9
 #include <sys/ioctl.h>
Lines 12-18 Link Here
12
 #include <sys/sysctl.h>
12
 #include <sys/sysctl.h>
13
 #endif
13
 #endif
14
 #include <stdio.h>
14
 #include <stdio.h>
15
@@ -781,38 +782,7 @@ int drmCheckModesettingSupported(const c
15
@@ -797,38 +798,7 @@ int drmCheckModesettingSupported(const c
16
 	if (found)
16
 	if (found)
17
 		return 0;
17
 		return 0;
18
 #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
18
 #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
(-)graphics/libdrm/pkg-plist (-14 / +20 lines)
Lines 10-23 Link Here
10
%%INTEL_DRIVER%%include/libdrm/intel_debug.h
10
%%INTEL_DRIVER%%include/libdrm/intel_debug.h
11
include/libdrm/mach64_drm.h
11
include/libdrm/mach64_drm.h
12
include/libdrm/mga_drm.h
12
include/libdrm/mga_drm.h
13
%%NOUVEAU%%include/libdrm/nouveau/nouveau.h
13
%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nouveau.h
14
%%NOUVEAU%%include/libdrm/nouveau/nvif/cl0080.h
14
%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/cl0080.h
15
%%NOUVEAU%%include/libdrm/nouveau/nvif/cl9097.h
15
%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/cl9097.h
16
%%NOUVEAU%%include/libdrm/nouveau/nvif/class.h
16
%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/class.h
17
%%NOUVEAU%%include/libdrm/nouveau/nvif/if0002.h
17
%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/if0002.h
18
%%NOUVEAU%%include/libdrm/nouveau/nvif/if0003.h
18
%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/if0003.h
19
%%NOUVEAU%%include/libdrm/nouveau/nvif/ioctl.h
19
%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/ioctl.h
20
%%NOUVEAU%%include/libdrm/nouveau/nvif/unpack.h
20
%%NOUVEAU_DRIVER%%include/libdrm/nouveau/nvif/unpack.h
21
include/libdrm/nouveau_drm.h
21
include/libdrm/nouveau_drm.h
22
include/libdrm/qxl_drm.h
22
include/libdrm/qxl_drm.h
23
include/libdrm/r128_drm.h
23
include/libdrm/r128_drm.h
Lines 33-43 Link Here
33
include/libdrm/savage_drm.h
33
include/libdrm/savage_drm.h
34
include/libdrm/sis_drm.h
34
include/libdrm/sis_drm.h
35
include/libdrm/tegra_drm.h
35
include/libdrm/tegra_drm.h
36
include/libdrm/vc4_drm.h
37
%%ARM_DRIVERS%%include/libdrm/vc4_packet.h
38
%%ARM_DRIVERS%%include/libdrm/vc4_gpq_defines.h
36
include/libdrm/via_drm.h
39
include/libdrm/via_drm.h
37
include/libdrm/vc4_drm.h
38
include/libdrm/virtgpu_drm.h
40
include/libdrm/virtgpu_drm.h
41
%%KMS%%include/libkms/libkms.h
39
include/libsync.h
42
include/libsync.h
40
%%KMS%%include/libkms/libkms.h
41
include/xf86drm.h
43
include/xf86drm.h
42
include/xf86drmMode.h
44
include/xf86drmMode.h
43
lib/libdrm.so
45
lib/libdrm.so
Lines 49-60 Link Here
49
%%INTEL_DRIVER%%lib/libdrm_intel.so
51
%%INTEL_DRIVER%%lib/libdrm_intel.so
50
%%INTEL_DRIVER%%lib/libdrm_intel.so.1
52
%%INTEL_DRIVER%%lib/libdrm_intel.so.1
51
%%INTEL_DRIVER%%lib/libdrm_intel.so.1.0.0
53
%%INTEL_DRIVER%%lib/libdrm_intel.so.1.0.0
52
%%NOUVEAU%%lib/libdrm_nouveau.so
54
%%NOUVEAU_DRIVER%%lib/libdrm_nouveau.so
53
%%NOUVEAU%%lib/libdrm_nouveau.so.2
55
%%NOUVEAU_DRIVER%%lib/libdrm_nouveau.so.2
54
%%NOUVEAU%%lib/libdrm_nouveau.so.2.0.0
56
%%NOUVEAU_DRIVER%%lib/libdrm_nouveau.so.2.0.0
55
%%RADEON_DRIVERS%%lib/libdrm_radeon.so
57
%%RADEON_DRIVERS%%lib/libdrm_radeon.so
56
%%RADEON_DRIVERS%%lib/libdrm_radeon.so.1
58
%%RADEON_DRIVERS%%lib/libdrm_radeon.so.1
57
%%RADEON_DRIVERS%%lib/libdrm_radeon.so.1.0.1
59
%%RADEON_DRIVERS%%lib/libdrm_radeon.so.1.0.1
60
%%ARM_DRIVERS%%lib/libdrm_vc4.so
61
%%ARM_DRIVERS%%lib/libdrm_vc4.so.1
62
%%ARM_DRIVERS%%lib/libdrm_vc4.so.1.0.0
58
%%KMS%%lib/libkms.so
63
%%KMS%%lib/libkms.so
59
%%KMS%%lib/libkms.so.1
64
%%KMS%%lib/libkms.so.1
60
%%KMS%%lib/libkms.so.1.0.0
65
%%KMS%%lib/libkms.so.1.0.0
Lines 61-68 Link Here
61
libdata/pkgconfig/libdrm.pc
66
libdata/pkgconfig/libdrm.pc
62
%%RADEON_DRIVERS%%libdata/pkgconfig/libdrm_amdgpu.pc
67
%%RADEON_DRIVERS%%libdata/pkgconfig/libdrm_amdgpu.pc
63
%%INTEL_DRIVER%%libdata/pkgconfig/libdrm_intel.pc
68
%%INTEL_DRIVER%%libdata/pkgconfig/libdrm_intel.pc
64
%%NOUVEAU%%libdata/pkgconfig/libdrm_nouveau.pc
69
%%NOUVEAU_DRIVER%%libdata/pkgconfig/libdrm_nouveau.pc
65
%%RADEON_DRIVERS%%libdata/pkgconfig/libdrm_radeon.pc
70
%%RADEON_DRIVERS%%libdata/pkgconfig/libdrm_radeon.pc
71
%%ARM_DRIVERS%%libdata/pkgconfig/libdrm_vc4.pc
66
%%KMS%%libdata/pkgconfig/libkms.pc
72
%%KMS%%libdata/pkgconfig/libkms.pc
67
%%MAN%%man/man3/drmAvailable.3.gz
73
%%MAN%%man/man3/drmAvailable.3.gz
68
%%MAN%%man/man3/drmHandleEvent.3.gz
74
%%MAN%%man/man3/drmHandleEvent.3.gz

Return to bug 214580