From 67d03433772867abc23272c9cf323b15285dde47 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Wed, 24 Mar 2004 16:15:28 +0000 Subject: Buffer vertices and emit them in batches. Still using conventional drawing commands, no vertex DMA. --- src/mesa/drivers/dri/savage/savageioctl.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/savage/savageioctl.h') diff --git a/src/mesa/drivers/dri/savage/savageioctl.h b/src/mesa/drivers/dri/savage/savageioctl.h index 94b02e33197..92f42950e13 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.h +++ b/src/mesa/drivers/dri/savage/savageioctl.h @@ -68,5 +68,32 @@ GLuint savageGetPhyAddress(savageContextPtr imesa,void * pointer); int savageFreeDMABuffer(savageContextPtr, drm_savage_alloc_cont_mem_t*); #endif -#define FLUSH_BATCH(imesa) savageDMAFlush(imesa) +#define FLUSH_BATCH(imesa) do { \ + if (imesa->vertex_dma_buffer) savageFlushVertices(imesa); \ +} while (0) + +static __inline +uint32_t *savageAllocDmaLow( savageContextPtr imesa, GLuint bytes ) +{ + uint32_t *head; + + if (!imesa->vertex_dma_buffer) { + LOCK_HARDWARE(imesa); + imesa->vertex_dma_buffer = savageFakeGetBuffer (imesa); + UNLOCK_HARDWARE(imesa); + } else if (imesa->vertex_dma_buffer->used + bytes > + imesa->vertex_dma_buffer->total) { + LOCK_HARDWARE(imesa); + savageFlushVerticesLocked( imesa ); + imesa->vertex_dma_buffer = savageFakeGetBuffer (imesa); + UNLOCK_HARDWARE(imesa); + } + + head = (uint32_t *)((uint8_t *)imesa->vertex_dma_buffer->address + + imesa->vertex_dma_buffer->used); + + imesa->vertex_dma_buffer->used += bytes; + return head; +} + #endif -- cgit v1.2.3