> > The kernel interfaces are highly dependent on the hardware they work
> > with.
> 
> different in the sense that they all have a common collection of 
> fundamental activities and they all have a collection of disparate 
> activities?
> 
> or different in the sense that they have *no* common collection of 
> fundamental activities and they all have a collection of disparate 
> activities?

Some of the functionality can be generalized and is done in the same way
across boards, some can't. Memory mapping the board and dispatching DMA
are things that are standardized. You'll find they are templated by
using macros. 

Let's say you're card has some form of primary buffer which contains
control functions, and a secondary buffer which contains data for those
functions. For example you put the "draw triangles" command in a primary
buffer and the triangle vertices in the secondary buffer. This isn't
going to be templated because it is specific to your card. You might be
able to fill in both of those buffers safely and securely from user
space. 

Now let's say your card also supports DMA blit as a command. If
you allow that command to be accessed from user space you could DMA
kernel data (or other process data) into the board (which you could then
read back) and that would be a security hole. In that case you might
still dispatch the vertex data directly from user space, but you might
create interfaces that do a draw triangles or do a DMA blit. The kernel
interface would manage the primary buffer, but you'd save the extra work
of handling the secondary buffer.

If it turns out that the board doesn't handle bad vertices well, say
because it hangs the board, then you would need to verify that the
triangles are good before sending them to the board and that would
require sending them through a kernel interface that would check
them. That same sort of checking could be used as another technique for
the primary buffer. Instead of submitting the commands through a kernel
interface you could build up a big primary buffer and then walk through
it looking for dangerous or unexpected commands.

So, how much is templated depends on how standardized the cards
are. Right now not much beyond DMA dispatch is templated, because we're
not convinced anything lower is really common enough to be worth the
effort. You can cut and paste to steal from other drivers if you see
some overlap. As Keith pointed out the i810 is a pretty sane piece of
hardware and therefore has a nice kernel driver. This means the i810
style DRM is one philosphy that works. It isn't the only one, and if
your card doesn't act like the i810, then you may need a different
philosphy. You really do need to understand how the card functions to
design an appropriate kernel interface. 

                                                - |Daryll

_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to