Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2007 10:00:51 +0800
From:      Ganbold <ganbold@micom.mng.net>
To:        vehemens <vehemens@verizon.net>
Cc:        freebsd-x11@freebsd.org
Subject:   Re: RADEON/AIGLX/DRM Problem
Message-ID:  <46A80053.4020105@micom.mng.net>
In-Reply-To: <200707251346.39940.vehemens@verizon.net>
References:  <200707030247.52207.vehemens@verizon.net>	<200707150231.03162.vehemens@verizon.net>	<20070716100252.GS2200@deviant.kiev.zoral.com.ua> <200707251346.39940.vehemens@verizon.net>

next in thread | previous in thread | raw e-mail | index | archive | help
vehemens wrote:
> On Monday 16 July 2007 03:02:53 am Kostik Belousov wrote:
>   
>> On Sun, Jul 15, 2007 at 02:31:02AM -0700, vehemens wrote:
>>     
>>> The problem with the RADEON driver failing when run with the AIGLX
>>> extension appears to be a problem with the DRM piece (library and/or
>>> driver).
>>>
>>> What is happening is that the RADEON driver initializes DRM and sets a
>>> lock using one file descriptor.   When the AIGLX extension loads, it
>>> probes via DRM using open/close calls on another file descriptor.
>>>
>>> As both the RADEON driver and the AIGLX extension are part of the same
>>> process, the AIGLX probe close calls drm_close which removes the DRI lock
>>> causing the RADEON driver to fail during xserver initialization (i.e.
>>> system hang).
>>>
>>> Just to complicate the issue, I've been told that this doesn't occur with
>>> linux with the suggestion that the BSD driver is broken or that the close
>>> semantics are different between the two operating systems.
>>>
>>> I'm looking for ideas here as I don't know what direction to go in a this
>>> 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,
>> DRM_STRUCTPROC *p) return EINVAL;
>>  	}
>>
>> +	atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );
>> +#ifdef __FreeBSD__
>> +	device_unbusy(dev->device);
>> +#endif
>> +	if (--dev->open_count != 0) {
>> +		DRM_UNLOCK();
>> +		return (0);
>> +	}
>> +
>>  	if (dev->driver.preclose != NULL)
>>  		dev->driver.preclose(dev, filp);
>>
>> @@ -797,13 +806,8 @@ int drm_close(struct cdev *kdev, int flags, int fmt,
>> DRM_STRUCTPROC *p) * End inline drm_release
>>  	 */
>>
>> -	atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );
>> -#ifdef __FreeBSD__
>> -	device_unbusy(dev->device);
>> -#endif
>> -	if (--dev->open_count == 0) {
>> -		retcode = drm_lastclose(dev);
>> -	}
>> +
>> +	retcode = drm_lastclose(dev);
>>
>>  	DRM_UNLOCK();
>>     
>
> I did try your patch.  It allows me to remove all of my workarounds.  In 
> addition, I no longer have the xserver exit hangs.
>
> I get a white screen when I restart the xserver and beryl.  This is probably 
> the driver not restoring the card state on exit.
>
> I havn't looked at the driver code on the use of device_unbusy(dev->device) 
> yet, but was wondering if it really should be per close?
>
> It does appear to be the best solution and probably the right one at this 
> point.
>
>   

I tried this patch. Now X works with AIGLX enabled. Of course beryl 
works with white screen :)
However when I try to run googleearth, it crashes X. When I kill beryl, 
X crashes too.

Ganbold


> _______________________________________________
> freebsd-x11@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-x11
> To unsubscribe, send any mail to "freebsd-x11-unsubscribe@freebsd.org"
>
>
>
>   


-- 
Make sure your code does nothing gracefully.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46A80053.4020105>