summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2012-06-25 21:16:11 +0000
committerTom Stellard <[email protected]>2012-07-09 13:41:17 +0000
commite00e1586dd94c1bbcd1ecfd9649fde9281be1977 (patch)
tree1fce3d3a1f211d930358d4cc4eb96d4e6a389608 /src/gallium/drivers
parent25145de03e980a182b656efce75c33a6129def06 (diff)
r600g: Add pkt_flag parameter to r600_context_block_emit_dirty()
This allows the shader type bit to be set in the pm4 header when emitting registers for compute shaders. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600.h2
-rw-r--r--src/gallium/drivers/r600/r600_hw_context.c14
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c2
3 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index d95eadaa9c6..d4e01d9694e 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -215,7 +215,7 @@ void r600_context_streamout_begin(struct r600_context *ctx);
void r600_context_streamout_end(struct r600_context *ctx);
void r600_context_draw_opaque_count(struct r600_context *ctx, struct r600_so_target *t);
void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean count_draw_in);
-void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block);
+void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block, unsigned pkt_flags);
void r600_context_block_resource_emit_dirty(struct r600_context *ctx, struct r600_block *block);
int evergreen_context_init(struct r600_context *ctx);
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 9303d09167c..77c35538a29 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -1025,7 +1025,12 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60
r600_context_pipe_state_set_sampler_border(ctx, state, offset);
}
-void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block)
+/**
+ * @param pkt_flags should be set to RADEON_CP_PACKET3_COMPUTE_MODE if this
+ * block will be used for compute shaders.
+ */
+void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block,
+ unsigned pkt_flags)
{
struct radeon_winsys_cs *cs = ctx->cs;
int optional = block->nbo == 0 && !(block->flags & REG_FLAG_DIRTY_ALWAYS);
@@ -1063,6 +1068,13 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *
cp_dwords = new_dwords + 2;
}
memcpy(&cs->buf[cs->cdw], block->pm4, cp_dwords * 4);
+
+ /* We are applying the pkt_flags after copying the register block to
+ * the the command stream, because it is possible this block will be
+ * emitted with a different pkt_flags, and we don't want to store the
+ * pkt_flags in the block.
+ */
+ cs->buf[cs->cdw] |= pkt_flags;
cs->cdw += cp_dwords;
if (optional) {
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index b5241a72e73..2cf0171166e 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -957,7 +957,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo)
r600_emit_atom(rctx, state);
}
LIST_FOR_EACH_ENTRY_SAFE(dirty_block, next_block, &rctx->dirty,list) {
- r600_context_block_emit_dirty(rctx, dirty_block);
+ r600_context_block_emit_dirty(rctx, dirty_block, 0 /* pkt_flags */);
}
LIST_FOR_EACH_ENTRY_SAFE(dirty_block, next_block, &rctx->resource_dirty,list) {
r600_context_block_resource_emit_dirty(rctx, dirty_block);