GIF DMA Packet, a black hole ?

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

GIF DMA Packet, a black hole ?

Post 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...
- TiTAN Art Division -
http://www.titandemo.org
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post by blackdroid »

those bits are unused.
Kung VU
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post 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;
- TiTAN Art Division -
http://www.titandemo.org
User avatar
evilo
Posts: 230
Joined: Thu Apr 22, 2004 8:40 pm
Contact:

Post by evilo »

hmmm, I was actually convinced that it was using the SPR....

need to look back to source code...
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post by blackdroid »

first dmatag, then giftag.
Kung VU
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post 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 ???
- TiTAN Art Division -
http://www.titandemo.org
Post Reply