From owner-freebsd-x11@FreeBSD.ORG Sun Jul 1 07:48:38 2012 Return-Path: Delivered-To: freebsd-x11@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A51FB106566B for ; Sun, 1 Jul 2012 07:48:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 3B6BD8FC08 for ; Sun, 1 Jul 2012 07:48:38 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q617mf9B033336; Sun, 1 Jul 2012 10:48:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q617mTgW039513; Sun, 1 Jul 2012 10:48:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q617mTGN039512; Sun, 1 Jul 2012 10:48:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 1 Jul 2012 10:48:29 +0300 From: Konstantin Belousov To: John Hein Message-ID: <20120701074829.GK2337@deviant.kiev.zoral.com.ua> References: <20120630184036.1e1d2cfe@serene.no-ip.org> <20463.64990.503041.475861@gromit.timing.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NMwIT2wBMwG6kIzG" Content-Disposition: inline In-Reply-To: <20463.64990.503041.475861@gromit.timing.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, URIBL_BLACK autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-x11@freebsd.org Subject: Re: Unable to build graphics/dri on amd64 due to missing libdrm_intel X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jul 2012 07:48:38 -0000 --NMwIT2wBMwG6kIzG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=3D 2.4.30) were= not met: >=20 > 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" =3D xauto ; then case $host_os in linux*) LIBKMS=3D"yes" ;; + freebsd*) LIBKMS=3D"yes" ;; *) LIBKMS=3D"no" ;; esac fi @@ -273,7 +274,7 @@ if test "x$INTEL" !=3D "xno" -o "x$RADEON" !=3D "xno" -= o "x$NOUVEAU" !=3D "xno"; then else if test "x$INTEL" !=3D "xno"; then case $host_cpu in - i?86|x86_64) INTEL=3Dyes ;; + i?86|x86_64|amd64) INTEL=3Dyes ;; *) INTEL=3Dno ;; 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 connec= tor_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 =3D sscanf(busid, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, + &func); + if (ret !=3D 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 =3D 0; i < 16; i++) { + snprintf(oid, sizeof(oid), "hw.dri.%d.busid", i); + len =3D sizeof(sbusid); + ret =3D sysctlbyname(oid, sbusid, &len, NULL, 0); + if (ret =3D=3D -1) { + if (errno =3D=3D ENOENT) + continue; + return -EINVAL; + } + if (strcmp(sbusid, kbusid) !=3D 0) + continue; + snprintf(oid, sizeof(oid), "hw.dri.%d.modesetting", i); + len =3D sizeof(modesetting); + ret =3D sysctlbyname(oid, &modesetting, &len, NULL, 0); + if (ret =3D=3D -1 || len !=3D sizeof(modesetting)) + return -EINVAL; + return (modesetting ? 0 : -ENOSYS); + } #endif return -ENOSYS; =20 --NMwIT2wBMwG6kIzG Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/wAMwACgkQC3+MBN1Mb4hivgCeJpx3ZMIlo8GNyY6UYfZUKnE/ ySsAoLyypy2F4XMVjx529WBjaJBAPT9N =2qBI -----END PGP SIGNATURE----- --NMwIT2wBMwG6kIzG--