radv: Add amd_ip_type to radv_cmd_stream
Specify an amd_ip_type when initializing radv_cmd_stream so that we know which packets are valid for the HW IP type of a given command stream. This field should be used instead of radv_cmd_buffer::qf when emitting packets to a command stream. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37775>
This commit is contained in:
@@ -1204,11 +1204,12 @@ radv_create_cmd_buffer(struct vk_command_pool *pool, VkCommandBufferLevel level,
|
||||
cmd_buffer->qf = vk_queue_to_radv(pdev, pool->queue_family_index);
|
||||
|
||||
if (cmd_buffer->qf != RADV_QUEUE_SPARSE) {
|
||||
const enum amd_ip_type ip = radv_queue_family_to_ring(pdev, cmd_buffer->qf);
|
||||
list_inithead(&cmd_buffer->upload.list);
|
||||
|
||||
radv_cmd_buffer_init_shader_part_cache(device, cmd_buffer);
|
||||
result = radv_create_cmd_stream(device, cmd_buffer->qf, cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY,
|
||||
&cmd_buffer->cs);
|
||||
result =
|
||||
radv_create_cmd_stream(device, ip, cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY, &cmd_buffer->cs);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_destroy_cmd_buffer(&cmd_buffer->vk);
|
||||
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
@@ -1589,8 +1590,8 @@ radv_gang_init(struct radv_cmd_buffer *cmd_buffer)
|
||||
if (cmd_buffer->gang.cs)
|
||||
return true;
|
||||
|
||||
result = radv_create_cmd_stream(device, RADV_QUEUE_COMPUTE,
|
||||
cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY, &cmd_buffer->gang.cs);
|
||||
result = radv_create_cmd_stream(device, AMD_IP_COMPUTE, cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY,
|
||||
&cmd_buffer->gang.cs);
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_command_buffer_set_error(&cmd_buffer->vk, result);
|
||||
return false;
|
||||
|
||||
@@ -583,6 +583,7 @@ struct radv_cmd_stream {
|
||||
bool context_roll_without_scissor_emitted;
|
||||
|
||||
struct radv_tracked_regs tracked_regs;
|
||||
enum amd_ip_type hw_ip;
|
||||
|
||||
uint32_t num_buffered_sh_regs;
|
||||
struct {
|
||||
|
||||
@@ -22,7 +22,7 @@ radv_create_shadow_regs_preamble(struct radv_device *device, struct radv_queue_s
|
||||
struct radv_cmd_stream *cs;
|
||||
VkResult result;
|
||||
|
||||
result = radv_create_cmd_stream(device, RADV_QUEUE_GENERAL, false, &cs);
|
||||
result = radv_create_cmd_stream(device, AMD_IP_GFX, false, &cs);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
@@ -115,7 +115,7 @@ radv_init_shadowed_regs_buffer_state(const struct radv_device *device, struct ra
|
||||
struct radv_cmd_stream *cs;
|
||||
VkResult result;
|
||||
|
||||
result = radv_create_cmd_stream(device, RADV_QUEUE_GENERAL, false, &cs);
|
||||
result = radv_create_cmd_stream(device, AMD_IP_GFX, false, &cs);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
|
||||
@@ -636,20 +636,19 @@ radv_init_tracked_regs(struct radv_cmd_stream *cs)
|
||||
}
|
||||
|
||||
void
|
||||
radv_init_cmd_stream(struct radv_cmd_stream *cs)
|
||||
radv_init_cmd_stream(struct radv_cmd_stream *cs, const enum amd_ip_type ip_type)
|
||||
{
|
||||
cs->context_roll_without_scissor_emitted = false;
|
||||
cs->num_buffered_sh_regs = 0;
|
||||
cs->hw_ip = ip_type;
|
||||
|
||||
radv_init_tracked_regs(cs);
|
||||
}
|
||||
|
||||
VkResult
|
||||
radv_create_cmd_stream(const struct radv_device *device, enum radv_queue_family family, bool is_secondary,
|
||||
radv_create_cmd_stream(const struct radv_device *device, const enum amd_ip_type ip_type, const bool is_secondary,
|
||||
struct radv_cmd_stream **cs_out)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
const enum amd_ip_type ip_type = radv_queue_family_to_ring(pdev, family);
|
||||
struct radeon_winsys *ws = device->ws;
|
||||
struct radv_cmd_stream *cs;
|
||||
|
||||
@@ -657,7 +656,7 @@ radv_create_cmd_stream(const struct radv_device *device, enum radv_queue_family
|
||||
if (!cs)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
radv_init_cmd_stream(cs);
|
||||
radv_init_cmd_stream(cs, ip_type);
|
||||
|
||||
cs->b = ws->cs_create(ws, ip_type, is_secondary);
|
||||
if (!cs->b) {
|
||||
@@ -674,7 +673,7 @@ radv_reset_cmd_stream(const struct radv_device *device, struct radv_cmd_stream *
|
||||
{
|
||||
struct radeon_winsys *ws = device->ws;
|
||||
|
||||
radv_init_cmd_stream(cs);
|
||||
radv_init_cmd_stream(cs, cs->hw_ip);
|
||||
|
||||
ws->cs_reset(cs->b);
|
||||
}
|
||||
|
||||
@@ -417,10 +417,10 @@ radv_emit_pm4_commands(struct radv_cmd_stream *cs, const struct ac_pm4_state *pm
|
||||
radeon_end();
|
||||
}
|
||||
|
||||
VkResult radv_create_cmd_stream(const struct radv_device *device, enum radv_queue_family family, bool is_secondary,
|
||||
struct radv_cmd_stream **cs_out);
|
||||
VkResult radv_create_cmd_stream(const struct radv_device *device, const enum amd_ip_type ip_type,
|
||||
const bool is_secondary, struct radv_cmd_stream **cs_out);
|
||||
|
||||
void radv_init_cmd_stream(struct radv_cmd_stream *cs);
|
||||
void radv_init_cmd_stream(struct radv_cmd_stream *cs, const enum amd_ip_type ip_type);
|
||||
|
||||
void radv_reset_cmd_stream(const struct radv_device *device, struct radv_cmd_stream *cs);
|
||||
|
||||
|
||||
@@ -902,7 +902,7 @@ radv_create_gfx_preamble(struct radv_device *device)
|
||||
struct radv_cmd_stream *cs;
|
||||
VkResult result;
|
||||
|
||||
result = radv_create_cmd_stream(device, RADV_QUEUE_GENERAL, false, &cs);
|
||||
result = radv_create_cmd_stream(device, AMD_IP_GFX, false, &cs);
|
||||
if (result != VK_SUCCESS)
|
||||
return;
|
||||
|
||||
|
||||
@@ -3379,7 +3379,10 @@ radv_update_ies_shader(struct radv_device *device, struct radv_indirect_executio
|
||||
struct radv_compute_pipeline_metadata md;
|
||||
struct radv_cmd_stream cs;
|
||||
|
||||
radv_init_cmd_stream(&cs);
|
||||
/* The IES shader may be used on GFX and compute queues.
|
||||
* IP type doesn't matter here, but use compute because this emits a compute shader.
|
||||
*/
|
||||
radv_init_cmd_stream(&cs, AMD_IP_COMPUTE);
|
||||
|
||||
assert(shader->info.stage == MESA_SHADER_COMPUTE);
|
||||
radv_get_compute_shader_metadata(device, shader, &md);
|
||||
|
||||
@@ -1121,11 +1121,13 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
ws->buffer_unmap(ws, descriptor_bo, false);
|
||||
}
|
||||
|
||||
const enum amd_ip_type hw_ip = radv_queue_family_to_ring(pdev, queue->qf);
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
enum rgp_flush_bits sqtt_flush_bits = 0;
|
||||
struct radv_cmd_stream *cs = NULL;
|
||||
|
||||
result = radv_create_cmd_stream(device, queue->qf, false, &cs);
|
||||
result = radv_create_cmd_stream(device, hw_ip, false, &cs);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
@@ -1385,7 +1387,7 @@ radv_create_flush_postamble(struct radv_queue *queue)
|
||||
struct radv_cmd_stream *cs;
|
||||
VkResult result;
|
||||
|
||||
result = radv_create_cmd_stream(device, queue->state.qf, false, &cs);
|
||||
result = radv_create_cmd_stream(device, ip, false, &cs);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
@@ -1423,6 +1425,7 @@ radv_create_gang_wait_preambles_postambles(struct radv_queue *queue)
|
||||
{
|
||||
struct radv_device *device = radv_queue_device(queue);
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
const enum amd_ip_type ip = radv_queue_family_to_ring(pdev, queue->state.qf);
|
||||
|
||||
if (queue->gang_sem_bo)
|
||||
return VK_SUCCESS;
|
||||
@@ -1444,19 +1447,19 @@ radv_create_gang_wait_preambles_postambles(struct radv_queue *queue)
|
||||
struct radv_cmd_stream *leader_pre_cs = NULL, *leader_post_cs = NULL;
|
||||
struct radv_cmd_stream *ace_pre_cs = NULL, *ace_post_cs = NULL;
|
||||
|
||||
r = radv_create_cmd_stream(device, queue->state.qf, false, &leader_pre_cs);
|
||||
r = radv_create_cmd_stream(device, ip, false, &leader_pre_cs);
|
||||
if (r != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
radv_create_cmd_stream(device, queue->state.qf, false, &leader_post_cs);
|
||||
radv_create_cmd_stream(device, ip, false, &leader_post_cs);
|
||||
if (r != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
radv_create_cmd_stream(device, RADV_QUEUE_COMPUTE, false, &ace_pre_cs);
|
||||
radv_create_cmd_stream(device, AMD_IP_COMPUTE, false, &ace_pre_cs);
|
||||
if (r != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
radv_create_cmd_stream(device, RADV_QUEUE_COMPUTE, false, &ace_post_cs);
|
||||
radv_create_cmd_stream(device, AMD_IP_COMPUTE, false, &ace_post_cs);
|
||||
if (r != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
@@ -1592,7 +1595,7 @@ radv_create_perf_counter_lock_cs(struct radv_device *device, unsigned pass, bool
|
||||
if (*cs_ref)
|
||||
return *cs_ref;
|
||||
|
||||
result = radv_create_cmd_stream(device, RADV_QUEUE_GENERAL, false, &cs);
|
||||
result = radv_create_cmd_stream(device, AMD_IP_GFX, false, &cs);
|
||||
if (result != VK_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -1432,7 +1432,7 @@ radv_init_shader_upload_queue(struct radv_device *device)
|
||||
for (unsigned i = 0; i < RADV_SHADER_UPLOAD_CS_COUNT; i++) {
|
||||
struct radv_shader_dma_submission *submission = calloc(1, sizeof(struct radv_shader_dma_submission));
|
||||
|
||||
result = radv_create_cmd_stream(device, RADV_QUEUE_TRANSFER, false, &submission->cs);
|
||||
result = radv_create_cmd_stream(device, AMD_IP_SDMA, false, &submission->cs);
|
||||
if (result != VK_SUCCESS) {
|
||||
free(submission);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user