Mesa (master): r600g: use memcmp instead of a loop in state_set_resource

Dave Airlie airlied at kemper.freedesktop.org
Wed Jun 8 01:47:37 UTC 2011


Module: Mesa
Branch: master
Commit: e21601e46efa3c17933f5abf079396ee3bdb4c45
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e21601e46efa3c17933f5abf079396ee3bdb4c45

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Jun  7 10:38:46 2011 +1000

r600g: use memcmp instead of a loop in state_set_resource

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/winsys/r600/drm/r600_hw_context.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c
index 6b62d16..cd52ead 100644
--- a/src/gallium/winsys/r600/drm/r600_hw_context.c
+++ b/src/gallium/winsys/r600/drm/r600_hw_context.c
@@ -1070,11 +1070,9 @@ void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_
 	is_vertex = ((state->val[num_regs-1] & 0xc0000000) == 0xc0000000);
 	dirty = block->status & R600_BLOCK_STATUS_DIRTY;
 
-	for (i = 0; i < num_regs; i++) {
-		if (dirty || (block->reg[i] != state->val[i])) {
-			dirty |= R600_BLOCK_STATUS_DIRTY;
-			block->reg[i] = state->val[i];
-		}
+	if (memcmp(block->reg, state->val, num_regs*4)) {
+		memcpy(block->reg, state->val, num_regs * 4);
+		dirty |= R600_BLOCK_STATUS_DIRTY;
 	}
 
 	/* if no BOs on block, force dirty */




More information about the mesa-commit mailing list