From 1fb97368989184c26fe37e98ed6916e6793a0171 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 13 Dec 2007 01:04:12 +1100 Subject: nouveau: take jumps into account properly when debugging pushbuf --- src/mesa/drivers/dri/nouveau_winsys/nouveau_dma.c | 71 ++++++++++++++++++----- 1 file changed, 58 insertions(+), 13 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau_winsys/nouveau_dma.c') diff --git a/src/mesa/drivers/dri/nouveau_winsys/nouveau_dma.c b/src/mesa/drivers/dri/nouveau_winsys/nouveau_dma.c index 5739e0010d..0c04a59c74 100644 --- a/src/mesa/drivers/dri/nouveau_winsys/nouveau_dma.c +++ b/src/mesa/drivers/dri/nouveau_winsys/nouveau_dma.c @@ -152,6 +152,63 @@ nouveau_dma_subc_bind(struct nouveau_grobj *grobj) } #endif +#ifdef NOUVEAU_DMA_DUMP_POSTRELOC_PUSHBUF +static void +nouveau_dma_parse_pushbuf(struct nouveau_channel *chan, int get, int put) +{ + struct nouveau_channel_priv *nvchan = nouveau_channel(chan); + unsigned mthd_count = 0; + + while (get != put) { + uint32_t gpuget = (get << 2) + nvchan->dma.base; + uint32_t data; + + if (get < 0 || get >= nvchan->drm.cmdbuf_size) { + NOUVEAU_ERR("DMA_PT 0x%08x\n", gpuget); + assert(0); + } + data = nvchan->pushbuf[get++]; + + if (mthd_count) { + NOUVEAU_MSG("0x%08x 0x%08x\n", gpuget, data); + mthd_count--; + continue; + } + + switch (data & 0x60000000) { + case 0x00000000: + mthd_count = (data >> 18) & 0x7ff; + NOUVEAU_MSG("0x%08x 0x%08x MTHD " + "Sc %d Mthd 0x%04x Size %d\n", + gpuget, data, (data>>13) & 7, data & 0x1ffc, + mthd_count); + break; + case 0x20000000: + get = (data & 0x1ffffffc) >> 2; + NOUVEAU_MSG("0x%08x 0x%08x JUMP 0x%08x\n", + gpuget, data, data & 0x1ffffffc); + continue; + case 0x40000000: + mthd_count = (data >> 18) & 0x7ff; + NOUVEAU_MSG("0x%08x 0x%08x NINC " + "Sc %d Mthd 0x%04x Size %d\n", + gpuget, data, (data>>13) & 7, data & 0x1ffc, + mthd_count); + break; + case 0x60000000: + /* DMA_OPCODE_CALL apparently, doesn't seem to work on + * my NV40 at least.. + */ + /* fall-through */ + default: + NOUVEAU_MSG("DMA_PUSHER 0x%08x 0x%08x\n", + gpuget, data); + assert(0); + } + } +} +#endif + void nouveau_dma_kickoff(struct nouveau_channel *userchan) { @@ -168,19 +225,7 @@ nouveau_dma_kickoff(struct nouveau_channel *userchan) #endif #ifdef NOUVEAU_DMA_DUMP_POSTRELOC_PUSHBUF - for (i = chan->dma.put; i < chan->dma.cur; i++) { - NOUVEAU_MSG("0x%08x 0x%08x\n", (i<<2)+chan->dma.base, - chan->pushbuf[i]); - if ((chan->pushbuf[i] & 0xf0000000) == 0x20000000) { - int n = (((chan->pushbuf[i] & 0x0fffffff) - - chan->dma.base) / 4); - do { - NOUVEAU_MSG("\t0x%08x 0x%08x\n", - (n<<2)+chan->dma.base, - chan->pushbuf[n]); - } while ((chan->pushbuf[n++]&0xf0000000) != 0x20000000); - } - } + nouveau_dma_parse_pushbuf(userchan, chan->dma.put, chan->dma.cur); #endif WRITE_PUT(chan, chan->dma.cur); -- cgit v1.2.3