From 4aadda5f66adda1b7814ec1dec39b5e8f4f71cc5 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 19 Aug 2009 23:35:00 +0200 Subject: [PATCH] r300: minor optimization use properly implemented OUT_BATCH_TABLE where possible --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 12 ++++-------- src/mesa/drivers/dri/radeon/radeon_cmdbuf.h | 5 +---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 1ca9eacda10..6b33f48885b 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -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(); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h b/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h index abb023c7def..c31421c253a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h +++ b/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h @@ -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) /** -- 2.30.2