Commit 02ac3d65 authored by Kenneth Graunke's avatar Kenneth Graunke
Browse files

anv: Add support for a transfer queue on XeHP

XeHP's blitter commands are sufficient to implement a full transfer
queue.  Tigerlake's blitter lacks compression handling and other
features we need, so we only support this on XeHP.
parent 852b4ef5
Pipeline #676771 waiting for manual action with stages
......@@ -2171,6 +2171,7 @@ anv_queue_exec_locked(struct anv_queue *queue,
if (INTEL_DEBUG(DEBUG_BATCH)) {
fprintf(stderr, "Batch on queue %d\n", (int)(queue - device->queues));
device->decoder_ctx.engine = queue->family->engine_class;
if (cmd_buffer_count) {
if (has_perf_query) {
struct anv_bo *pass_batch_bo = perf_query_pool->bo;
......
......@@ -132,9 +132,15 @@ static void
anv_blorp_batch_init(struct anv_cmd_buffer *cmd_buffer,
struct blorp_batch *batch, enum blorp_batch_flags flags)
{
if (!(cmd_buffer->queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT)) {
assert(cmd_buffer->queue_family->queueFlags & VK_QUEUE_COMPUTE_BIT);
flags |= BLORP_BATCH_USE_COMPUTE;
VkQueueFlags queue_flags = cmd_buffer->queue_family->queueFlags;
if (!(queue_flags & VK_QUEUE_GRAPHICS_BIT)) {
if (queue_flags & VK_QUEUE_COMPUTE_BIT)
flags |= BLORP_BATCH_USE_COMPUTE;
else if (queue_flags & VK_QUEUE_TRANSFER_BIT)
flags |= BLORP_BATCH_USE_BLITTER;
else
unreachable("unknown queue family");
}
blorp_batch_init(&cmd_buffer->device->blorp, batch, cmd_buffer, flags);
......
......@@ -685,6 +685,10 @@ anv_physical_device_init_queue_families(struct anv_physical_device *pdevice)
enum drm_i915_gem_engine_class compute_class =
c_count < 1 ? I915_ENGINE_CLASS_RENDER : I915_ENGINE_CLASS_COMPUTE;
int blit_count =
intel_gem_count_engines(pdevice->engine_info,
I915_ENGINE_CLASS_COPY);
anv_override_engine_counts(&gc_count, &g_count, &c_count);
if (gc_count > 0) {
......@@ -712,6 +716,14 @@ anv_physical_device_init_queue_families(struct anv_physical_device *pdevice)
.engine_class = compute_class,
};
}
if (blit_count > 0 && pdevice->info.verx10 >= 125) {
pdevice->queue.families[family_count++] = (struct anv_queue_family) {
.queueFlags = VK_QUEUE_TRANSFER_BIT,
.queueCount = blit_count,
.engine_class = I915_ENGINE_CLASS_COPY,
};
}
/* Increase count below when other families are added as a reminder to
* increase the ANV_MAX_QUEUE_FAMILIES value.
*/
......
......@@ -378,6 +378,21 @@ blorp_exec_on_compute(struct blorp_batch *batch,
cmd_buffer->state.push_constants_dirty |= VK_SHADER_STAGE_COMPUTE_BIT;
}
static void
blorp_exec_on_blitter(struct blorp_batch *batch,
const struct blorp_params *params)
{
assert(batch->flags & BLORP_BATCH_USE_BLITTER);
struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
assert(cmd_buffer->queue_family->queueFlags & VK_QUEUE_TRANSFER_BIT);
/* Apply any outstanding flushes. */
genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer);
blorp_exec(batch, params);
}
void
genX(blorp_exec)(struct blorp_batch *batch,
const struct blorp_params *params)
......@@ -403,7 +418,9 @@ genX(blorp_exec)(struct blorp_batch *batch,
}
#endif
if (batch->flags & BLORP_BATCH_USE_COMPUTE)
if (batch->flags & BLORP_BATCH_USE_BLITTER)
blorp_exec_on_blitter(batch, params);
else if (batch->flags & BLORP_BATCH_USE_COMPUTE)
blorp_exec_on_compute(batch, params);
else
blorp_exec_on_render(batch, params);
......
......@@ -97,6 +97,12 @@ is_render_queue_cmd_buffer(const struct anv_cmd_buffer *cmd_buffer)
return (queue_family->queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0;
}
static bool
is_blitter_queue_cmd_buffer(const struct anv_cmd_buffer *cmd_buffer)
{
return cmd_buffer->queue_family->engine_class == I915_ENGINE_CLASS_COPY;
}
void
genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer)
{
......@@ -1648,6 +1654,9 @@ genX(BeginCommandBuffer)(
trace_intel_begin_cmd_buffer(&cmd_buffer->trace);
if (is_blitter_queue_cmd_buffer(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
......@@ -1823,7 +1832,8 @@ genX(EndCommandBuffer)(
genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer);
emit_isp_disable(cmd_buffer);
if (!is_blitter_queue_cmd_buffer(cmd_buffer))
emit_isp_disable(cmd_buffer);
trace_intel_end_cmd_buffer(&cmd_buffer->trace, cmd_buffer->vk.level);
......@@ -2341,6 +2351,9 @@ genX(cmd_buffer_apply_pipe_flushes)(struct anv_cmd_buffer *cmd_buffer)
else if (bits == 0)
return;
if (is_blitter_queue_cmd_buffer(cmd_buffer))
return;
bool trace_flush =
(bits & (ANV_PIPE_FLUSH_BITS | ANV_PIPE_STALL_BITS | ANV_PIPE_INVALIDATE_BITS)) != 0;
if (trace_flush)
......
......@@ -460,6 +460,8 @@ genX(init_device_state)(struct anv_device *device)
case I915_ENGINE_CLASS_COMPUTE:
res = init_compute_queue_state(queue);
break;
case I915_ENGINE_CLASS_COPY:
break;
default:
res = vk_error(device, VK_ERROR_INITIALIZATION_FAILED);
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment