From owner-freebsd-x11@FreeBSD.ORG Mon Jul 16 10:26:27 2007 Return-Path: X-Original-To: freebsd-x11@freebsd.org Delivered-To: freebsd-x11@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A635D16A404 for ; Mon, 16 Jul 2007 10:26:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay01.kiev.sovam.com (relay01.kiev.sovam.com [62.64.120.200]) by mx1.freebsd.org (Postfix) with ESMTP id 3B67F13C441 for ; Mon, 16 Jul 2007 10:26:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [89.162.146.170] (helo=skuns.kiev.zoral.com.ua) by relay01.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1IANQ2-00050V-RV for freebsd-x11@freebsd.org; Mon, 16 Jul 2007 13:03:09 +0300 Received: from deviant.kiev.zoral.com.ua (root@[10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l6GA2sCg017783 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 16 Jul 2007 13:02:54 +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.1/8.14.1) with ESMTP id l6GA2rNf078061; Mon, 16 Jul 2007 13:02:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l6GA2rqV078060; Mon, 16 Jul 2007 13:02:53 +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: Mon, 16 Jul 2007 13:02:53 +0300 From: Kostik Belousov To: vehemens Message-ID: <20070716100252.GS2200@deviant.kiev.zoral.com.ua> References: <200707030247.52207.vehemens@verizon.net> <1183974697.15243.58.camel@thor.sulgenrain.local> <200707092112.06905.vehemens@verizon.net> <200707150231.03162.vehemens@verizon.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="g/o8sqaH6XVFI89B" Content-Disposition: inline In-Reply-To: <200707150231.03162.vehemens@verizon.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.90.3, clamav-milter version 0.90.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.2.1 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on skuns.kiev.zoral.com.ua X-Scanner-Signature: 16f7817bad8e28cbcc8c205d7fb50ad4 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1223 [July 16 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {TO: seems autogenerated} X-SpamTest-Method: none X-SpamTest-Rate: 10 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: freebsd-x11@freebsd.org Subject: Re: RADEON/AIGLX/DRM Problem 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: Mon, 16 Jul 2007 10:26:27 -0000 --g/o8sqaH6XVFI89B Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jul 15, 2007 at 02:31:02AM -0700, vehemens wrote: > The problem with the RADEON driver failing when run with the AIGLX extens= ion=20 > appears to be a problem with the DRM piece (library and/or driver). >=20 > What is happening is that the RADEON driver initializes DRM and sets a lo= ck=20 > using one file descriptor. When the AIGLX extension loads, it probes vi= a=20 > DRM using open/close calls on another file descriptor. >=20 > As both the RADEON driver and the AIGLX extension are part of the same=20 > process, the AIGLX probe close calls drm_close which removes the DRI lock= =20 > causing the RADEON driver to fail during xserver initialization (i.e. sys= tem=20 > hang). >=20 > Just to complicate the issue, I've been told that this doesn't occur with= =20 > linux with the suggestion that the BSD driver is broken or that the close= =20 > semantics are different between the two operating systems. >=20 > I'm looking for ideas here as I don't know what direction to go in a this= =20 > point. The following may change the behaviour of the drm_close() somewhat in needed direction. It does all cleanup only on last close. I am completely unsure whether this is right, and whether it would help. It seems that normal drm dev cloning is needed there. Patch only compile tested. diff --git a/sys/dev/drm/drm_drv.c b/sys/dev/drm/drm_drv.c index dda03c1..b7c9ab9 100644 --- a/sys/dev/drm/drm_drv.c +++ b/sys/dev/drm/drm_drv.c @@ -711,6 +711,15 @@ int drm_close(struct cdev *kdev, int flags, int fmt, D= RM_STRUCTPROC *p) return EINVAL; } =20 + atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); +#ifdef __FreeBSD__ + device_unbusy(dev->device); +#endif + if (--dev->open_count !=3D 0) { + DRM_UNLOCK(); + return (0); + } + if (dev->driver.preclose !=3D NULL) dev->driver.preclose(dev, filp); =20 @@ -797,13 +806,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt, D= RM_STRUCTPROC *p) * End inline drm_release */ =20 - atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); -#ifdef __FreeBSD__ - device_unbusy(dev->device); -#endif - if (--dev->open_count =3D=3D 0) { - retcode =3D drm_lastclose(dev); - } + + retcode =3D drm_lastclose(dev); =20 DRM_UNLOCK(); =09 --g/o8sqaH6XVFI89B Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGm0JMC3+MBN1Mb4gRAqjPAKDI/9R2vQ5lOrAimivMUxkK7neDmACfZgrc 1HSwFEq+/R0kkeN2qp4wOBo= =hpa2 -----END PGP SIGNATURE----- --g/o8sqaH6XVFI89B--