summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/unichrome/via_ioctl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/unichrome/via_ioctl.h')
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h
index b5dd9a8e5cb..5facad50f76 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.h
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h
@@ -49,9 +49,36 @@ void viaCheckDma(viaContextPtr vmesa, GLuint bytes);
} while (0)
-GLuint *viaExtendPrimitive(viaContextPtr vmesa, int bytes);
-GLuint *viaAllocDmaFunc(viaContextPtr vmesa, int bytes, const char *func, int line);
-#define viaAllocDma( v, b ) viaAllocDmaFunc(v, b, __FUNCTION__, __LINE__)
+void viaWrapPrimitive( viaContextPtr vmesa );
+
+static __inline__ GLuint *viaAllocDma(viaContextPtr vmesa, int bytes)
+{
+ if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) {
+ viaFlushDma(vmesa);
+ }
+
+ {
+ GLuint *start = (GLuint *)(vmesa->dma + vmesa->dmaLow);
+ vmesa->dmaLow += bytes;
+ return start;
+ }
+}
+
+
+static GLuint __inline__ *viaExtendPrimitive(viaContextPtr vmesa, int bytes)
+{
+ if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) {
+ viaWrapPrimitive(vmesa);
+ }
+
+ {
+ GLuint *start = (GLuint *)(vmesa->dma + vmesa->dmaLow);
+ vmesa->dmaLow += bytes;
+ return start;
+ }
+}
+
+
#define RING_VARS GLuint *_vb = 0, _nr, _x;