summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/gen6_sol.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2013-05-17 11:53:53 -0700
committerKenneth Graunke <kenneth@whitecape.org>2013-05-21 13:29:27 -0700
commit64a87f29ce29d3c2e01b7fd79386bf6ace454f62 (patch)
treeae20d2a93f5255582b157a6c02ba3531a8b263ad /src/mesa/drivers/dri/i965/gen6_sol.c
parent647fc0c50bc9832c336b2b7e4329abec31df9dec (diff)
i965: Kill software primitive counting entirely.
Now that we have hardware contexts, we don't need to continually reprogram the GS_SVBI_INDEX registers. They're automatically saved and restored with the context, so they can just increment over time. We only need to reset them when starting transform feedback. There's also no reason to delay until the next drawing operation; we can just emit the packet immediately. However, this means we must drop the initialization in brw_invariant_state, as BeginTransformFeedback may occur before the first drawing in a context. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen6_sol.c')
-rw-r--r--src/mesa/drivers/dri/i965/gen6_sol.c53
1 files changed, 22 insertions, 31 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
index 668a99e503d..cdd6e74c865 100644
--- a/src/mesa/drivers/dri/i965/gen6_sol.c
+++ b/src/mesa/drivers/dri/i965/gen6_sol.c
@@ -132,29 +132,6 @@ const struct brw_tracked_state gen6_gs_binding_table = {
.emit = brw_gs_upload_binding_table,
};
-static void
-gen6_update_sol_indices(struct brw_context *brw)
-{
- struct intel_context *intel = &brw->intel;
-
- BEGIN_BATCH(4);
- OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2));
- OUT_BATCH(0);
- OUT_BATCH(brw->sol.svbi_0_starting_index); /* BRW_NEW_SOL_INDICES */
- OUT_BATCH(brw->sol.svbi_0_max_index); /* BRW_NEW_SOL_INDICES */
- ADVANCE_BATCH();
-}
-
-const struct brw_tracked_state gen6_sol_indices = {
- .dirty = {
- .mesa = 0,
- .brw = (BRW_NEW_CONTEXT |
- BRW_NEW_SOL_INDICES),
- .cache = 0
- },
- .emit = gen6_update_sol_indices,
-};
-
void
brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj)
@@ -175,14 +152,28 @@ brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
= _mesa_compute_max_transform_feedback_vertices(xfb_obj,
linked_xfb_info);
- /* Initialize the SVBI 0 register to zero and set the maximum index.
- * These values will be sent to the hardware on the next draw.
- */
- brw->state.dirty.brw |= BRW_NEW_SOL_INDICES;
- brw->sol.svbi_0_starting_index = 0;
- brw->sol.svbi_0_max_index = max_index;
-
- if (intel->gen >= 7) {
+ if (intel->gen == 6) {
+ /* Initialize the SVBI 0 register to zero and set the maximum index. */
+ BEGIN_BATCH(4);
+ OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2));
+ OUT_BATCH(0); /* SVBI 0 */
+ OUT_BATCH(0); /* starting index */
+ OUT_BATCH(max_index);
+ ADVANCE_BATCH();
+
+ /* Initialize the rest of the unused streams to sane values. Otherwise,
+ * they may indicate that there is no room to write data and prevent
+ * anything from happening at all.
+ */
+ for (int i = 1; i < 4; i++) {
+ BEGIN_BATCH(4);
+ OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2));
+ OUT_BATCH(i << SVB_INDEX_SHIFT);
+ OUT_BATCH(0); /* starting index */
+ OUT_BATCH(0xffffffff);
+ ADVANCE_BATCH();
+ }
+ } else if (intel->gen >= 7) {
/* Reset the SOL buffer offset register. */
for (int i = 0; i < 4; i++) {
BEGIN_BATCH(3);