summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-09-16 02:04:37 +0200
committerMarek Olšák <[email protected]>2010-09-16 20:33:43 +0200
commitd4b2de13bc652cd134826801ada48d0bb88a8258 (patch)
treebce67aa3751fd91a906bc7ef92be9b09d3283f6d /src/gallium/drivers/r300
parentdb94a2a5be8e9a8e4de088771874b14b79438299 (diff)
r300g/swtcl: fix CS overrun
https://bugs.freedesktop.org/show_bug.cgi?id=29901
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/r300_context.h1
-rw-r--r--src/gallium/drivers/r300/r300_render.c35
2 files changed, 28 insertions, 8 deletions
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 8eddf72b704..7f655dbfd21 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -457,6 +457,7 @@ struct r300_context {
size_t draw_vbo_size;
/* Whether the VBO must not be flushed. */
boolean draw_vbo_locked;
+ boolean draw_first_emitted;
/* Accelerated blit support. */
struct blitter_context* blitter;
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 177850dea2f..2f00c878f5b 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -753,6 +753,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
draw_set_mapped_index_buffer(r300->draw, indices);
r300->draw_vbo_locked = TRUE;
+ r300->draw_first_emitted = FALSE;
draw_vbo(r300->draw, info);
draw_flush(r300->draw);
r300->draw_vbo_locked = FALSE;
@@ -907,10 +908,17 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
DBG(r300, DBG_DRAW, "r300: render_draw_arrays (count: %d)\n", count);
- if (!r300_emit_states(r300,
- PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
- NULL, 0, 0))
- return;
+ if (r300->draw_first_emitted) {
+ if (!r300_prepare_for_rendering(r300,
+ PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+ NULL, 6, 0, 0))
+ return;
+ } else {
+ if (!r300_emit_states(r300,
+ PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+ NULL, 0, 0))
+ return;
+ }
/* Uncomment to dump all VBOs rendered through this interface.
* Slow and noisy!
@@ -937,6 +945,8 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
r300render->hwprim);
END_CS;
+
+ r300->draw_first_emitted = TRUE;
}
static void r300_render_draw_elements(struct vbuf_render* render,
@@ -955,10 +965,17 @@ static void r300_render_draw_elements(struct vbuf_render* render,
CS_LOCALS(r300);
DBG(r300, DBG_DRAW, "r300: render_draw_elements (count: %d)\n", count);
- if (!r300_emit_states(r300,
- PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
- NULL, 0, 0))
- return;
+ if (r300->draw_first_emitted) {
+ if (!r300_prepare_for_rendering(r300,
+ PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
+ NULL, 256, 0, 0))
+ return;
+ } else {
+ if (!r300_emit_states(r300,
+ PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
+ NULL, 0, 0))
+ return;
+ }
/* Below we manage the CS space manually because there may be more
* indices than it can fit in CS. */
@@ -999,6 +1016,8 @@ static void r300_render_draw_elements(struct vbuf_render* render,
end_cs_dwords = r300_get_num_cs_end_dwords(r300);
}
}
+
+ r300->draw_first_emitted = TRUE;
}
static void r300_render_destroy(struct vbuf_render* render)