summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-01-23 19:35:42 +1000
committerDave Airlie <[email protected]>2010-01-23 19:35:42 +1000
commit76bc66b664c7e135aa9c06cedd94ee1961d68c70 (patch)
tree4867fa9e10d00409842c03cf8e5f1471fa99fbdf
parent9a62f0ce3bffd37bad101552b57347e0855d1df1 (diff)
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 <[email protected]>
-rw-r--r--src/gallium/drivers/r300/r300_emit.c50
-rw-r--r--src/gallium/drivers/r300/r300_emit.h2
-rw-r--r--src/gallium/drivers/r300/r300_render.c4
3 files changed, 34 insertions, 22 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 921170aef11..cc40abf168b 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 05a6bfeae86..2f3d013f5e0 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 90de062bcda..68abfbe208b 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;
}