summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-06-25 03:28:09 +0200
committerMarek Olšák <[email protected]>2010-06-27 15:13:13 +0200
commitc200c47e6c2f8581608b83e703d611db1bebd7f6 (patch)
tree37540af7d3f90b74c0a6fc54fe012dc9191bb79f /src/gallium
parentbb47d1c26fa000735bd06751ba00a98354c921b7 (diff)
r300g: move emission of the MSPOS regs into the framebuffer state
Now the question is whether we are allowed to ignore gl_rasterization_rules and pipe_rasterizer_state::multisample. The former is invariant anyway and I think the latter would need re-emitting the AA state which is quite costly, considering that it implicitly flushes the whole pipeline (all AA regs in the AA state are *unpipelined*).
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r300/r300_context.c2
-rw-r--r--src/gallium/drivers/r300/r300_context.h2
-rw-r--r--src/gallium/drivers/r300/r300_emit.c77
-rw-r--r--src/gallium/drivers/r300/r300_state.c11
4 files changed, 40 insertions, 52 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 7b7dafbc6fa..b14db16f7cd 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -143,7 +143,7 @@ static void r300_setup_atoms(struct r300_context* r300)
R300_INIT_ATOM(vs_state, 0);
R300_INIT_ATOM(vs_constants, 0);
R300_INIT_ATOM(clip_state, has_tcl ? 5 + (6 * 4) : 2);
- /* VAP, RS, GA, GB. */
+ /* VAP, RS, GA, GB, SU, SC. */
R300_INIT_ATOM(rs_block_state, 0);
R300_INIT_ATOM(rs_state, 0);
/* US. */
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index cea3ab3418f..5e35d890712 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -116,8 +116,6 @@ struct r300_rs_state {
struct pipe_rasterizer_state rs_draw;
uint32_t vap_control_status; /* R300_VAP_CNTL_STATUS: 0x2140 */
- uint32_t multisample_position_0;/* R300_GB_MSPOS0: 0x4010 */
- uint32_t multisample_position_1;/* R300_GB_MSPOS1: 0x4014 */
uint32_t point_size; /* R300_GA_POINT_SIZE: 0x421c */
uint32_t point_minmax; /* R300_GA_POINT_MINMAX: 0x4230 */
uint32_t line_control; /* R300_GA_LINE_CNTL: 0x4234 */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index e4de081fdc7..65cddc88481 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -379,6 +379,42 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
for (; i < 4; i++) {
OUT_CS(R300_US_OUT_FMT_UNUSED);
}
+
+ /* Multisampling. Depends on framebuffer sample count.
+ * These are pipelined regs and as such cannot be moved
+ * to the AA state. */
+ if (r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0)) {
+ unsigned mspos0 = 0x66666666;
+ unsigned mspos1 = 0x6666666;
+
+ if (fb->nr_cbufs && fb->cbufs[0]->texture->nr_samples > 1) {
+ /* Subsample placement. These may not be optimal. */
+ switch (fb->cbufs[0]->texture->nr_samples) {
+ case 2:
+ mspos0 = 0x33996633;
+ mspos1 = 0x6666663;
+ break;
+ case 3:
+ mspos0 = 0x33936933;
+ mspos1 = 0x6666663;
+ break;
+ case 4:
+ mspos0 = 0x33939933;
+ mspos1 = 0x3966663;
+ break;
+ case 6:
+ mspos0 = 0x22a2aa22;
+ mspos1 = 0x2a65672;
+ break;
+ default:
+ debug_printf("r300: Bad number of multisamples!\n");
+ }
+ }
+
+ OUT_CS_REG_SEQ(R300_GB_MSPOS0, 2);
+ OUT_CS(mspos0);
+ OUT_CS(mspos1);
+ }
END_CS;
}
@@ -529,52 +565,11 @@ void r300_emit_invariant_state(struct r300_context *r300,
void r300_emit_rs_state(struct r300_context* r300, unsigned size, void* state)
{
struct r300_rs_state* rs = state;
- struct pipe_framebuffer_state* fb = r300->fb_state.state;
float scale, offset;
- unsigned mspos0, mspos1;
CS_LOCALS(r300);
BEGIN_CS(size);
OUT_CS_REG(R300_VAP_CNTL_STATUS, rs->vap_control_status);
-
- /* Multisampling. Depends on framebuffer sample count. */
- if (r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0)) {
- if (fb->nr_cbufs && fb->cbufs[0]->texture->nr_samples > 1) {
- /* Subsample placement. These may not be optimal. */
- switch (fb->cbufs[0]->texture->nr_samples) {
- case 2:
- mspos0 = 0x33996633;
- mspos1 = 0x6666663;
- break;
- case 3:
- mspos0 = 0x33936933;
- mspos1 = 0x6666663;
- break;
- case 4:
- mspos0 = 0x33939933;
- mspos1 = 0x3966663;
- break;
- case 6:
- mspos0 = 0x22a2aa22;
- mspos1 = 0x2a65672;
- break;
- default:
- debug_printf("r300: Bad number of multisamples!\n");
- mspos0 = rs->multisample_position_0;
- mspos1 = rs->multisample_position_1;
- break;
- }
-
- OUT_CS_REG_SEQ(R300_GB_MSPOS0, 2);
- OUT_CS(mspos0);
- OUT_CS(mspos1);
- } else {
- OUT_CS_REG_SEQ(R300_GB_MSPOS0, 2);
- OUT_CS(rs->multisample_position_0);
- OUT_CS(rs->multisample_position_1);
- }
- }
-
OUT_CS_REG(R300_GA_POINT_SIZE, rs->point_size);
OUT_CS_REG_SEQ(R300_GA_POINT_MINMAX, 2);
OUT_CS(rs->point_minmax);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 27ec5bc2b3e..ea1210fcb48 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -708,7 +708,8 @@ static void
r300->fb_state.size =
7 +
(8 * state->nr_cbufs) +
- (state->zsbuf ? (r300->screen->caps.has_hiz ? 22 : 18) : 0);
+ (state->zsbuf ? (r300->screen->caps.has_hiz ? 22 : 18) : 0) +
+ (r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0) ? 3 : 0);
/* Polygon offset depends on the zbuffer bit depth. */
if (state->zsbuf && r300->polygon_offset_enabled) {
@@ -975,11 +976,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
}
}
- if (state->gl_rasterization_rules) {
- rs->multisample_position_0 = 0x66666666;
- rs->multisample_position_1 = 0x6666666;
- }
-
return (void*)rs;
}
@@ -1009,8 +1005,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
}
UPDATE_STATE(state, r300->rs_state);
- r300->rs_state.size = 25 + (r300->polygon_offset_enabled ? 5 : 0) +
- (r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0) ? 3 : 0);
+ r300->rs_state.size = 25 + (r300->polygon_offset_enabled ? 5 : 0);
if (last_sprite_coord_enable != r300->sprite_coord_enable ||
last_two_sided_color != r300->two_sided_color) {