[Mesa-dev] [PATCH 04/23] radeonsi: move clip state to new handling

Christian König deathsimple at vodafone.de
Fri Jul 20 03:21:51 PDT 2012


Signed-off-by: Christian König <deathsimple at vodafone.de>
---
 .../drivers/radeonsi/evergreen_hw_context.c        |   24 ---------------
 src/gallium/drivers/radeonsi/evergreen_state.c     |   32 --------------------
 src/gallium/drivers/radeonsi/radeonsi_pipe.h       |    2 --
 src/gallium/drivers/radeonsi/si_state.c            |   25 +++++++++++++++
 src/gallium/drivers/radeonsi/si_state.h            |    1 +
 5 files changed, 26 insertions(+), 58 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/evergreen_hw_context.c b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
index 4971a60..d68e4b8 100644
--- a/src/gallium/drivers/radeonsi/evergreen_hw_context.c
+++ b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
@@ -115,30 +115,6 @@ static const struct r600_reg si_context_reg_list[] = {
 	{R_028448_PA_CL_VPORT_YOFFSET_0, 0},
 	{R_02844C_PA_CL_VPORT_ZSCALE_0, 0},
 	{R_028450_PA_CL_VPORT_ZOFFSET_0, 0},
-	{R_0285BC_PA_CL_UCP_0_X, 0},
-	{R_0285C0_PA_CL_UCP_0_Y, 0},
-	{R_0285C4_PA_CL_UCP_0_Z, 0},
-	{R_0285C8_PA_CL_UCP_0_W, 0},
-	{R_0285CC_PA_CL_UCP_1_X, 0},
-	{R_0285D0_PA_CL_UCP_1_Y, 0},
-	{R_0285D4_PA_CL_UCP_1_Z, 0},
-	{R_0285D8_PA_CL_UCP_1_W, 0},
-	{R_0285DC_PA_CL_UCP_2_X, 0},
-	{R_0285E0_PA_CL_UCP_2_Y, 0},
-	{R_0285E4_PA_CL_UCP_2_Z, 0},
-	{R_0285E8_PA_CL_UCP_2_W, 0},
-	{R_0285EC_PA_CL_UCP_3_X, 0},
-	{R_0285F0_PA_CL_UCP_3_Y, 0},
-	{R_0285F4_PA_CL_UCP_3_Z, 0},
-	{R_0285F8_PA_CL_UCP_3_W, 0},
-	{R_0285FC_PA_CL_UCP_4_X, 0},
-	{R_028600_PA_CL_UCP_4_Y, 0},
-	{R_028604_PA_CL_UCP_4_Z, 0},
-	{R_028608_PA_CL_UCP_4_W, 0},
-	{R_02860C_PA_CL_UCP_5_X, 0},
-	{R_028610_PA_CL_UCP_5_Y, 0},
-	{R_028614_PA_CL_UCP_5_Z, 0},
-	{R_028618_PA_CL_UCP_5_W, 0},
 	{R_028644_SPI_PS_INPUT_CNTL_0, 0},
 	{R_028648_SPI_PS_INPUT_CNTL_1, 0},
 	{R_02864C_SPI_PS_INPUT_CNTL_2, 0},
diff --git a/src/gallium/drivers/radeonsi/evergreen_state.c b/src/gallium/drivers/radeonsi/evergreen_state.c
index 23d7297..025e317 100644
--- a/src/gallium/drivers/radeonsi/evergreen_state.c
+++ b/src/gallium/drivers/radeonsi/evergreen_state.c
@@ -1245,37 +1245,6 @@ static void evergreen_bind_vs_sampler(struct pipe_context *ctx, unsigned count,
 {
 }
 
-static void evergreen_set_clip_state(struct pipe_context *ctx,
-				const struct pipe_clip_state *state)
-{
-	struct r600_context *rctx = (struct r600_context *)ctx;
-	struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
-
-	if (rstate == NULL)
-		return;
-
-	rctx->clip = *state;
-	rstate->id = R600_PIPE_STATE_CLIP;
-	for (int i = 0; i < 6; i++) {
-		r600_pipe_state_add_reg(rstate,
-					R_0285BC_PA_CL_UCP_0_X + i * 16,
-					fui(state->ucp[i][0]), NULL, 0);
-		r600_pipe_state_add_reg(rstate,
-					R_0285C0_PA_CL_UCP_0_Y + i * 16,
-					fui(state->ucp[i][1]) , NULL, 0);
-		r600_pipe_state_add_reg(rstate,
-					R_0285C4_PA_CL_UCP_0_Z + i * 16,
-					fui(state->ucp[i][2]), NULL, 0);
-		r600_pipe_state_add_reg(rstate,
-					R_0285C8_PA_CL_UCP_0_W + i * 16,
-					fui(state->ucp[i][3]), NULL, 0);
-	}
-
-	free(rctx->states[R600_PIPE_STATE_CLIP]);
-	rctx->states[R600_PIPE_STATE_CLIP] = rstate;
-	r600_context_pipe_state_set(rctx, rstate);
-}
-
 static void evergreen_set_polygon_stipple(struct pipe_context *ctx,
 					 const struct pipe_poly_stipple *state)
 {
@@ -1735,7 +1704,6 @@ void cayman_init_state_functions(struct r600_context *rctx)
 	rctx->context.delete_sampler_state = si_delete_sampler_state;
 	rctx->context.delete_vertex_elements_state = r600_delete_vertex_element;
 	rctx->context.delete_vs_state = r600_delete_vs_shader;
-	rctx->context.set_clip_state = evergreen_set_clip_state;
 	rctx->context.set_constant_buffer = r600_set_constant_buffer;
 	rctx->context.set_fragment_sampler_views = evergreen_set_ps_sampler_view;
 	rctx->context.set_framebuffer_state = evergreen_set_framebuffer_state;
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index 6abbc28..66f4cdf 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -77,7 +77,6 @@ struct r600_atom_surface_sync {
 enum r600_pipe_state_id {
 	R600_PIPE_STATE_CONFIG,
 	R600_PIPE_STATE_SEAMLESS_CUBEMAP,
-	R600_PIPE_STATE_CLIP,
 	R600_PIPE_STATE_SCISSOR,
 	R600_PIPE_STATE_VIEWPORT,
 	R600_PIPE_STATE_RASTERIZER,
@@ -242,7 +241,6 @@ struct r600_context {
 	/* for saving when using blitter */
 	struct pipe_stencil_ref		stencil_ref;
 	struct pipe_viewport_state	viewport;
-	struct pipe_clip_state		clip;
 	struct r600_pipe_state		config;
 	struct si_pipe_shader 	*ps_shader;
 	struct si_pipe_shader 	*vs_shader;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 51ee5c5..9e52f86 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -193,10 +193,35 @@ static void si_set_blend_color(struct pipe_context *ctx,
 	si_pm4_set_state(rctx, blend_color, pm4);
 }
 
+static void si_set_clip_state(struct pipe_context *ctx,
+			      const struct pipe_clip_state *state)
+{
+	struct r600_context *rctx = (struct r600_context *)ctx;
+	struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
+
+	if (pm4 == NULL)
+		return;
+
+	for (int i = 0; i < 6; i++) {
+		si_pm4_set_reg(pm4, R_0285BC_PA_CL_UCP_0_X + i * 16,
+			       fui(state->ucp[i][0]));
+		si_pm4_set_reg(pm4, R_0285C0_PA_CL_UCP_0_Y + i * 16,
+			       fui(state->ucp[i][1]));
+		si_pm4_set_reg(pm4, R_0285C4_PA_CL_UCP_0_Z + i * 16,
+			       fui(state->ucp[i][2]));
+		si_pm4_set_reg(pm4, R_0285C8_PA_CL_UCP_0_W + i * 16,
+			       fui(state->ucp[i][3]));
+        }
+
+	si_pm4_set_state(rctx, clip, pm4);
+}
+
 void si_init_state_functions(struct r600_context *rctx)
 {
 	rctx->context.create_blend_state = si_create_blend_state;
 	rctx->context.bind_blend_state = si_bind_blend_state;
 	rctx->context.delete_blend_state = si_delete_blend_state;
 	rctx->context.set_blend_color = si_set_blend_color;
+
+	rctx->context.set_clip_state = si_set_clip_state;
 }
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index f79476e..f5339cc 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -39,6 +39,7 @@ union si_state {
 	struct {
 		struct si_state_blend	*blend;
 		struct si_pm4_state	*blend_color;
+		struct si_pm4_state	*clip;
 	} named;
 	struct si_pm4_state	*array[0];
 };
-- 
1.7.9.5



More information about the mesa-dev mailing list