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

Collapse All | Expand All

(-)graphics/libdrm/Makefile (-1 / +10 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	libdrm
4
PORTNAME=	libdrm
5
PORTVERSION=	2.4.66
5
PORTVERSION=	2.4.73
6
PORTEPOCH=	1
6
PORTEPOCH=	1
7
CATEGORIES=	graphics x11
7
CATEGORIES=	graphics x11
8
MASTER_SITES=	http://dri.freedesktop.org/libdrm/
8
MASTER_SITES=	http://dri.freedesktop.org/libdrm/
Lines 10-16 Link Here
10
MAINTAINER=	x11@FreeBSD.org
10
MAINTAINER=	x11@FreeBSD.org
11
COMMENT=	Userspace interface to kernel Direct Rendering Module services
11
COMMENT=	Userspace interface to kernel Direct Rendering Module services
12
12
13
BUILD_DEPENDS=	libdevq>=0.0.4:devel/libdevq
13
LIB_DEPENDS=	libpciaccess.so:devel/libpciaccess \
14
LIB_DEPENDS=	libpciaccess.so:devel/libpciaccess \
15
		libdevq.so:devel/libdevq \
14
		libpthread-stubs.so:devel/libpthread-stubs
16
		libpthread-stubs.so:devel/libpthread-stubs
15
17
16
USES=		libtool pkgconfig tar:bzip2
18
USES=		libtool pkgconfig tar:bzip2
Lines 51-62 Link Here
51
.if ${ARCH} == amd64 || ${ARCH} == i386
53
.if ${ARCH} == amd64 || ${ARCH} == i386
52
PLIST_SUB+=	INTEL_DRIVER=""
54
PLIST_SUB+=	INTEL_DRIVER=""
53
PLIST_SUB+=	RADEON_DRIVERS=""
55
PLIST_SUB+=	RADEON_DRIVERS=""
56
PLIST_SUB+=	VC4_DRIVERS="@comment "
54
.elif ${ARCH} == ia64 || ${ARCH} == powerpc || ${ARCH} == powerpc64
57
.elif ${ARCH} == ia64 || ${ARCH} == powerpc || ${ARCH} == powerpc64
55
PLIST_SUB+=	INTEL_DRIVER="@comment "
58
PLIST_SUB+=	INTEL_DRIVER="@comment "
56
PLIST_SUB+=	RADEON_DRIVERS=""
59
PLIST_SUB+=	RADEON_DRIVERS=""
60
PLIST_SUB+=	VC4_DRIVERS="@comment "
61
.elif ${ARCH} == arm6 || ${ARCH} == aarch64
62
PLIST_SUB+=	INTEL_DRIVER="@comment "
63
PLIST_SUB+=	RADEON_DRIVERS="@comment "
64
PLIST_SUB+=	VC4_DRIVERS=""
57
.else
65
.else
58
PLIST_SUB+=	INTEL_DRIVER="@comment "
66
PLIST_SUB+=	INTEL_DRIVER="@comment "
59
PLIST_SUB+=	RADEON_DRIVERS="@comment "
67
PLIST_SUB+=	RADEON_DRIVERS="@comment "
68
PLIST_SUB+=	VC4_DRIVERS="@comment "
60
.endif
69
.endif
61
70
62
# This variable is not for users. So use a non-default name, intended for
71
# This variable is not for users. So use a non-default name, intended for
(-)graphics/libdrm/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (libdrm-2.4.66.tar.bz2) = 79cb8e988749794edfb2d777b298d5292eff353bbbb71ed813589e61d2bc2d76
1
TIMESTAMP = 1479391762
2
SIZE (libdrm-2.4.66.tar.bz2) = 694574
2
SHA256 (libdrm-2.4.73.tar.bz2) = 96bfd39242fe168017d95f22e141645a35591f5902a7d98c2fa4ca8c31df5e4d
3
SIZE (libdrm-2.4.73.tar.bz2) = 777305
(-)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/extra-xf86drm.c (-1 / +1 lines)
Lines 11-17 Link Here
11
@@ -174,7 +174,7 @@
11
@@ -174,7 +174,7 @@
12
 
12
 
13
     do {
13
     do {
14
 	ret = ioctl(fd, request, arg);
14
         ret = ioctl(fd, request, arg);
15
-    } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
15
-    } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
16
+    } while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == 512));
16
+    } while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == 512));
17
     return ret;
17
     return ret;
