New DRM driver model - gets rid of DRM() macros!

Keith Whitwell keith at
Wed Sep 29 07:39:37 PDT 2004

Keith Whitwell wrote:
> Christoph Hellwig wrote:
>> On Wed, Sep 29, 2004 at 03:12:03PM +0100, Keith Whitwell wrote:
>>> Thinking about it, it may not have been a problem of crashing, but 
>>> rather that  the behaviour visible from a program attempting to read 
>>> (or poll) was different with noop versions of these functions to NULL 
>>> versions, and that was causing problems.  This is 18 months ago, so 
>>> yes, I'm being vague.
>>> The X server does look at this file descriptor, which is where the 
>>> problem would have arisen, but only the gamma & maybe ffb drivers do 
>>> anything with it.
>> Indeed, for read you're returning 0 now instead of the -EINVAL from 
>> common
>> code when no ->read is present.  I'd say the current drm behaviour is 
>> a bug,
>> but if X drivers rely on it.
> I'd agree, but it's a widely distributed bug.  I guess we can fix it in 
> the X server, but even better would be to rip out the code as it's 
> fundamentally misguided, based on a wierd idea that the kernel would 
> somehow ask the X server to perform a context switch between two 
> userspace clients...

The piece of the puzzle you're missing is that the read() function really did 
used to do something, and was relied upon.

If you want to go right back to prehistory, the drm was originally designed as 
a "core + personality" system, where the core supported a number of different 
context switching mechanisms to cover a variety of hardware cases.  The gamma 
driver exercised one path, but everything since then has been a lot more 
simplistic, assuming that the hardware state is lost if another context has 
been active.

Hardware often has the capacity to hold multiple active contexts or to perform 
fast hardware context save & restore.  None of the DRI drivers have attempted 
to take advantage of that - optimization continues to focus on the 
single-client scenario.

A future X-on-GL world where regular applications are presumably doing direct 
rendering will change that assumption...


More information about the xorg mailing list