"Jeremy W. Bean" wrote:
>
> On Monday 18 June 2001 12:00, you wrote:
>
> > I'm also starting to look at the code for the mach64. What do you mean
> > with the new driver template code? Are you talking about the structure of
> > the ATI driver in the mach64 branch?
> > Any help will be appreciated.
> >
>
> >From what I can tell about the driver templates, and correct me if I am
> wrong anyone more experienced with the code. Check out for examples the
> r128 driver from the trunk, for a good example. Notice there are files in
> there such as r128_tritmp.h. This is a template that gets included in
> r128_tris.c.
> What it does basically is consolidate code that is largly reproduced over
> several functions, so that you set a few macros. For example:
>
> #define IND (R128_TWOSIDE_BIT)
> #define TAG(x) x##_twoside
>
> followed by
> #include "r128_tritmp.h"
>
> Notice the inline function's name defined in r128_tritmp.h is the result of
> the TAG macro, as well the function's content is dependant on what IND value
> is defined. So essentially the inline function is a template for various
> functions that have a bit in common. That way you consolidate common code
> and keep things consistent.
>
> The current mach64 branch is only using one template in the driver. But
> yes, it does have some of the driver template code there.
Nice explanation. :)
Look at e.g. programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h
though. That's the template architecture at its beauty. Most of the code is
shared between the drivers, customized with a few defines. Compare that to the
duplication and inconsistency before.
--
Earthling Michel Dänzer (MrCooper) \ Debian GNU/Linux (powerpc) developer
CS student, Free Software enthusiast \ XFree86 and DRI project member
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dri-devel