(-)graphics/libdrm/files/patch-Makefile.in (+13 lines)
Line 0 Link Here
1
--- Makefile.in.orig	2016-06-28 12:57:42.345759000 +0200
2
+++ Makefile.in	2016-06-28 12:58:17.744034000 +0200
3
@@ -553,8 +553,8 @@
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-06-24 22:01:22.827102000 +0200
2
+++ config.h.in	2016-06-24 22:01:44.000000000 +0200
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
@@ -48,6 +51,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	2016-07-09 18:52:55.554602000 +0200
2
+++ configure	2016-07-09 18:54:17.173605000 +0200
3
@@ -646,6 +646,10 @@
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
@@ -840,6 +844,7 @@
15
 with_sysroot
16
 enable_libtool_lock
17
 enable_udev
18
+enable_devq
19
 enable_libkms
20
 enable_intel
21
 enable_radeon
22
@@ -882,6 +887,8 @@
23
 CAIRO_LIBS
24
 LIBUDEV_CFLAGS
25
 LIBUDEV_LIBS
26
+LIBDEVQ_CFLAGS
27
+LIBDEVQ_LIBS
28
 VALGRIND_CFLAGS
29
 VALGRIND_LIBS'
30
 
31
@@ -1516,6 +1523,8 @@
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
@@ -1596,6 +1605,10 @@
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
@@ -13384,6 +13397,14 @@
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
@@ -13902,6 +13923,12 @@
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
@@ -14432,6 +14459,92 @@
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
@@ -14838,6 +14951,10 @@
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-tests_kms_kms-universal-planes.c (-10 lines)
Lines 1-10 Link Here
1
--- tests/kms/kms-universal-planes.c.orig	2016-02-15 12:05:56.305353000 +0100
2
+++ tests/kms/kms-universal-planes.c	2016-02-15 12:06:11.194126000 +0100
3
@@ -32,6 +32,7 @@
4
 #include <stdio.h>
5
 #include <string.h>
6
 #include <unistd.h>
7
+#include <sys/select.h>
8
 
9
 #include <drm_fourcc.h>
10
 #include "xf86drm.h"
(-)graphics/libdrm/files/patch-xf86drm.c (+193 lines)
Line 0 Link Here
1
--- xf86drm.c.orig	2016-07-24 20:50:03.999898000 +0200
2
+++ xf86drm.c	2016-07-24 20:53:31.587058000 +0200
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 154 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,66 @@ 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 char *
92
+drmBSDDeviceNameHack(const char *path)
93
+{
94
+    int start;
95
+    const char *errstr;
96
+    int number;
97
+    char hacked_path[PATH_MAX + 1];
98
+
99
+    if (strcmp(path, DRM_DIR_NAME "/controlD") > 0) 
100
+    {
101
+      start = 17;
102
+      number = strtonum(&path[start], 0, 256, &errstr) - 64;
103
+      snprintf(hacked_path, PATH_MAX, DRM_DIR_NAME "/card%i", number);
104
+    }else if (strcmp(path, DRM_DIR_NAME "/renderD") > 0)
105
+    {
106
+      start = 16;
107
+      number = strtonum(&path[start], 0, 256, &errstr) - 128;
108
+      snprintf(hacked_path, PATH_MAX, DRM_DIR_NAME "/card%i", number);
109
+    }else
110
+      snprintf(hacked_path, PATH_MAX, "%s", path);
111
+
112
+  return hacked_path;
113
+}
114
+
115
+static int
116
+drmParsePciBusInfoBSD(const char *path, drmPciBusInfoPtr info)
117
+{
118
+    int fd, ret;
119
+    int domain = 0, bus = 0, slot = 0, function = 0;
120
+
121
+    char hacked_path[PATH_MAX + 1];
122
+
123
+    snprintf(hacked_path, PATH_MAX, "%s", drmBSDDeviceNameHack(path));
124
+
125
+    fd = open(hacked_path, O_RDONLY);
126
+
127
+    if (fd < 0)
128
+      return -errno;
129
+
130
+    ret = devq_device_get_pcibusaddr(fd, &domain, &bus, &slot, &function);
131
+
132
+    if (ret < 0)
133
+      return -1;
134
+
135
+    info->domain = (uint16_t) domain;
136
+    info->bus = (uint8_t) bus;
137
+    info->dev = (uint8_t) slot;
138
+    info->func = (uint8_t) function;
139
+
140
+    close(fd);
141
+
142
+    return 0;
143
+}
144
+#endif
145
 
146
 static int drmCompareBusInfo(drmDevicePtr a, drmDevicePtr b)
