diff options
author | Samuel Pitoiset <[email protected]> | 2018-07-25 16:56:06 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-07-27 14:31:27 +0200 |
commit | c08ae911d9a6e4d327fd1fb5316edd093e8d245b (patch) | |
tree | 3bb29553de221ee8f629ef80efe6c7be0ddb1f69 /src/amd | |
parent | 434630f57ca75413729b1631387154659fcb9a32 (diff) |
radv: check CS space in radv_emit_write_data_packet()
This wasn't wrong but it looks better to me like this. It's
only used for debugging purposes (ie. RADV_TRACE_FILE).
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/vulkan/radv_cmd_buffer.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 2e65be4f30c..2fb64d91d8e 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -429,9 +429,13 @@ radv_cmd_buffer_upload_data(struct radv_cmd_buffer *cmd_buffer, } static void -radv_emit_write_data_packet(struct radeon_cmdbuf *cs, uint64_t va, +radv_emit_write_data_packet(struct radv_cmd_buffer *cmd_buffer, uint64_t va, unsigned count, const uint32_t *data) { + struct radeon_cmdbuf *cs = cmd_buffer->cs; + + radeon_check_space(cmd_buffer->device->ws, cs, 4 + count); + radeon_emit(cs, PKT3(PKT3_WRITE_DATA, 2 + count, 0)); radeon_emit(cs, S_370_DST_SEL(V_370_MEM_ASYNC) | S_370_WR_CONFIRM(1) | @@ -451,10 +455,12 @@ void radv_cmd_buffer_trace_emit(struct radv_cmd_buffer *cmd_buffer) if (cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) va += 4; - MAYBE_UNUSED unsigned cdw_max = radeon_check_space(cmd_buffer->device->ws, cmd_buffer->cs, 7); - ++cmd_buffer->state.trace_id; - radv_emit_write_data_packet(cs, va, 1, &cmd_buffer->state.trace_id); + radv_emit_write_data_packet(cmd_buffer, va, 1, + &cmd_buffer->state.trace_id); + + radeon_check_space(cmd_buffer->device->ws, cs, 2); + radeon_emit(cs, PKT3(PKT3_NOP, 0, 0)); radeon_emit(cs, AC_ENCODE_TRACE_POINT(cmd_buffer->state.trace_id)); } @@ -493,7 +499,6 @@ radv_save_pipeline(struct radv_cmd_buffer *cmd_buffer, struct radv_pipeline *pipeline, enum ring_type ring) { struct radv_device *device = cmd_buffer->device; - struct radeon_cmdbuf *cs = cmd_buffer->cs; uint32_t data[2]; uint64_t va; @@ -510,13 +515,10 @@ radv_save_pipeline(struct radv_cmd_buffer *cmd_buffer, assert(!"invalid ring type"); } - MAYBE_UNUSED unsigned cdw_max = radeon_check_space(device->ws, - cmd_buffer->cs, 6); - data[0] = (uintptr_t)pipeline; data[1] = (uintptr_t)pipeline >> 32; - radv_emit_write_data_packet(cs, va, 2, data); + radv_emit_write_data_packet(cmd_buffer, va, 2, data); } void radv_set_descriptor_set(struct radv_cmd_buffer *cmd_buffer, @@ -540,22 +542,18 @@ radv_save_descriptors(struct radv_cmd_buffer *cmd_buffer, struct radv_descriptor_state *descriptors_state = radv_get_descriptors_state(cmd_buffer, bind_point); struct radv_device *device = cmd_buffer->device; - struct radeon_cmdbuf *cs = cmd_buffer->cs; uint32_t data[MAX_SETS * 2] = {}; uint64_t va; unsigned i; va = radv_buffer_get_va(device->trace_bo) + 24; - MAYBE_UNUSED unsigned cdw_max = radeon_check_space(device->ws, - cmd_buffer->cs, 4 + MAX_SETS * 2); - for_each_bit(i, descriptors_state->valid) { struct radv_descriptor_set *set = descriptors_state->sets[i]; data[i * 2] = (uintptr_t)set; data[i * 2 + 1] = (uintptr_t)set >> 32; } - radv_emit_write_data_packet(cs, va, MAX_SETS * 2, data); + radv_emit_write_data_packet(cmd_buffer, va, MAX_SETS * 2, data); } struct radv_userdata_info * |