r300: minor optimization
authorMaciej Cencora <m.cencora@gmail.com>
Wed, 19 Aug 2009 21:35:00 +0000 (23:35 +0200)
committerMaciej Cencora <m.cencora@gmail.com>
Sun, 23 Aug 2009 18:21:48 +0000 (20:21 +0200)
use properly implemented OUT_BATCH_TABLE where possible

src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/radeon/radeon_cmdbuf.h

index 1ca9eacda100eb43d18134e1be326e07f0ad6da5..6b33f48885b1221628bb5efd8582f9534277c542 100644 (file)
@@ -79,7 +79,7 @@ void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom)
        r300ContextPtr r300 = R300_CONTEXT(ctx);
        BATCH_LOCALS(&r300->radeon);
        drm_r300_cmd_header_t cmd;
-       uint32_t addr, ndw, i;
+       uint32_t addr, ndw;
 
        if (!r300->radeon.radeonScreen->kernel_mm) {
                uint32_t dwords;
@@ -110,9 +110,7 @@ void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom)
                }
                OUT_BATCH_REGVAL(R300_VAP_PVS_VECTOR_INDX_REG, addr);
                OUT_BATCH(CP_PACKET0(R300_VAP_PVS_UPLOAD_DATA, ndw-1) | RADEON_ONE_REG_WR);
-               for (i = 0; i < ndw; i++) {
-                       OUT_BATCH(atom->cmd[i+1]);
-               }
+               OUT_BATCH_TABLE(&atom->cmd[1], ndw);
                OUT_BATCH_REGVAL(R300_VAP_PVS_STATE_FLUSH_REG, 0);
                END_BATCH();
        }
@@ -123,7 +121,7 @@ void emit_r500fp(GLcontext *ctx, struct radeon_state_atom * atom)
        r300ContextPtr r300 = R300_CONTEXT(ctx);
        BATCH_LOCALS(&r300->radeon);
        drm_r300_cmd_header_t cmd;
-       uint32_t addr, ndw, i, sz;
+       uint32_t addr, ndw, sz;
        int type, clamp, stride;
 
        if (!r300->radeon.radeonScreen->kernel_mm) {
@@ -153,9 +151,7 @@ void emit_r500fp(GLcontext *ctx, struct radeon_state_atom * atom)
                OUT_BATCH(CP_PACKET0(R500_GA_US_VECTOR_INDEX, 0));
                OUT_BATCH(addr);
                OUT_BATCH(CP_PACKET0(R500_GA_US_VECTOR_DATA, ndw-1) | RADEON_ONE_REG_WR);
-               for (i = 0; i < ndw; i++) {
-                       OUT_BATCH(atom->cmd[i+1]);
-               }
+               OUT_BATCH_TABLE(&atom->cmd[1], ndw);
                END_BATCH();
        }
 }
index abb023c7def9003ddeeca41bd66455b2263ac949..c31421c253a8c0a986fd0be1b59b25952792f7a7 100644 (file)
@@ -71,10 +71,7 @@ void rcommonBeginBatch(radeonContextPtr rmesa,
  */
 #define OUT_BATCH_TABLE(ptr,n) \
        do { \
-               int _i; \
-        for (_i=0; _i < n; _i++) {\
-            radeon_cs_write_dword(b_l_rmesa->cmdbuf.cs, ptr[_i]);\
-        }\
+               radeon_cs_write_table(b_l_rmesa->cmdbuf.cs, ptr, n);    \
        } while(0)
 
 /**