summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/evergreen_hw_context.c10
-rw-r--r--src/gallium/drivers/radeonsi/evergreen_state.c28
-rw-r--r--src/gallium/drivers/radeonsi/r600_blit.c5
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c26
-rw-r--r--src/gallium/drivers/radeonsi/si_state.h14
6 files changed, 39 insertions, 46 deletions
diff --git a/src/gallium/drivers/radeonsi/evergreen_hw_context.c b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
index 155489fadc7..424728e69bb 100644
--- a/src/gallium/drivers/radeonsi/evergreen_hw_context.c
+++ b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
@@ -89,9 +89,6 @@ static const struct r600_reg si_context_reg_list[] = {
{R_028244_PA_SC_GENERIC_SCISSOR_BR, 0},
{R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0},
{R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0},
- {R_0282D0_PA_SC_VPORT_ZMIN_0, 0},
- {R_0282D4_PA_SC_VPORT_ZMAX_0, 0},
- {R_028350_PA_SC_RASTER_CONFIG, 0},
{GROUP_FORCE_NEW_BLOCK, 0},
{R_028400_VGT_MAX_VTX_INDX, 0},
{R_028404_VGT_MIN_VTX_INDX, 0},
@@ -101,12 +98,6 @@ static const struct r600_reg si_context_reg_list[] = {
{GROUP_FORCE_NEW_BLOCK, 0},
{R_028430_DB_STENCILREFMASK, 0},
{R_028434_DB_STENCILREFMASK_BF, 0},
- {R_02843C_PA_CL_VPORT_XSCALE_0, 0},
- {R_028440_PA_CL_VPORT_XOFFSET_0, 0},
- {R_028444_PA_CL_VPORT_YSCALE_0, 0},
- {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_028644_SPI_PS_INPUT_CNTL_0, 0},
{R_028648_SPI_PS_INPUT_CNTL_1, 0},
{R_02864C_SPI_PS_INPUT_CNTL_2, 0},
@@ -157,7 +148,6 @@ static const struct r600_reg si_context_reg_list[] = {
{R_02880C_DB_SHADER_CONTROL, 0},
{R_028810_PA_CL_CLIP_CNTL, 0},
{R_028814_PA_SU_SC_MODE_CNTL, 0},
- {R_028818_PA_CL_VTE_CNTL, 0},
{R_02881C_PA_CL_VS_OUT_CNTL, 0},
{R_028820_PA_CL_NANINF_CNTL, 0},
{R_028824_PA_SU_LINE_STIPPLE_CNTL, 0},
diff --git a/src/gallium/drivers/radeonsi/evergreen_state.c b/src/gallium/drivers/radeonsi/evergreen_state.c
index cfae877de14..2b3403be3a7 100644
--- a/src/gallium/drivers/radeonsi/evergreen_state.c
+++ b/src/gallium/drivers/radeonsi/evergreen_state.c
@@ -1254,33 +1254,6 @@ static void evergreen_set_sample_mask(struct pipe_context *pipe, unsigned sample
{
}
-static void evergreen_set_viewport_state(struct pipe_context *ctx,
- const struct pipe_viewport_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->viewport = *state;
- rstate->id = R600_PIPE_STATE_VIEWPORT;
- r600_pipe_state_add_reg(rstate, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, NULL, 0);
- r600_pipe_state_add_reg(rstate, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028350_PA_SC_RASTER_CONFIG, 0x00000000, NULL, 0);
- r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028818_PA_CL_VTE_CNTL, 0x0000043F, NULL, 0);
-
- free(rctx->states[R600_PIPE_STATE_VIEWPORT]);
- rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate;
- r600_context_pipe_state_set(rctx, rstate);
-}
-
static void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rstate,
const struct pipe_framebuffer_state *state, int cb)
{
@@ -1670,7 +1643,6 @@ void cayman_init_state_functions(struct r600_context *rctx)
rctx->context.set_vertex_buffers = r600_set_vertex_buffers;
rctx->context.set_index_buffer = r600_set_index_buffer;
rctx->context.set_vertex_sampler_views = evergreen_set_vs_sampler_view;
- rctx->context.set_viewport_state = evergreen_set_viewport_state;
rctx->context.sampler_view_destroy = r600_sampler_view_destroy;
rctx->context.texture_barrier = r600_texture_barrier;
rctx->context.create_stream_output_target = r600_create_so_target;
diff --git a/src/gallium/drivers/radeonsi/r600_blit.c b/src/gallium/drivers/radeonsi/r600_blit.c
index 3b476bcee09..cc6dc4b7c29 100644
--- a/src/gallium/drivers/radeonsi/r600_blit.c
+++ b/src/gallium/drivers/radeonsi/r600_blit.c
@@ -24,6 +24,7 @@
#include "util/u_blitter.h"
#include "util/u_format.h"
#include "radeonsi_pipe.h"
+#include "si_state.h"
enum r600_blitter_op /* bitmask */
{
@@ -56,8 +57,8 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op
util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader);
util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader);
util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements);
- if (rctx->states[R600_PIPE_STATE_VIEWPORT]) {
- util_blitter_save_viewport(rctx->blitter, &rctx->viewport);
+ if (rctx->queued.named.viewport) {
+ util_blitter_save_viewport(rctx->blitter, &rctx->queued.named.viewport->viewport);
}
util_blitter_save_vertex_buffers(rctx->blitter,
rctx->nr_vertex_buffers,
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index e303d99417d..f13d3500734 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_VIEWPORT,
R600_PIPE_STATE_RASTERIZER,
R600_PIPE_STATE_VGT,
R600_PIPE_STATE_FRAMEBUFFER,
@@ -239,7 +238,6 @@ struct r600_context {
unsigned pa_cl_vs_out_cntl;
/* for saving when using blitter */
struct pipe_stencil_ref stencil_ref;
- struct pipe_viewport_state viewport;
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 68ff5cfbf0f..3e3a915457a 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -240,6 +240,31 @@ static void si_set_scissor_state(struct pipe_context *ctx,
si_pm4_set_state(rctx, scissor, pm4);
}
+static void si_set_viewport_state(struct pipe_context *ctx,
+ const struct pipe_viewport_state *state)
+{
+ struct r600_context *rctx = (struct r600_context *)ctx;
+ struct si_state_viewport *viewport = CALLOC_STRUCT(si_state_viewport);
+ struct si_pm4_state *pm4 = &viewport->pm4;
+
+ if (viewport == NULL)
+ return;
+
+ viewport->viewport = *state;
+ si_pm4_set_reg(pm4, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000);
+ si_pm4_set_reg(pm4, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000);
+ si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG, 0x00000000);
+ si_pm4_set_reg(pm4, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]));
+ si_pm4_set_reg(pm4, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]));
+ si_pm4_set_reg(pm4, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]));
+ si_pm4_set_reg(pm4, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]));
+ si_pm4_set_reg(pm4, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]));
+ si_pm4_set_reg(pm4, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]));
+ si_pm4_set_reg(pm4, R_028818_PA_CL_VTE_CNTL, 0x0000043F);
+
+ si_pm4_set_state(rctx, viewport, viewport);
+}
+
void si_init_state_functions(struct r600_context *rctx)
{
rctx->context.create_blend_state = si_create_blend_state;
@@ -249,4 +274,5 @@ void si_init_state_functions(struct r600_context *rctx)
rctx->context.set_clip_state = si_set_clip_state;
rctx->context.set_scissor_state = si_set_scissor_state;
+ rctx->context.set_viewport_state = si_set_viewport_state;
}
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index 51cb1c0d5b0..c70a2613864 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -35,12 +35,18 @@ struct si_state_blend {
uint32_t cb_color_control;
};
+struct si_state_viewport {
+ struct si_pm4_state pm4;
+ struct pipe_viewport_state viewport;
+};
+
union si_state {
struct {
- struct si_state_blend *blend;
- struct si_pm4_state *blend_color;
- struct si_pm4_state *clip;
- struct si_pm4_state *scissor;
+ struct si_state_blend *blend;
+ struct si_pm4_state *blend_color;
+ struct si_pm4_state *clip;
+ struct si_pm4_state *scissor;
+ struct si_state_viewport *viewport;
} named;
struct si_pm4_state *array[0];
};