From eb4e399ef0d7b4fbeee744e79abcb79263549f7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 14 Apr 2010 04:22:22 +0200 Subject: [PATCH] r300g: atomize beginning occlusion query --- src/gallium/drivers/r300/r300_context.c | 1 + src/gallium/drivers/r300/r300_context.h | 4 ++-- src/gallium/drivers/r300/r300_defines.h | 4 ---- src/gallium/drivers/r300/r300_emit.c | 11 +++-------- src/gallium/drivers/r300/r300_emit.h | 2 +- src/gallium/drivers/r300/r300_flush.c | 1 - src/gallium/drivers/r300/r300_query.c | 2 +- 7 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 9a235baf7d7..06af2c2fd8d 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -101,6 +101,7 @@ static void r300_setup_atoms(struct r300_context* r300) * the size of 0 here. */ make_empty_list(&r300->atom_list); R300_INIT_ATOM(invariant_state, 71); + R300_INIT_ATOM(query_start, 4); R300_INIT_ATOM(ztop_state, 2); R300_INIT_ATOM(blend_state, 8); R300_INIT_ATOM(blend_color_state, is_r500 ? 3 : 2); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 2655e7e0e14..258b20d9737 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -372,6 +372,8 @@ struct r300_context { struct r300_atom fs_constants; /* Framebuffer state. */ struct r300_atom fb_state; + /* Occlusion query. */ + struct r300_atom query_start; /* Rasterizer state. */ struct r300_atom rs_state; /* RS block state. */ @@ -417,8 +419,6 @@ struct r300_context { struct pipe_viewport_state viewport; - /* Bitmask of dirty state objects. */ - uint32_t dirty_state; /* Flag indicating whether or not the HW is dirty. */ uint32_t dirty_hw; /* Whether polygon offset is enabled. */ diff --git a/src/gallium/drivers/r300/r300_defines.h b/src/gallium/drivers/r300/r300_defines.h index 0c3b970501d..8237c999aac 100644 --- a/src/gallium/drivers/r300/r300_defines.h +++ b/src/gallium/drivers/r300/r300_defines.h @@ -30,10 +30,6 @@ #define R300_RESOURCE_FLAG_TRANSFER PIPE_RESOURCE_FLAG_DRV_PRIV -/* Non-atom dirty state flags. */ -#define R300_NEW_QUERY 0x40000000 -#define R300_NEW_KITCHEN_SINK 0x7fffffff - /* Tiling flags. */ enum r300_buffer_tiling { R300_BUFFER_LINEAR = 0, diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index afb47ead9c5..8d5792b0ef9 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -570,7 +570,7 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state) END_CS; } -void r300_emit_query_start(struct r300_context *r300) +void r300_emit_query_start(struct r300_context *r300, unsigned size, void*state) { struct r300_query *query = r300->query_current; CS_LOCALS(r300); @@ -578,7 +578,7 @@ void r300_emit_query_start(struct r300_context *r300) if (!query) return; - BEGIN_CS(4); + BEGIN_CS(size); if (r300->screen->caps.family == CHIP_FAMILY_RV530) { OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL); } else { @@ -1149,7 +1149,7 @@ validate: } } /* ...occlusion query buffer... */ - if (r300->dirty_state & R300_NEW_QUERY) { + if (r300->query_start.dirty) { if (!r300_add_buffer(r300->rws, r300->oqbo, 0, RADEON_GEM_DOMAIN_GTT)) { r300->context.flush(&r300->context, 0, NULL); @@ -1219,11 +1219,6 @@ void r300_emit_dirty_state(struct r300_context* r300) struct r300_screen* r300screen = r300->screen; struct r300_atom* atom; - if (r300->dirty_state & R300_NEW_QUERY) { - r300_emit_query_start(r300); - r300->dirty_state &= ~R300_NEW_QUERY; - } - foreach(atom, &r300->atom_list) { if (atom->dirty || atom->always_dirty) { atom->emit(r300, atom->size, atom->state); diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 678e1822123..56f7318cdbe 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -61,7 +61,7 @@ void r500_emit_fs_rc_constant_state(struct r300_context* r300, unsigned size, vo void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state); -void r300_emit_query_start(struct r300_context* r300); +void r300_emit_query_start(struct r300_context *r300, unsigned size, void *state); void r300_emit_query_end(struct r300_context* r300); diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 0d8158e1990..5e61f528b64 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -52,7 +52,6 @@ static void r300_flush(struct pipe_context* pipe, if (r300->dirty_hw) { FLUSH_CS; - r300->dirty_state = R300_NEW_KITCHEN_SINK; r300->dirty_hw = 0; /* New kitchen sink, baby. */ diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 3348a0ada61..398edb9d101 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -92,7 +92,7 @@ static void r300_begin_query(struct pipe_context* pipe, q->flushed = FALSE; r300->query_current = q; - r300->dirty_state |= R300_NEW_QUERY; + r300->query_start.dirty = TRUE; } static void r300_end_query(struct pipe_context* pipe, -- 2.30.2