Page 1 of 1

GIF DMA Packet, a black hole ?

Posted: Fri Nov 19, 2004 12:06 am
by Shazz
Hello,

A simple question :

Image

What stuff should be stored between bits 16 and 45 (between End Of Primitive EOP and PRE (?)) ???

I saw that GfxPipe sets the value (unit64) 0x0000000070000000 (funny magic number no ? looks like SPR...) at the beginning of the GIF TAG buffer, so if I'm not wrong, bits 28-29-30 are set (or I'll kill those silly indians ;-))

So I wonder....

Thanx for helping my brain...

Posted: Fri Nov 19, 2004 12:51 am
by blackdroid
those bits are unused.

Posted: Fri Nov 19, 2004 2:51 am
by Shazz
So can anybody explain me those few lines from GfxPipe ?

Code: Select all

struct gfxpipe {
    unsigned long *dmatadrA;    // 'pipe 1' ... base of allocatted pipeline memory
    unsigned long *dmatadrB;    // 'pipe 2' ... dmatadrA + (memsize / 2)
    unsigned int memsize;       // # of bytes allocatted to the pipelines (total)

    unsigned long *curpipe;     // pointer to current 'pipe' .. may only be equal to
                                // either dmatadrA or dmatadrB
    unsigned long *curdmatadr;  // pointer to the the dma block currently being added to
    unsigned long *curgiftag;   // pointer to current "block" we can add prims to

    // need to add state information of zbuffer, alpha test, etc. in here
    int flags;          // not implemented yet
};

[...]

int createGfxPipe(gfxpipe *pipeline, void *buffer, int size)
{
    if ((int)buffer & 0xf)
        return 0;

    if &#40;size < 0x1000&#41;
        return 0;

    pipeline->dmatadrA = &#40;unsigned long *&#41;buffer;
    pipeline->dmatadrB = pipeline->dmatadrA + &#40;size >> 4&#41;;
    pipeline->memsize = size;

    initializeGfxPipe&#40;pipeline->dmatadrA&#41;;

    pipeline->curpipe = pipeline->curdmatadr = pipeline->dmatadrA;
    pipeline->curgiftag = pipeline->dmatadrA + 2;

    return 1;
&#125;

void initializeGfxPipe&#40;unsigned long *dmatadr&#41;
&#123;

     //***** THOSE LINES *****
    dmatadr&#91;0&#93; = 0x0000000070000000;
    dmatadr&#91;1&#93; = 0;
     //***** END *****

   //dmatadr&#91;2&#93; = 0x1000000000008000;
    //dmatadr&#91;3&#93; = 0x000000000000000e;
&#125;

Posted: Fri Nov 19, 2004 2:51 am
by evilo
hmmm, I was actually convinced that it was using the SPR....

need to look back to source code...

Posted: Fri Nov 19, 2004 6:06 am
by blackdroid
first dmatag, then giftag.

Posted: Fri Nov 19, 2004 6:18 am
by Shazz
yep DMA tag then GIF tag, the thing is in the DMA tag, what this magic value stands for ? (SPR ?)

here is an example of a drawing call :

Code: Select all

void gp_line&#40;gfxpipe *p, unsigned x1, unsigned y1, unsigned x2, unsigned y2, unsigned z, unsigned color&#41;
&#123;
    unsigned long dt = *&#40;p->curdmatadr&#41;;
    *&#40;p->curdmatadr&#41; = &#40;dt & 0xffffffffffff0000&#41; | &#40;&#40;dt & 0xffff&#41; + 3&#41;;

    p->curgiftag&#91;0&#93; = 0x4400000000008001;
    p->curgiftag&#91;1&#93; = 0xffffffffffff5d10;
    p->curgiftag&#91;2&#93; = 0x0000000000000001;
    p->curgiftag&#91;3&#93; = 0x3f80000000000000 | color;
    p->curgiftag&#91;4&#93; = &#40;&#40;unsigned long&#41;z << 32&#41; | &#40;y1 << 16&#41; | x1;
    p->curgiftag&#91;5&#93; = &#40;&#40;unsigned long&#41;z << 32&#41; | &#40;y2 << 16&#41; | x2;
    p->curgiftag = &p->curgiftag&#91;6&#93;;        // advance the packet pointer

    gp_checkflush&#40;p&#41;;
&#125;
As you can see points by init on dmatadrA, so the first statement is used to set the NLOOP register in the DMA tag buffer (right ?), then the GIF tag is set up in this case to draw a line...

Note than the GIF tag buffer starts at dmatadrA + 2 (so that's ok, 128 bytes after) so DMA tag and GIF tag are set in the same buffer sequentially.

So am I wrong ???