r6xx/r7xx: switch to common dma functions for vecs
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 29 May 2009 16:49:45 +0000 (12:49 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 29 May 2009 16:49:45 +0000 (12:49 -0400)
src/mesa/drivers/dri/r600/r600_context.c
src/mesa/drivers/dri/r600/r600_context.h
src/mesa/drivers/dri/r600/r600_emit.c
src/mesa/drivers/dri/r600/r600_emit.h
src/mesa/drivers/dri/r600/r700_chip.c
src/mesa/drivers/dri/r600/r700_clear.c
src/mesa/drivers/dri/r600/r700_render.c

index 5be486b176a6f95b3c486677bc47563378537ba0..3ea8f00086fffc6ef4f8af35e03b62534ff52605 100644 (file)
@@ -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,
index ae80037602a7691ac226d52ec9962723447c3d85..2740c0a1f8f8788bba373d7c3b4e871c24e47d5d 100644 (file)
@@ -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,                               
index e4ba656ee84f0506909d31b34667f4891fa2753a..711dfefd736da1ce07e5aabb4ef8d6462614c910 100644 (file)
@@ -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);
-    }
-}
index a2d8312287e8c6a95ddd4ba8df1ca0be449084c2..d3c9ef59eb3489d534b644e4316abc5a6575ab04 100644 (file)
@@ -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
index 9395bae2964af486b9c3f5f70f00b7278b687c8a..12e9b474e1362c3c0f3aeed0b2ae81025c509ba3 100644 (file)
@@ -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, 
index 7ebab8daa1ac6a9f61dc00940cbab1392fbdd20f..ffe236131c261579e15d8c6fb0fa38b9f5b84bbc 100644 (file)
@@ -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);
 }
 
 
index a6f937ddeb0732e759434ef7fd41838cd8d4b43a..35f30605ce3fc038e18c432882650a679db0ade2 100644 (file)
@@ -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 */