From 7b8c0f058e6fef783136ef4aecc13fc10aac9a46 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 11 Jul 2018 17:05:10 -0700 Subject: [PATCH] iris: actually pin the buffers --- src/gallium/drivers/iris/iris_context.h | 3 ++- src/gallium/drivers/iris/iris_state.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 24d891f97fd..d62935a0832 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -285,8 +285,9 @@ struct iris_context { unsigned num_samplers[MESA_SHADER_STAGES]; unsigned num_textures[MESA_SHADER_STAGES]; - /** 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets */ + struct pipe_stream_output_target *so_target[PIPE_MAX_SO_BUFFERS]; bool streamout_active; + /** 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets */ uint32_t *streamout; struct iris_state_ref unbound_tex; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 089458d2b70..e4ecba68254 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -1708,6 +1708,11 @@ iris_set_stream_output_targets(struct pipe_context *ctx, ice->state.dirty |= IRIS_DIRTY_STREAMOUT; } + for (int i = 0; i < 4; i++) { + pipe_so_target_reference(&ice->state.so_target[i], + i < num_targets ? targets[i] : NULL); + } + /* No need to update 3DSTATE_SO_BUFFER unless SOL is active. */ if (!active) return; @@ -2893,6 +2898,15 @@ iris_upload_render_state(struct iris_context *ice, if (dirty & IRIS_DIRTY_SO_BUFFERS) { iris_batch_emit(batch, genx->so_buffers, 4 * 4 * GENX(3DSTATE_SO_BUFFER_length)); + for (int i = 0; i < 4; i++) { + struct iris_stream_output_target *tgt = + (void *) ice->state.so_target[i]; + if (tgt) { + iris_use_pinned_bo(batch, iris_resource_bo(tgt->base.buffer), + true); + iris_use_pinned_bo(batch, iris_resource_bo(tgt->offset.res), true); + } + } } if ((dirty & IRIS_DIRTY_SO_DECL_LIST) && ice->state.streamout) { -- 2.30.2