From 76bc66b664c7e135aa9c06cedd94ee1961d68c70 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 23 Jan 2010 19:35:42 +1000 Subject: r300g: fix up buffer emission ordering. This fixes the code space checking VBOs, then resetting the space list and space checking other buffers. it fixes demos/ipers Signed-off-by: Dave Airlie --- src/gallium/drivers/r300/r300_emit.c | 50 +++++++++++++++++++--------------- src/gallium/drivers/r300/r300_emit.h | 2 ++ src/gallium/drivers/r300/r300_render.c | 4 +++ 3 files changed, 34 insertions(+), 22 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 921170aef1..cc40abf168 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -1014,32 +1014,12 @@ static void r300_flush_pvs(struct r300_context* r300) END_CS; } -/* Emit all dirty state. */ -void r300_emit_dirty_state(struct r300_context* r300) +void r300_emit_buffer_validate(struct r300_context *r300) { - struct r300_screen* r300screen = r300_screen(r300->context.screen); struct r300_texture* tex; - struct r300_atom* atom; - unsigned i, dwords = 1024; - int dirty_tex = 0; + unsigned i; boolean invalid = FALSE; - /* Check the required number of dwords against the space remaining in the - * current CS object. If we need more, then flush. */ - - foreach(atom, &r300->atom_list) { - if (atom->dirty || atom->always_dirty) { - dwords += atom->size; - } - } - - /* Make sure we have at least 2*1024 spare dwords. */ - /* XXX It would be nice to know the number of dwords we really need to - * XXX emit. */ - if (!r300->winsys->check_cs(r300->winsys, dwords)) { - r300->context.flush(&r300->context, 0, NULL); - } - /* Clean out BOs. */ r300->winsys->reset_bos(r300->winsys); @@ -1103,6 +1083,32 @@ validate: invalid = TRUE; goto validate; } +} + +/* Emit all dirty state. */ +void r300_emit_dirty_state(struct r300_context* r300) +{ + struct r300_screen* r300screen = r300_screen(r300->context.screen); + struct r300_atom* atom; + unsigned i, dwords = 1024; + int dirty_tex = 0; + + /* Check the required number of dwords against the space remaining in the + * current CS object. If we need more, then flush. */ + + foreach(atom, &r300->atom_list) { + if (atom->dirty || atom->always_dirty) { + dwords += atom->size; + } + } + + /* Make sure we have at least 2*1024 spare dwords. */ + /* XXX It would be nice to know the number of dwords we really need to + * XXX emit. */ + if (!r300->winsys->check_cs(r300->winsys, dwords)) { + r300->context.flush(&r300->context, 0, NULL); + r300_emit_buffer_validate(r300); + } if (r300->dirty_state & R300_NEW_QUERY) { r300_emit_query_start(r300); diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 05a6bfeae8..2f3d013f5e 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -95,4 +95,6 @@ void r300_flush_textures(struct r300_context* r300); /* Emit all dirty state. */ void r300_emit_dirty_state(struct r300_context* r300); +void r300_emit_buffer_validate(struct r300_context *r300); + #endif /* R300_EMIT_H */ diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 90de062bcd..68abfbe208 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -311,6 +311,8 @@ void r300_draw_range_elements(struct pipe_context* pipe, indexSize = 2; } + r300_emit_buffer_validate(r300->winsys); + if (!r300->winsys->add_buffer(r300->winsys, indexBuffer, RADEON_GEM_DOMAIN_GTT, 0)) { goto cleanup; @@ -361,6 +363,8 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode, r300_update_derived_state(r300); + r300_emit_buffer_validate(r300); + if (!r300_setup_vertex_buffers(r300)) { return; } -- cgit v1.2.3