From 846b24ea82cfb8a4867b6da1345584379f4aaa04 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 29 May 2009 12:49:45 -0400 Subject: r6xx/r7xx: switch to common dma functions for vecs --- src/mesa/drivers/dri/r600/r600_emit.c | 162 ---------------------------------- 1 file changed, 162 deletions(-) (limited to 'src/mesa/drivers/dri/r600/r600_emit.c') diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c index e4ba656ee84..711dfefd736 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.c +++ b/src/mesa/drivers/dri/r600/r600_emit.c @@ -47,115 +47,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r600_context.h" #include "r600_emit.h" -#if defined(USE_X86_ASM) -#define COPY_DWORDS( dst, src, nr ) \ -do { \ - int __tmp; \ - __asm__ __volatile__( "rep ; movsl" \ - : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \ - : "0" (nr), \ - "D" ((long)dst), \ - "S" ((long)src) ); \ -} while (0) -#else -#define COPY_DWORDS( dst, src, nr ) \ -do { \ - int j; \ - for ( j = 0 ; j < nr ; j++ ) \ - dst[j] = ((int *)src)[j]; \ - dst += nr; \ -} while (0) -#endif - -static void r600EmitVec4(uint32_t *out, GLvoid * data, int stride, int count) -{ - int i; - - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s count %d stride %d out %p data %p\n", - __FUNCTION__, count, stride, (void *)out, (void *)data); - - if (stride == 4) - COPY_DWORDS(out, data, count); - else - for (i = 0; i < count; i++) { - out[0] = *(int *)data; - out++; - data += stride; - } -} - -static void r600EmitVec8(uint32_t *out, GLvoid * data, int stride, int count) -{ - int i; - - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s count %d stride %d out %p data %p\n", - __FUNCTION__, count, stride, (void *)out, (void *)data); - - if (stride == 8) - COPY_DWORDS(out, data, count * 2); - else - for (i = 0; i < count; i++) { - out[0] = *(int *)data; - out[1] = *(int *)(data + 4); - out += 2; - data += stride; - } -} - -static void r600EmitVec12(uint32_t *out, GLvoid * data, int stride, int count) -{ - int i; - - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s count %d stride %d out %p data %p\n", - __FUNCTION__, count, stride, (void *)out, (void *)data); - - if (stride == 12) { - COPY_DWORDS(out, data, count * 3); - } - else - for (i = 0; i < count; i++) { - out[0] = *(int *)data; - out[1] = *(int *)(data + 4); - out[2] = *(int *)(data + 8); - out += 3; - data += stride; - } -} - -static void r600EmitVec16(uint32_t *out, GLvoid * data, int stride, int count) -{ - int i; - - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s count %d stride %d out %p data %p\n", - __FUNCTION__, count, stride, (void *)out, (void *)data); - - if (stride == 16) - COPY_DWORDS(out, data, count * 4); - else - for (i = 0; i < count; i++) { - out[0] = *(int *)data; - out[1] = *(int *)(data + 4); - out[2] = *(int *)(data + 8); - out[3] = *(int *)(data + 12); - out += 4; - data += stride; - } -} - -/* Emit vertex data to GART memory - * Route inputs to the vertex processor - * This function should never return R600_FALLBACK_TCL when using software tcl. - */ -int r600EmitArrays(GLcontext * ctx) -{ - - return R600_FALLBACK_NONE; -} - void r600EmitCacheFlush(r600ContextPtr rmesa) { BATCH_LOCALS(&rmesa->radeon); @@ -241,56 +132,3 @@ GLboolean r600DeleteShader(GLcontext * ctx, return GL_TRUE; } - -GLboolean r600EmitVec(GLcontext * ctx, - struct radeon_aos *aos, - GLvoid * data, - int size, - int stride, - int count) -{ - radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - uint32_t *out; - - if (stride == 0) - { - radeonAllocDmaRegion(rmesa, &aos->bo, &aos->offset, size * count * 4, 32); - aos->stride = 0; - } - else - { - radeonAllocDmaRegion(rmesa, &aos->bo, &aos->offset, size * count * 4, 32); - aos->stride = size; - } - - aos->components = size; - aos->count = count; - - out = (uint32_t*)((char*)aos->bo->ptr + aos->offset); - switch (size) { - case 1: r600EmitVec4(out, data, stride, count); break; - case 2: r600EmitVec8(out, data, stride, count); break; - case 3: r600EmitVec12(out, data, stride, count); break; - case 4: r600EmitVec16(out, data, stride, count); break; - default: - assert(0); - break; - } - - return GL_TRUE; -} - -void r600ReleaseVec(GLcontext * ctx) -{ - radeonReleaseArrays(ctx, ~0); -} - -void r600FreeDmaRegion(context_t *context, - void * shaderbo) -{ - struct radeon_bo *pbo = (struct radeon_bo *)shaderbo; - if(pbo) - { - radeon_bo_unref(pbo); - } -} -- cgit v1.2.3