summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-05-29 12:49:45 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-05-29 12:49:45 -0400
commit846b24ea82cfb8a4867b6da1345584379f4aaa04 (patch)
tree3b2e645fc072532482c7c7f993dbf038281f9dca /src
parent9b10d19d4a3820958c4bd7d5c8fb7eaf1ef3fce0 (diff)
r6xx/r7xx: switch to common dma functions for vecs
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.c4
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.h10
-rw-r--r--src/mesa/drivers/dri/r600/r600_emit.c162
-rw-r--r--src/mesa/drivers/dri/r600/r600_emit.h12
-rw-r--r--src/mesa/drivers/dri/r600/r700_chip.c12
-rw-r--r--src/mesa/drivers/dri/r600/r700_clear.c8
-rw-r--r--src/mesa/drivers/dri/r600/r700_render.c4
7 files changed, 9 insertions, 203 deletions
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 5be486b176..3ea8f00086 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -286,12 +286,8 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual,
(r600->chipobj.InitFuncs)(&functions);
r600->chipobj.EmitShader = r600EmitShader;
r600->chipobj.DeleteShader = r600DeleteShader;
- r600->chipobj.FreeDmaRegion = r600FreeDmaRegion;
- r600->chipobj.EmitVec = r600EmitVec;
- r600->chipobj.ReleaseArrays = r600ReleaseVec;
r600->chipobj.LoadMemSurf = r600LoadMemSurf;
r600->chipobj.AllocMemSurf = r600AllocMemSurf;
- r600->chipobj.FlushCmdBuffer = r600FlushCmdBuffer;
r600->chipobj.MemUse = r600MemUse;
if (!radeonInitContext(&r600->radeon, &functions,
diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h
index ae80037602..2740c0a1f8 100644
--- a/src/mesa/drivers/dri/r600/r600_context.h
+++ b/src/mesa/drivers/dri/r600/r600_context.h
@@ -175,17 +175,7 @@ typedef struct chip_object
char * szShaderUsage);
GLboolean (*DeleteShader)(GLcontext * ctx,
void * shaderbo);
- void (*FreeDmaRegion)( GLcontext * ctx,
- void * shaderbo);
- GLboolean (*EmitVec)(GLcontext * ctx,
- struct radeon_aos *aos,
- GLvoid * data,
- int size,
- int stride,
- int count);
void (*MemUse)(context_t *context, int id);
- void (*ReleaseArrays)(GLcontext * ctx);
- int (*FlushCmdBuffer)(GLcontext * ctx);
GLboolean (*LoadMemSurf)(context_t *context,
GLuint dst_offset, /* gpu addr */
GLuint dst_pitch_in_pixel,
diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c
index e4ba656ee8..711dfefd73 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);
- }
-}
diff --git a/src/mesa/drivers/dri/r600/r600_emit.h b/src/mesa/drivers/dri/r600/r600_emit.h
index a2d8312287..d3c9ef59eb 100644
--- a/src/mesa/drivers/dri/r600/r600_emit.h
+++ b/src/mesa/drivers/dri/r600/r600_emit.h
@@ -50,16 +50,4 @@ extern GLboolean r600EmitShader(GLcontext * ctx,
extern GLboolean r600DeleteShader(GLcontext * ctx,
void * shaderbo);
-extern GLboolean r600EmitVec(GLcontext * ctx,
- struct radeon_aos *aos,
- GLvoid * data,
- int size,
- int stride,
- int count);
-
-extern void r600ReleaseVec(GLcontext * ctx);
-
-extern void r600FreeDmaRegion(context_t *context,
- void * shaderbo);
-
#endif
diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c
index 9395bae296..12e9b474e1 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.c
+++ b/src/mesa/drivers/dri/r600/r700_chip.c
@@ -467,12 +467,12 @@ int r700SetupStreams(GLcontext * ctx)
unBit = 1 << i;
if(vpc->mesa_program.Base.InputsRead & unBit)
{
- (context->chipobj.EmitVec)(ctx,
- &context->radeon.tcl.aos[i],
- vb->AttribPtr[i]->data,
- vb->AttribPtr[i]->size,
- vb->AttribPtr[i]->stride,
- vb->Count);
+ rcommon_emit_vector(ctx,
+ &context->radeon.tcl.aos[i],
+ vb->AttribPtr[i]->data,
+ vb->AttribPtr[i]->size,
+ vb->AttribPtr[i]->stride,
+ vb->Count);
/* currently aos are packed */
r700SetupVTXConstans(ctx,
diff --git a/src/mesa/drivers/dri/r600/r700_clear.c b/src/mesa/drivers/dri/r600/r700_clear.c
index 7ebab8daa1..ffe236131c 100644
--- a/src/mesa/drivers/dri/r600/r700_clear.c
+++ b/src/mesa/drivers/dri/r600/r700_clear.c
@@ -154,7 +154,7 @@ static GLboolean r700ClearWithDraw(context_t *context, GLbitfield mask)
END_BATCH();
COMMIT_BATCH();
- (context->chipobj.EmitVec)(ctx, &aos_vb, (GLvoid *)fVb, 4, 16, 6);
+ rcommon_emit_vector(ctx, &aos_vb, (GLvoid *)fVb, 4, 16, 6);
r700SetupVTXConstans(ctx, VERT_ATTRIB_POS, &aos_vb, 4, 16, 6);
@@ -249,10 +249,6 @@ static GLboolean r700ClearWithDraw(context_t *context, GLbitfield mask)
r700WaitForIdleClean(context);
- (context->chipobj.FlushCmdBuffer)(context);
-
- (context->chipobj.FreeDmaRegion)(context, aos_vb.bo);
-
/* Restore chip object. */
memcpy(r700, &r700Saved, sizeof(R700_CHIP_CONTEXT));
@@ -268,7 +264,7 @@ void r700Clear(GLcontext * ctx, GLbitfield mask)
return;
}
- r700ClearWithDraw(context, mask);
+ //r700ClearWithDraw(context, mask);
}
diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c
index a6f937ddeb..35f30605ce 100644
--- a/src/mesa/drivers/dri/r600/r700_render.c
+++ b/src/mesa/drivers/dri/r600/r700_render.c
@@ -350,9 +350,7 @@ static GLboolean r700RunRender(GLcontext * ctx,
/* flush dst */
//r700SyncSurf(context); /* */
- (context->chipobj.FlushCmdBuffer)(context);
-
- (context->chipobj.ReleaseArrays)(ctx);
+ radeonReleaseArrays(ctx, 0);
//richard test
/* test stamp, write a number to mmSCRATCH4 */