summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_emit.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-02-22 15:11:29 +0100
committerCorbin Simpson <MostAwesomeDude@gmail.com>2010-02-24 17:11:47 -0800
commite6632b4bf7cba5fe8a77d54635a3b617fa67185f (patch)
treec51f40deebfe74d2006082b6d956ff95b3373d1a /src/gallium/drivers/r300/r300_emit.c
parentb7041db8f8af07d3eec68fb259e2f17ceb8bd421 (diff)
r300g: prevent CS overflow when emitting the draw packets
Signed-off-by: Corbin Simpson <MostAwesomeDude@gmail.com>
Diffstat (limited to 'src/gallium/drivers/r300/r300_emit.c')
-rw-r--r--src/gallium/drivers/r300/r300_emit.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index f7dcd8dc52..2d8801c08a 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -1076,16 +1076,10 @@ validate:
}
}
-/* Emit all dirty state. */
-void r300_emit_dirty_state(struct r300_context* r300)
+unsigned r300_get_num_dirty_dwords(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. */
+ unsigned dwords = 0;
foreach(atom, &r300->atom_list) {
if (atom->dirty || atom->always_dirty) {
@@ -1093,12 +1087,19 @@ void r300_emit_dirty_state(struct r300_context* r300)
}
}
- /* 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. */
- while (!r300->winsys->check_cs(r300->winsys, dwords)) {
- r300->context.flush(&r300->context, 0, NULL);
- }
+ /* XXX This is the compensation for the non-atomized states. */
+ dwords += 2048;
+
+ return dwords;
+}
+
+/* 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;
+ int dirty_tex = 0;
if (r300->dirty_state & R300_NEW_QUERY) {
r300_emit_query_start(r300);