r600g: Use align() instead of handrolled code.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 19 Sep 2010 23:42:29 +0000 (16:42 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 20 Sep 2010 01:25:01 +0000 (18:25 -0700)
src/gallium/drivers/r600/eg_hw_states.c
src/gallium/drivers/r600/r600_hw_states.c
src/gallium/drivers/r600/r600_state2.c

index 65a5c6434b3f05d2f1a2423bb7dab54497411dee..e8cf577c76f5dea4b475bde2c546a9295a19bbc4 100644 (file)
@@ -559,8 +559,7 @@ static void eg_resource(struct pipe_context *ctx, struct radeon_state *rstate,
        rstate->placement[2] = RADEON_GEM_DOMAIN_GTT;
        rstate->placement[3] = RADEON_GEM_DOMAIN_GTT;
 
-       pitch = (tmp->pitch[0] / tmp->bpt);
-       pitch = (pitch + 0x7) & ~0x7;
+       pitch = align(tmp->pitch[0] / tmp->bpt, 8);
 
        /* FIXME properly handle first level != 0 */
        rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD0] =
index 5e43085c620645772f5599663e5f1ed2493772fd..627a820d59a5dca982d5ea9d79df46bbc799be8e 100644 (file)
@@ -558,8 +558,7 @@ static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate,
        rstate->placement[2] = RADEON_GEM_DOMAIN_GTT;
        rstate->placement[3] = RADEON_GEM_DOMAIN_GTT;
 
-       pitch = (tmp->pitch[0] / tmp->bpt);
-       pitch = (pitch + 0x7) & ~0x7;
+       pitch = align(tmp->pitch[0] / tmp->bpt, 8);
 
        /* FIXME properly handle first level != 0 */
        rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] =
index 86c10a877dded64576d393db04fa2d8b981a8d92..38fab4bbb6db234a316135dc5fdd6b2c48cef099 100644 (file)
@@ -1218,8 +1218,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
                bo[1] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed);
 #endif
        }
-       pitch = (tmp->pitch[0] / tmp->bpt);
-       pitch = (pitch + 0x7) & ~0x7;
+       pitch = align(tmp->pitch[0] / tmp->bpt, 8);
 
        /* FIXME properly handle first level != 0 */
        r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038000_RESOURCE0_WORD0,