anv: move queue check helpers to anv_private

Also fix missing trace point stuff in command buffer begin/end

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Felix DeGrood <felix.j.degrood@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22179>
This commit is contained in:
Lionel Landwerlin 2023-03-30 15:16:09 +03:00 committed by Marge Bot
parent 546a6752ac
commit c88de6c18c
2 changed files with 26 additions and 25 deletions

View File

@ -2834,6 +2834,20 @@ anv_cmd_buffer_is_chainable(struct anv_cmd_buffer *cmd_buffer)
VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT);
}
static inline bool
anv_cmd_buffer_is_render_queue(const struct anv_cmd_buffer *cmd_buffer)
{
struct anv_queue_family *queue_family = cmd_buffer->queue_family;
return (queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0;
}
static inline bool
anv_cmd_buffer_is_video_queue(const struct anv_cmd_buffer *cmd_buffer)
{
struct anv_queue_family *queue_family = cmd_buffer->queue_family;
return (queue_family->queueFlags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) != 0;
}
VkResult anv_cmd_buffer_init_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer);
void anv_cmd_buffer_fini_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer);
void anv_cmd_buffer_reset_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer);

View File

@ -87,20 +87,6 @@ convert_pc_to_bits(struct GENX(PIPE_CONTROL) *pc) {
fprintf(stderr, ") reason: %s\n", __func__); \
}
static bool
is_render_queue_cmd_buffer(const struct anv_cmd_buffer *cmd_buffer)
{
struct anv_queue_family *queue_family = cmd_buffer->queue_family;
return (queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0;
}
static bool
is_video_queue_cmd_buffer(const struct anv_cmd_buffer *cmd_buffer)
{
struct anv_queue_family *queue_family = cmd_buffer->queue_family;
return (queue_family->queueFlags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) != 0;
}
ALWAYS_INLINE static void
genX(emit_dummy_post_sync_op)(struct anv_cmd_buffer *cmd_buffer,
uint32_t vertex_count)
@ -3640,11 +3626,11 @@ genX(BeginCommandBuffer)(
if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY)
cmd_buffer->usage_flags &= ~VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT;
if (is_video_queue_cmd_buffer(cmd_buffer))
return VK_SUCCESS;
trace_intel_begin_cmd_buffer(&cmd_buffer->trace);
if (anv_cmd_buffer_is_video_queue(cmd_buffer))
return VK_SUCCESS;
genX(cmd_buffer_emit_state_base_address)(cmd_buffer);
/* We sometimes store vertex data in the dynamic state buffer for blorp
@ -3809,13 +3795,14 @@ genX(EndCommandBuffer)(
if (anv_batch_has_error(&cmd_buffer->batch))
return cmd_buffer->batch.status;
if (is_video_queue_cmd_buffer(cmd_buffer)) {
anv_measure_endcommandbuffer(cmd_buffer);
if (anv_cmd_buffer_is_video_queue(cmd_buffer)) {
trace_intel_end_cmd_buffer(&cmd_buffer->trace, cmd_buffer->vk.level);
anv_cmd_buffer_end_batch_buffer(cmd_buffer);
return VK_SUCCESS;
}
anv_measure_endcommandbuffer(cmd_buffer);
genX(cmd_buffer_flush_generated_draws)(cmd_buffer);
/* Turn on object level preemption if it is disabled to have it in known
@ -4016,7 +4003,7 @@ cmd_buffer_barrier(struct anv_cmd_buffer *cmd_buffer,
VkAccessFlags2 src_flags = 0;
VkAccessFlags2 dst_flags = 0;
if (is_video_queue_cmd_buffer(cmd_buffer))
if (anv_cmd_buffer_is_video_queue(cmd_buffer))
return;
for (uint32_t i = 0; i < dep_info->memoryBarrierCount; i++) {
@ -5895,7 +5882,7 @@ genX(cmd_buffer_dispatch_kernel)(struct anv_cmd_buffer *cmd_buffer,
genX(cmd_buffer_config_l3)(cmd_buffer, kernel->l3_config);
if (is_render_queue_cmd_buffer(cmd_buffer))
if (anv_cmd_buffer_is_render_queue(cmd_buffer))
genX(flush_pipeline_select_gpgpu)(cmd_buffer);
/* Apply any pending pipeline flushes we may have. We want to apply them
@ -7038,7 +7025,7 @@ void genX(CmdBeginRendering)(
struct anv_cmd_graphics_state *gfx = &cmd_buffer->state.gfx;
VkResult result;
if (!is_render_queue_cmd_buffer(cmd_buffer)) {
if (!anv_cmd_buffer_is_render_queue(cmd_buffer)) {
assert(!"Trying to start a render pass on non-render queue!");
anv_batch_set_error(&cmd_buffer->batch, VK_ERROR_UNKNOWN);
return;
@ -7846,7 +7833,7 @@ void genX(CmdSetEvent2)(
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_event, event, _event);
if (is_video_queue_cmd_buffer(cmd_buffer)) {
if (anv_cmd_buffer_is_video_queue(cmd_buffer)) {
anv_batch_emit(&cmd_buffer->batch, GENX(MI_FLUSH_DW), flush) {
flush.PostSyncOperation = WriteImmediateData;
flush.Address = anv_state_pool_state_address(
@ -7893,7 +7880,7 @@ void genX(CmdResetEvent2)(
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_event, event, _event);
if (is_video_queue_cmd_buffer(cmd_buffer)) {
if (anv_cmd_buffer_is_video_queue(cmd_buffer)) {
anv_batch_emit(&cmd_buffer->batch, GENX(MI_FLUSH_DW), flush) {
flush.PostSyncOperation = WriteImmediateData;
flush.Address = anv_state_pool_state_address(