Unable to build graphics/dri on amd64 due to missing libdrm_intel

Konstantin Belousov kostikbel at gmail.com
Sun Jul 1 07:48:38 UTC 2012


On Sun, Jul 01, 2012 at 01:35:58AM -0600, John Hein wrote:
> Conrad J. Sabatier wrote at 18:40 -0500 on Jun 30, 2012:
>  > configure: error: Package requirements (libdrm_intel >= 2.4.30) were not met:
> 
> Pretty clear there.  Build the appropriate version of libdrm, which
> (if you peruse libdrm/Makefile) means build it with WITH_NEW_XORG.

I was reminded recently that recent libdrm requires a patch on amd64,
since they do not want to build intel bufmgr on anything not i386
or x86_64. FreeBSD names the later arch as amd64.

Below is the current drop of my diff against upstream libdrm.

diff --git a/configure.ac b/configure.ac
index a1c8c69..ebe06f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,6 +175,7 @@ AC_CANONICAL_HOST
 if test "x$LIBKMS" = xauto ; then
 	case $host_os in
 		linux*)		LIBKMS="yes" ;;
+		freebsd*)	LIBKMS="yes" ;;
 		*)		LIBKMS="no" ;;
 	esac
 fi
@@ -273,7 +274,7 @@ if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno"; then
     else
            if test "x$INTEL" != "xno"; then
                    case $host_cpu in
-                           i?86|x86_64) INTEL=yes ;;
+                           i?86|x86_64|amd64) INTEL=yes ;;
                            *) INTEL=no ;;
                    esac
            fi
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 04fdf1f..f7cae5f 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -686,7 +686,7 @@ int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property
 */
 int drmCheckModesettingSupported(const char *busid)
 {
-#ifdef __linux__
+#if defined (__linux__)
 	char pci_dev_dir[1024];
 	int domain, bus, dev, func;
 	DIR *sysdir;
@@ -736,6 +736,39 @@ int drmCheckModesettingSupported(const char *busid)
 	closedir(sysdir);
 	if (found)
 		return 0;
+#elif defined(__FreeBSD__)
+	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);
+	}
 #endif
 	return -ENOSYS;
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-x11/attachments/20120701/386b9a5d/attachment.pgp


More information about the freebsd-x11 mailing list