147
 {
148
@@ -2971,6 +3057,32 @@ static int drmParsePciDeviceInfo(const c
149
     device->subdevice_id = config[46] | (config[47] << 8);
150
 
151
     return 0;
152
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
153
+
154
+    int fd, vendor_id = 0, device_id = 0, subvendor_id = 0, 
155
+	subdevice_id = 0, revision_id = 0;
156
+    char path[PATH_MAX + 1];
157
+    char hacked_path[PATH_MAX + 1];
158
+
159
+    snprintf(path, PATH_MAX, DRM_DIR_NAME "/%s", d_name);
160
+
161
+    snprintf(hacked_path, PATH_MAX, "%s", drmBSDDeviceNameHack(path));
162
+
163
+    fd = open(hacked_path, O_RDONLY);
164
+
165
+    if (fd < 0)
166
+        return -errno;
167
+
168
+    devq_device_get_pciid_full_from_fd(fd, &vendor_id, &device_id,
169
+	&subvendor_id, &subdevice_id, &revision_id);
170
+
171
+    device->vendor_id = (uint16_t) vendor_id;
172
+    device->device_id = (uint16_t) device_id;
173
+    device->subvendor_id = (uint16_t) subvendor_id;
174
+    device->subdevice_id = (uint16_t) subdevice_id;
175
+    device->revision_id = (uint8_t) revision_id;
176
+
177
+    return 0;
178
 #else
179
 #warning "Missing implementation of drmParsePciDeviceInfo"
180
     return -EINVAL;
181
@@ -3029,7 +3141,12 @@ static int drmProcessPciDevice(drmDevice
182
 
183
     (*device)->businfo.pci = (drmPciBusInfoPtr)addr;
184
 
185
+#if defined(__FreeBSD__) || defined(__DragonFly__)
186
+    ret = drmParsePciBusInfoBSD(node, (*device)->businfo.pci);
187
+#else
188
     ret = drmParsePciBusInfo(maj, min, (*device)->businfo.pci);
189
+#endif
190
+
191
     if (ret)
192
         goto free_device;
193
(-)graphics/libdrm/pkg-plist (+9 lines)
Lines 33-40 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
%%VC4_DRIVERS%%include/libdrm/vc4_packet.h
38
%%VC4_DRIVERS%%include/libdrm/vc4_gpq_defines.h
36
include/libdrm/via_drm.h
39
include/libdrm/via_drm.h
40
include/libdrm/virtgpu_drm.h
37
%%KMS%%include/libkms/libkms.h
41
%%KMS%%include/libkms/libkms.h
42
include/libsync.h
38
include/xf86drm.h
43
include/xf86drm.h
39
include/xf86drmMode.h
44
include/xf86drmMode.h
40
lib/libdrm.so
45
lib/libdrm.so
Lines 52-57 Link Here
52
%%RADEON_DRIVERS%%lib/libdrm_radeon.so
57
%%RADEON_DRIVERS%%lib/libdrm_radeon.so
53
%%RADEON_DRIVERS%%lib/libdrm_radeon.so.1
58
%%RADEON_DRIVERS%%lib/libdrm_radeon.so.1
54
%%RADEON_DRIVERS%%lib/libdrm_radeon.so.1.0.1
59
%%RADEON_DRIVERS%%lib/libdrm_radeon.so.1.0.1
60
%%VC4_DRIVERS%%lib/libdrm_vc4.so
61
%%VC4_DRIVERS%%lib/libdrm_vc4.so.1
62
%%VC4_DRIVERS%%lib/libdrm_vc4.so.1.0.0
55
%%KMS%%lib/libkms.so
63
%%KMS%%lib/libkms.so
56
%%KMS%%lib/libkms.so.1
64
%%KMS%%lib/libkms.so.1
57
%%KMS%%lib/libkms.so.1.0.0
65
%%KMS%%lib/libkms.so.1.0.0
Lines 60-65 Link Here
60
%%INTEL_DRIVER%%libdata/pkgconfig/libdrm_intel.pc
68
%%INTEL_DRIVER%%libdata/pkgconfig/libdrm_intel.pc
61
%%NOUVEAU%%libdata/pkgconfig/libdrm_nouveau.pc
69
%%NOUVEAU%%libdata/pkgconfig/libdrm_nouveau.pc
62
%%RADEON_DRIVERS%%libdata/pkgconfig/libdrm_radeon.pc
70
%%RADEON_DRIVERS%%libdata/pkgconfig/libdrm_radeon.pc
71
%%VC4_DRIVERS%%libdata/pkgconfig/libdrm_vc4.pc
63
%%KMS%%libdata/pkgconfig/libkms.pc
72
%%KMS%%libdata/pkgconfig/libkms.pc
64
%%MAN%%man/man3/drmAvailable.3.gz
73
%%MAN%%man/man3/drmAvailable.3.gz
65
%%MAN%%man/man3/drmHandleEvent.3.gz
74
%%MAN%%man/man3/drmHandleEvent.3.gz

Return to bug 214580