Date: Sun, 1 Jul 2012 10:48:29 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: John Hein <jhein@symmetricom.com> Cc: freebsd-x11@freebsd.org Subject: Re: Unable to build graphics/dri on amd64 due to missing libdrm_intel Message-ID: <20120701074829.GK2337@deviant.kiev.zoral.com.ua> In-Reply-To: <20463.64990.503041.475861@gromit.timing.com> References: <20120630184036.1e1d2cfe@serene.no-ip.org> <20463.64990.503041.475861@gromit.timing.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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;
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)
iEYEARECAAYFAk/wAMwACgkQC3+MBN1Mb4hivgCeJpx3ZMIlo8GNyY6UYfZUKnE/
ySsAoLyypy2F4XMVjx529WBjaJBAPT9N
=2qBI
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120701074829.GK2337>
