diff options
author | Jonathan Marek <[email protected]> | 2019-12-18 22:38:09 -0500 |
---|---|---|
committer | Jonathan Marek <[email protected]> | 2019-12-19 15:13:40 -0500 |
commit | f81c41a812c07ca01ee05d60bf6c1551157161d5 (patch) | |
tree | 8adc2a98167539b4c662bcc30c70a77a6eb5e50d | |
parent | bb134c531629978a3f2a9c6bb603a4404c906f08 (diff) |
turnip: emit_compute_driver_params fixes
Offset was wrong, it is in vec4 not dwords.
There's a hole between DP_NUM_WORK_GROUPS_Z and DP_LOCAL_GROUP_SIZE_X so
use the IR3 enums.
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3162>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3162>
-rw-r--r-- | src/freedreno/vulkan/tu_cmd_buffer.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c index 21b113eecc3..272becfcfc9 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.c +++ b/src/freedreno/vulkan/tu_cmd_buffer.c @@ -3577,38 +3577,35 @@ tu_emit_compute_driver_params(struct tu_cs *cs, struct tu_pipeline *pipeline, const struct tu_program_descriptor_linkage *link = &pipeline->program.link[type]; const struct ir3_const_state *const_state = &link->const_state; - uint32_t offset_dwords = const_state->offsets.driver_param; + uint32_t offset = const_state->offsets.driver_param; - if (link->constlen <= offset_dwords) + if (link->constlen <= offset) return; if (!info->indirect) { - uint32_t driver_params[] = { - info->blocks[0], - info->blocks[1], - info->blocks[2], - pipeline->compute.local_size[0], - pipeline->compute.local_size[1], - pipeline->compute.local_size[2], + uint32_t driver_params[IR3_DP_CS_COUNT] = { + [IR3_DP_NUM_WORK_GROUPS_X] = info->blocks[0], + [IR3_DP_NUM_WORK_GROUPS_Y] = info->blocks[1], + [IR3_DP_NUM_WORK_GROUPS_Z] = info->blocks[2], + [IR3_DP_LOCAL_GROUP_SIZE_X] = pipeline->compute.local_size[0], + [IR3_DP_LOCAL_GROUP_SIZE_Y] = pipeline->compute.local_size[1], + [IR3_DP_LOCAL_GROUP_SIZE_Z] = pipeline->compute.local_size[2], }; - uint32_t num_consts = MIN2(const_state->num_driver_params, - link->constlen - offset_dwords); - uint32_t align_size = align(num_consts, 4); + uint32_t num_consts = MIN2(const_state->num_driver_params, + (link->constlen - offset) * 4); /* push constants */ - tu_cs_emit_pkt7(cs, tu6_stage2opcode(type), 3 + align_size); - tu_cs_emit(cs, CP_LOAD_STATE6_0_DST_OFF(offset_dwords / 4) | + tu_cs_emit_pkt7(cs, tu6_stage2opcode(type), 3 + num_consts); + tu_cs_emit(cs, CP_LOAD_STATE6_0_DST_OFF(offset) | CP_LOAD_STATE6_0_STATE_TYPE(ST6_CONSTANTS) | CP_LOAD_STATE6_0_STATE_SRC(SS6_DIRECT) | CP_LOAD_STATE6_0_STATE_BLOCK(tu6_stage2shadersb(type)) | - CP_LOAD_STATE6_0_NUM_UNIT(align_size / 4)); + CP_LOAD_STATE6_0_NUM_UNIT(num_consts / 4)); tu_cs_emit(cs, 0); tu_cs_emit(cs, 0); uint32_t i; for (i = 0; i < num_consts; i++) tu_cs_emit(cs, driver_params[i]); - for (; i < align_size; i++) - tu_cs_emit(cs, 0); } else { tu_finishme("Indirect driver params"); } |