More FIFO fixes.
authorBen Skeggs <darktama@iinet.net.au>
Sun, 19 Nov 2006 15:45:36 +0000 (15:45 +0000)
committerBen Skeggs <darktama@iinet.net.au>
Sun, 19 Nov 2006 15:45:36 +0000 (15:45 +0000)
src/mesa/drivers/dri/nouveau/nouveau_fifo.c
src/mesa/drivers/dri/nouveau/nouveau_fifo.h

index 8d2e88b1f345e24687c3acaf38b7da7bc61dfa5c..9fac6a48dfc3d911b54921e3e832f3b92794f016 100644 (file)
@@ -112,6 +112,7 @@ void nouveauWaitForIdle(nouveauContextPtr nmesa)
 GLboolean nouveauFifoInit(nouveauContextPtr nmesa)
 {
        drm_nouveau_fifo_alloc_t fifo_init;
+       int i;
 
 #ifdef NOUVEAU_RING_DEBUG
        return GL_TRUE;
@@ -140,6 +141,10 @@ GLboolean nouveauFifoInit(nouveauContextPtr nmesa)
        nmesa->fifo.max      = (fifo_init.cmdbuf_size >> 2) - 1;
        nmesa->fifo.free     = nmesa->fifo.max - nmesa->fifo.current;
 
+       for (i=0; i<RING_SKIPS; i++)
+          OUT_RING(0);
+       nmesa->fifo.free -= RING_SKIPS;
+
        MESSAGE("Fifo init ok. Using context %d\n", fifo_init.channel);
        return GL_TRUE;
 }
index 58fb378c39a8328d8617d050743cff827a43dff3..c5e5d6934fea5ba20bb0c79df61a8b68ad104a21 100644 (file)
@@ -100,9 +100,10 @@ extern void WAIT_RING(nouveauContextPtr nmesa,u_int32_t size);
 }while(0)
 
 #define BEGIN_RING_SIZE(subchannel,tag,size) do {                                      \
-       if (nmesa->fifo.free<size)                                                      \
+       if (nmesa->fifo.free <= (size))                                                 \
                WAIT_RING(nmesa,(size));                                                \
-       OUT_RING( (size<<18) | ((subchannel) << 13) | (tag));                           \
+       OUT_RING( ((size)<<18) | ((subchannel) << 13) | (tag));                         \
+       nmesa->fifo.free -= ((size) + 1);                                               \
 }while(0)
 
 #define RING_AVAILABLE() (nmesa->fifo.free-1)