summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-04-29 07:47:05 +0800
committerChia-I Wu <[email protected]>2013-05-01 17:36:44 +0800
commit68e1f76e4605c22c2d24b3672fb8350e7f7b8780 (patch)
tree9a265935d2953af36592fb67a79660d67bd5323e /src/gallium/drivers/ilo
parent9557cd39e2ed749493d7af2a8e094415e3cc252d (diff)
ilo: correctly program SO states for GEN7
With the commands supported by GPE, we can finally program the states.
Diffstat (limited to 'src/gallium/drivers/ilo')
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c53
1 files changed, 46 insertions, 7 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
index 1b39b294574..6741fa8ef4a 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
@@ -376,17 +376,56 @@ gen7_pipeline_sol(struct ilo_3d_pipeline *p,
const struct ilo_context *ilo,
struct gen6_pipeline_session *session)
{
- if (session->hw_ctx_changed) {
- if (ilo->stream_output_targets.num_targets) {
- int i;
+ const struct pipe_stream_output_info *so_info;
+ const struct ilo_shader *sh;
+ bool dirty_sh = false;
+
+ if (ilo->gs) {
+ so_info = &ilo->gs->info.stream_output;
+ sh = ilo->gs->shader;
+ dirty_sh = DIRTY(GS);
+ }
+ else if (ilo->vs) {
+ so_info = &ilo->vs->info.stream_output;
+ sh = ilo->vs->shader;
+ dirty_sh = DIRTY(VS);
+ }
+
+ gen6_pipeline_update_max_svbi(p, ilo, session);
+
+ /* 3DSTATE_SO_BUFFER */
+ if (DIRTY(STREAM_OUTPUT_TARGETS) || dirty_sh) {
+ int i;
- for (i = 0; i < 4; i++)
- p->gen7_3DSTATE_SO_BUFFER(p->dev, i, 0, 0, NULL, p->cp);
+ for (i = 0; i < ilo->stream_output_targets.num_targets; i++) {
+ const int stride = so_info->stride[i] * 4; /* in bytes */
+ int base = 0;
- p->gen7_3DSTATE_SO_DECL_LIST(p->dev, NULL, NULL, p->cp);
+ /* reset HW write offsets and offset buffer base */
+ if (!p->cp->hw_ctx) {
+ ilo_cp_set_one_off_flags(p->cp, INTEL_EXEC_GEN7_SOL_RESET);
+ base += p->state.so_num_vertices * stride;
+ }
+
+ p->gen7_3DSTATE_SO_BUFFER(p->dev, i, base, stride,
+ ilo->stream_output_targets.targets[i], p->cp);
}
- p->gen7_3DSTATE_STREAMOUT(p->dev, 0, 0, false, p->cp);
+ for (; i < 4; i++)
+ p->gen7_3DSTATE_SO_BUFFER(p->dev, i, 0, 0, NULL, p->cp);
+ }
+
+ /* 3DSTATE_SO_DECL_LIST */
+ if (dirty_sh)
+ p->gen7_3DSTATE_SO_DECL_LIST(p->dev, so_info, sh, p->cp);
+
+ /* 3DSTATE_STREAMOUT */
+ if (DIRTY(STREAM_OUTPUT_TARGETS) || DIRTY(RASTERIZER) || dirty_sh) {
+ const unsigned buffer_mask =
+ (1 << ilo->stream_output_targets.num_targets) - 1;
+
+ p->gen7_3DSTATE_STREAMOUT(p->dev, buffer_mask, sh->out.count,
+ ilo->rasterizer->rasterizer_discard, p->cp);
}
}