diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-12-04 10:06:48 +0100 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2010-12-05 05:52:25 +0100 |
commit | 66d45567b4e2c6f2585789b68667e6c00b7567e1 (patch) | |
tree | e57366150c859c87d3c58483ace7e9d6219c723b /src/gallium | |
parent | 6947e5254889b99bfba7104d15e9526a7bc1cdfa (diff) |
r300g: optimize looping over atoms
This also removes DBG_STATS (the stats can be obtained with valgrind instead).
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r300/r300_blit.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.c | 26 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_context.h | 101 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_debug.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_emit.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_flush.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_hyperz.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_query.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_render.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_render_stencilref.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 64 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state_derived.c | 2 |
13 files changed, 121 insertions, 119 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 9fc4910984..6e886433bc 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -187,11 +187,11 @@ static void r300_clear(struct pipe_context* pipe, r300_mark_fb_state_dirty(r300, R300_CHANGED_ZCLEAR_FLAG); if (zstex->zmask_mem[fb->zsbuf->u.tex.level]) { - r300->zmask_clear.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->zmask_clear); buffers &= ~PIPE_CLEAR_DEPTHSTENCIL; } if (zstex->hiz_mem[fb->zsbuf->u.tex.level]) - r300->hiz_clear.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->hiz_clear); } /* Enable CBZB clear. */ @@ -261,7 +261,7 @@ static void r300_clear(struct pipe_context* pipe, if (zstex && (zstex->zmask_in_use[fb->zsbuf->u.tex.level] || zstex->hiz_in_use[fb->zsbuf->u.tex.level])) { - r300->hyperz_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->hyperz_state); } } diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index fd3f21d2a6..67b011a145 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -100,23 +100,12 @@ static void r300_release_referenced_objects(struct r300_context *r300) static void r300_destroy_context(struct pipe_context* context) { struct r300_context* r300 = r300_context(context); - struct r300_atom *atom; if (r300->blitter) util_blitter_destroy(r300->blitter); if (r300->draw) draw_destroy(r300->draw); - /* Print stats, if enabled. */ - if (SCREEN_DBG_ON(r300->screen, DBG_STATS)) { - fprintf(stderr, "r300: Stats for context %p:\n", r300); - fprintf(stderr, " : Flushes: %" PRIu64 "\n", r300->flush_counter); - foreach(atom, &r300->atom_list) { - fprintf(stderr, " : %s: %" PRIu64 " emits\n", - atom->name, atom->counter); - } - } - if (r300->upload_vb) u_upload_destroy(r300->upload_vb); if (r300->upload_ib) @@ -177,7 +166,6 @@ void r300_flush_cb(void *data) r300->atomname.size = atomsize; \ r300->atomname.emit = r300_emit_##atomname; \ r300->atomname.dirty = FALSE; \ - insert_at_tail(&r300->atom_list, &r300->atomname); \ } while (0) #define R300_ALLOC_ATOM(atomname, statetype) \ @@ -199,9 +187,6 @@ static boolean r300_setup_atoms(struct r300_context* r300) /* Create the actual atom list. * - * Each atom is examined and emitted in the order it appears here, which - * can affect performance and conformance if not handled with care. - * * Some atoms never change size, others change every emit - those have * the size of 0 here. * @@ -213,7 +198,6 @@ static boolean r300_setup_atoms(struct r300_context* r300) * - fb_state_pipelined (pipelined regs) * The motivation behind this is to be able to emit a strict * subset of the regs, and to have reasonable register ordering. */ - make_empty_list(&r300->atom_list); /* SC, GB (unpipelined), RB3D (unpipelined), ZB (unpipelined). */ R300_INIT_ATOM(gpu_flush, 9); R300_INIT_ATOM(aa_state, 4); @@ -296,11 +280,11 @@ static boolean r300_setup_atoms(struct r300_context* r300) /* Some states must be marked as dirty here to properly set up * hardware in the first command stream. */ - r300->invariant_state.dirty = TRUE; - r300->pvs_flush.dirty = TRUE; - r300->vap_invariant_state.dirty = TRUE; - r300->texture_cache_inval.dirty = TRUE; - r300->textures_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->invariant_state); + r300_mark_atom_dirty(r300, &r300->pvs_flush); + r300_mark_atom_dirty(r300, &r300->vap_invariant_state); + r300_mark_atom_dirty(r300, &r300->texture_cache_inval); + r300_mark_atom_dirty(r300, &r300->textures_state); return TRUE; } diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index bb5906aeb9..ba5e9bca40 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -43,12 +43,8 @@ struct r300_vertex_shader; struct r300_stencilref_context; struct r300_atom { - /* List pointers. */ - struct r300_atom *prev, *next; /* Name, for debugging. */ const char* name; - /* Stat counter. */ - uint64_t counter; /* Opaque state. */ void* state; /* Emit the state to the context. */ @@ -497,65 +493,68 @@ struct r300_context { struct r300_query query_list; /* Various CSO state objects. */ - /* Beginning of atom list. */ - struct r300_atom atom_list; + + /* Each atom is emitted in the order it appears here, which can affect + * performance and stability if not handled with care. */ + /* GPU flush. */ + struct r300_atom gpu_flush; /* Anti-aliasing (MSAA) state. */ struct r300_atom aa_state; + /* Framebuffer state. */ + struct r300_atom fb_state; + /* HyperZ state (various SC/ZB bits). */ + struct r300_atom hyperz_state; + /* ZTOP state. */ + struct r300_atom ztop_state; + /* Depth, stencil, and alpha state. */ + struct r300_atom dsa_state; /* Blend state. */ struct r300_atom blend_state; /* Blend color state. */ struct r300_atom blend_color_state; + /* Scissor state. */ + struct r300_atom scissor_state; + /* Invariant state. This must be emitted to get the engine started. */ + struct r300_atom invariant_state; + /* Viewport state. */ + struct r300_atom viewport_state; + /* PVS flush. */ + struct r300_atom pvs_flush; + /* VAP invariant state. */ + struct r300_atom vap_invariant_state; + /* Vertex stream formatting state. */ + struct r300_atom vertex_stream_state; + /* Vertex shader. */ + struct r300_atom vs_state; /* User clip planes. */ struct r300_atom clip_state; - /* Depth, stencil, and alpha state. */ - struct r300_atom dsa_state; + /* RS block state + VAP (vertex shader) output mapping state. */ + struct r300_atom rs_block_state; + /* Rasterizer state. */ + struct r300_atom rs_state; + /* Framebuffer state (pipelined regs). */ + struct r300_atom fb_state_pipelined; /* Fragment shader. */ struct r300_atom fs; /* Fragment shader RC_CONSTANT_STATE variables. */ struct r300_atom fs_rc_constant_state; /* Fragment shader constant buffer. */ struct r300_atom fs_constants; - /* Framebuffer state. */ - struct r300_atom fb_state; - /* Framebuffer state (pipelined regs). */ - struct r300_atom fb_state_pipelined; - /* HyperZ state (various SC/ZB bits). */ - struct r300_atom hyperz_state; - /* Occlusion query. */ - struct r300_atom query_start; - /* Rasterizer state. */ - struct r300_atom rs_state; - /* RS block state + VAP (vertex shader) output mapping state. */ - struct r300_atom rs_block_state; - /* Scissor state. */ - struct r300_atom scissor_state; - /* Textures state. */ - struct r300_atom textures_state; - /* Vertex stream formatting state. */ - struct r300_atom vertex_stream_state; - /* Vertex shader. */ - struct r300_atom vs_state; /* Vertex shader constant buffer. */ struct r300_atom vs_constants; - /* Viewport state. */ - struct r300_atom viewport_state; - /* ZTOP state. */ - struct r300_atom ztop_state; - /* PVS flush. */ - struct r300_atom pvs_flush; - /* VAP invariant state. */ - struct r300_atom vap_invariant_state; /* Texture cache invalidate. */ struct r300_atom texture_cache_inval; - /* GPU flush. */ - struct r300_atom gpu_flush; + /* Textures state. */ + struct r300_atom textures_state; /* HiZ clear */ struct r300_atom hiz_clear; /* zmask clear */ struct r300_atom zmask_clear; + /* Occlusion query. */ + struct r300_atom query_start; - /* Invariant state. This must be emitted to get the engine started. */ - struct r300_atom invariant_state; + /* The pointers to the first and the last atom. */ + struct r300_atom *first_dirty, *last_dirty; /* Vertex buffers for Gallium. */ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; @@ -613,6 +612,12 @@ struct r300_context { int vs_const_base; }; +#define foreach_atom(r300, atom) \ + for (atom = &r300->gpu_flush; atom != (&r300->query_start)+1; atom++) + +#define foreach_dirty_atom(r300, atom) \ + for (atom = r300->first_dirty; atom != r300->last_dirty; atom++) + /* Convenience cast wrappers. */ static INLINE struct r300_query* r300_query(struct pipe_query* q) { @@ -691,6 +696,22 @@ void r300_mark_fb_state_dirty(struct r300_context *r300, enum r300_fb_state_change change); void r300_mark_fs_code_dirty(struct r300_context *r300); +static INLINE void r300_mark_atom_dirty(struct r300_context *r300, + struct r300_atom *atom) +{ + atom->dirty = TRUE; + + if (!r300->first_dirty) { + r300->first_dirty = atom; + r300->last_dirty = atom+1; + } else { + if (atom < r300->first_dirty) + r300->first_dirty = atom; + if (atom+1 > r300->last_dirty) + r300->last_dirty = atom+1; + } +} + /* r300_debug.c */ void r500_dump_rs_block(struct r300_rs_block *rs); diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index f78fe34790..52031dd97b 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -40,7 +40,6 @@ static const struct debug_named_value debug_options[] = { { "rs", DBG_RS, "Log rasterizer" }, { "fb", DBG_FB, "Log framebuffer" }, { "cbzb", DBG_CBZB, "Log fast color clear info" }, - { "stats", DBG_STATS, "Log emission statistics" }, { "hyperz", DBG_HYPERZ, "Log HyperZ info" }, { "scissor", DBG_SCISSOR, "Log scissor info" }, { "fakeocc", DBG_FAKE_OCC, "Use fake occlusion queries" }, diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 3ff5b13f97..45814f7493 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -1240,7 +1240,7 @@ unsigned r300_get_num_dirty_dwords(struct r300_context *r300) struct r300_atom* atom; unsigned dwords = 0; - foreach(atom, &r300->atom_list) { + foreach_dirty_atom(r300, atom) { if (atom->dirty) { dwords += atom->size; } @@ -1268,17 +1268,16 @@ unsigned r300_get_num_cs_end_dwords(struct r300_context *r300) /* Emit all dirty state. */ void r300_emit_dirty_state(struct r300_context* r300) { - struct r300_atom* atom; + struct r300_atom *atom; - foreach(atom, &r300->atom_list) { + foreach_dirty_atom(r300, atom) { if (atom->dirty) { atom->emit(r300, atom->size, atom->state); - if (SCREEN_DBG_ON(r300->screen, DBG_STATS)) { - atom->counter++; - } atom->dirty = FALSE; } } + r300->first_dirty = NULL; + r300->last_dirty = NULL; r300->dirty_hw++; } diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 16de7fd413..074c5c8543 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -57,9 +57,9 @@ static void r300_flush(struct pipe_context* pipe, r300->dirty_hw = 0; /* New kitchen sink, baby. */ - foreach(atom, &r300->atom_list) { + foreach_atom(r300, atom) { if (atom->state || atom->allow_null_state) { - atom->dirty = TRUE; + r300_mark_atom_dirty(r300, atom); } } diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c index 5bf4cbeefb..c22e307c67 100644 --- a/src/gallium/drivers/r300/r300_hyperz.c +++ b/src/gallium/drivers/r300/r300_hyperz.c @@ -282,7 +282,7 @@ static void r300_update_ztop(struct r300_context* r300) ztop_state->z_buffer_top = R300_ZTOP_ENABLE; } if (ztop_state->z_buffer_top != old_ztop) - r300->ztop_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->ztop_state); } #define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y)) diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 59cd1e7f79..6223e04321 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -80,7 +80,7 @@ void r300_resume_query(struct r300_context *r300, struct r300_query *query) { r300->query_current = query; - r300->query_start.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->query_start); } static void r300_begin_query(struct pipe_context* pipe, diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 6a301d8ec5..fa55e4f8cd 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -1136,9 +1136,9 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter, done: /* Restore the state. */ - r300->clip_state.dirty = TRUE; - r300->rs_state.dirty = TRUE; - r300->viewport_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->clip_state); + r300_mark_atom_dirty(r300, &r300->rs_state); + r300_mark_atom_dirty(r300, &r300->viewport_state); r300->sprite_coord_enable = last_sprite_coord_enable; } @@ -1174,7 +1174,7 @@ static void r300_resource_resolve(struct pipe_context* pipe, R300_RB3D_AARESOLVE_CTL_AARESOLVE_MODE_RESOLVE | R300_RB3D_AARESOLVE_CTL_AARESOLVE_ALPHA_AVERAGE; r300->aa_state.size = 12; - r300->aa_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->aa_state); /* Resolve the surface. */ r300->context.clear_render_target(pipe, @@ -1183,7 +1183,7 @@ static void r300_resource_resolve(struct pipe_context* pipe, /* Disable AA resolve. */ aa->aaresolve_ctl = 0; r300->aa_state.size = 4; - r300->aa_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->aa_state); pipe_surface_reference((struct pipe_surface**)&srcsurf, NULL); pipe_surface_reference((struct pipe_surface**)&aa->dest, NULL); diff --git a/src/gallium/drivers/r300/r300_render_stencilref.c b/src/gallium/drivers/r300/r300_render_stencilref.c index 1f035d64a2..747594afaf 100644 --- a/src/gallium/drivers/r300/r300_render_stencilref.c +++ b/src/gallium/drivers/r300/r300_render_stencilref.c @@ -66,7 +66,7 @@ static void r300_stencilref_begin(struct r300_context *r300) /* We *cull* pixels, therefore no need to mask out the bits. */ rs->cb_main[rs->cull_mode_index] |= R300_CULL_BACK; - r300->rs_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->rs_state); } /* Set drawing for back faces. */ @@ -80,8 +80,8 @@ static void r300_stencilref_switch_side(struct r300_context *r300) dsa->stencil_ref_mask = dsa->stencil_ref_bf; r300->stencil_ref.ref_value[0] = r300->stencil_ref.ref_value[1]; - r300->rs_state.dirty = TRUE; - r300->dsa_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->rs_state); + r300_mark_atom_dirty(r300, &r300->dsa_state); } /* Restore the original state. */ @@ -96,8 +96,8 @@ static void r300_stencilref_end(struct r300_context *r300) dsa->stencil_ref_mask = sr->zb_stencilrefmask; r300->stencil_ref.ref_value[0] = sr->ref_value_front; - r300->rs_state.dirty = TRUE; - r300->dsa_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->rs_state); + r300_mark_atom_dirty(r300, &r300->dsa_state); } static void r300_stencilref_draw_vbo(struct pipe_context *pipe, diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h index d646f4e8fd..5847fe1ffc 100644 --- a/src/gallium/drivers/r300/r300_screen.h +++ b/src/gallium/drivers/r300/r300_screen.h @@ -101,7 +101,6 @@ r300_winsys_screen(struct pipe_screen *screen) { #define DBG_NO_OPT (1 << 20) #define DBG_NO_CBZB (1 << 21) /* Statistics. */ -#define DBG_STATS (1 << 24) #define DBG_P_STAT (1 << 25) /*@}*/ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 4eef9da06a..70df484199 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -52,7 +52,7 @@ #define UPDATE_STATE(cso, atom) \ if (cso != atom.state) { \ atom.state = cso; \ - atom.dirty = TRUE; \ + r300_mark_atom_dirty(r300, &(atom)); \ } static boolean blend_discard_if_src_alpha_0(unsigned srcRGB, unsigned srcA, @@ -417,7 +417,7 @@ static void r300_set_blend_color(struct pipe_context* pipe, END_CB; } - r300->blend_color_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->blend_color_state); } static void r300_set_clip_state(struct pipe_context* pipe, @@ -446,7 +446,7 @@ static void r300_set_clip_state(struct pipe_context* pipe, (state->depth_clamp ? R300_CLIP_DISABLE : 0)); END_CB; - r300->clip_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->clip_state); } else { draw_set_clip_state(r300->draw, state); } @@ -594,7 +594,7 @@ static void r300_bind_dsa_state(struct pipe_context* pipe, UPDATE_STATE(state, r300->dsa_state); - r300->hyperz_state.dirty = TRUE; /* Will be updated before the emission. */ + r300_mark_atom_dirty(r300, &r300->hyperz_state); /* Will be updated before the emission. */ r300_dsa_inject_stencilref(r300); } @@ -613,7 +613,7 @@ static void r300_set_stencil_ref(struct pipe_context* pipe, r300->stencil_ref = *sr; r300_dsa_inject_stencilref(r300); - r300->dsa_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->dsa_state); } static void r300_tex_set_tiling_flags(struct r300_context *r300, @@ -687,13 +687,13 @@ void r300_mark_fb_state_dirty(struct r300_context *r300, boolean can_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ); /* What is marked as dirty depends on the enum r300_fb_state_change. */ - r300->gpu_flush.dirty = TRUE; - r300->fb_state.dirty = TRUE; - r300->hyperz_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->gpu_flush); + r300_mark_atom_dirty(r300, &r300->fb_state); + r300_mark_atom_dirty(r300, &r300->hyperz_state); if (change == R300_CHANGED_FB_STATE) { - r300->aa_state.dirty = TRUE; - r300->fb_state_pipelined.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->aa_state); + r300_mark_atom_dirty(r300, &r300->fb_state_pipelined); } /* Now compute the fb_state atom size. */ @@ -738,11 +738,11 @@ static void /* If nr_cbufs is changed from zero to non-zero or vice versa... */ if (!!old_state->nr_cbufs != !!state->nr_cbufs) { - r300->blend_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->blend_state); } /* If zsbuf is set from NULL to non-NULL or vice versa.. */ if (!!old_state->zsbuf != !!state->zsbuf) { - r300->dsa_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->dsa_state); } /* The tiling flags are dependent on the surface miplevel, unfortunately. */ @@ -795,7 +795,7 @@ static void r300->zbuffer_bpp = zbuffer_bpp; if (r300->polygon_offset_enabled) - r300->rs_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->rs_state); } } @@ -853,9 +853,9 @@ void r300_mark_fs_code_dirty(struct r300_context *r300) { struct r300_fragment_shader* fs = r300_fs(r300); - r300->fs.dirty = TRUE; - r300->fs_rc_constant_state.dirty = TRUE; - r300->fs_constants.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->fs); + r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state); + r300_mark_atom_dirty(r300, &r300->fs_constants); r300->fs.size = fs->shader->cb_code_size; if (r300->screen->caps.is_r500) { @@ -885,7 +885,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader) r300_pick_fragment_shader(r300); r300_mark_fs_code_dirty(r300); - r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */ + r300_mark_atom_dirty(r300, &r300->rs_block_state); /* Will be updated before the emission. */ } /* Delete fragment shader state. */ @@ -1137,7 +1137,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) if (last_sprite_coord_enable != r300->sprite_coord_enable || last_two_sided_color != r300->two_sided_color) { - r300->rs_block_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->rs_block_state); } } @@ -1235,7 +1235,7 @@ static void r300_bind_sampler_states(struct pipe_context* pipe, memcpy(state->sampler_states, states, sizeof(void*) * count); state->sampler_state_count = count; - r300->textures_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->textures_state); } static void r300_lacks_vertex_textures(struct pipe_context* pipe, @@ -1313,7 +1313,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, * Needed for RECT and NPOT fallback. */ texture = r300_texture(views[i]->texture); if (texture->desc.is_npot) { - r300->fs_rc_constant_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state); } state->sampler_views[i]->texcache_region = @@ -1332,10 +1332,10 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, state->sampler_view_count = count; - r300->textures_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->textures_state); if (dirty_tex) { - r300->texture_cache_inval.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->texture_cache_inval); } } @@ -1390,7 +1390,7 @@ static void r300_set_scissor_state(struct pipe_context* pipe, memcpy(r300->scissor_state.state, state, sizeof(struct pipe_scissor_state)); - r300->scissor_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->scissor_state); } static void r300_set_viewport_state(struct pipe_context* pipe, @@ -1436,9 +1436,9 @@ static void r300_set_viewport_state(struct pipe_context* pipe, viewport->vte_control |= R300_VPORT_Z_OFFSET_ENA; } - r300->viewport_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->viewport_state); if (r300->fs.state && r300_fs(r300)->shader->inputs.wpos != ATTR_UNUSED) { - r300->fs_rc_constant_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state); } } @@ -1758,16 +1758,16 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader) r300->vs_state.state = vs; /* The majority of the RS block bits is dependent on the vertex shader. */ - r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */ + r300_mark_atom_dirty(r300, &r300->rs_block_state); /* Will be updated before the emission. */ if (r300->screen->caps.has_tcl) { unsigned fc_op_dwords = r300->screen->caps.is_r500 ? 3 : 2; - r300->vs_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->vs_state); r300->vs_state.size = vs->code.length + 9 + (vs->code.num_fc_ops ? vs->code.num_fc_ops * fc_op_dwords + 4 : 0); - r300->vs_constants.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->vs_constants); r300->vs_constants.size = 2 + (vs->externals_count ? vs->externals_count * 4 + 3 : 0) + @@ -1776,7 +1776,7 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader) ((struct r300_constant_buffer*)r300->vs_constants.state)->remap_table = vs->code.constants_remap_table; - r300->pvs_flush.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->pvs_flush); } else { draw_bind_vertex_shader(r300->draw, (struct draw_vertex_shader*)vs->draw_vs); @@ -1846,15 +1846,15 @@ static void r300_set_constant_buffer(struct pipe_context *pipe, if (r300->vs_const_base > R500_MAX_PVS_CONST_VECS) { r300->vs_const_base = vs->code.constants.Count; cbuf->buffer_base = 0; - r300->pvs_flush.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->pvs_flush); } - r300->vs_constants.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->vs_constants); } else if (r300->draw) { draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX, 0, mapped, buf->width0); } } else if (shader == PIPE_SHADER_FRAGMENT) { - r300->fs_constants.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->fs_constants); } } diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index a6d0776051..d5fc8ece25 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -193,7 +193,7 @@ static void r300_swtcl_vertex_psc(struct r300_context *r300) (R300_LAST_VEC << (i & 1 ? 16 : 0)); vstream->count = (i >> 1) + 1; - r300->vertex_stream_state.dirty = TRUE; + r300_mark_atom_dirty(r300, &r300->vertex_stream_state); r300->vertex_stream_state.size = (1 + vstream->count) * 2; } |