hasvk: Make a batch decoder for each queue family

The decoder context needs to know what engine it's associated with.
Nowadays, we have render, compute, blitter, even video engines being
used from the same driver.  Rather than trying to have a single decoder
and thwacking the engine field back and forth between calls, we make
one per queue family, and stash a pointer in anv_queue for easy access.

(Ported from anv: 79caf8a44b682f731c0fd3b941f38cc1869efe2d)

[dancingmirrors: Adapted for elk.]
This commit is contained in:
Kenneth Graunke authored and elwrcl committed 2026-07-21 14:54:59 +03:00
1 parent 2766ca3284
commit 203bf6b58d
4 files changed
+33 -17

No files matched your search

+24 -12
View File
@@ -2488,18 +2488,26 @@ VkResult anv_CreateDevice(
goto fail_alloc;
if (INTEL_DEBUG(DEBUG_BATCH)) {
const unsigned decode_flags = INTEL_BATCH_DECODE_DEFAULT_FLAGS;
for (unsigned i = 0; i < physical_device->queue.family_count; i++) {
struct intel_batch_decode_ctx *decoder = &device->decoder[i];
intel_batch_decode_ctx_init_elk(&device->decoder_ctx,
&physical_device->compiler->isa,
&physical_device->info,
stderr, decode_flags, NULL,
decode_get_bo, NULL, device);
const unsigned decode_flags =
INTEL_BATCH_DECODE_FULL |
(INTEL_DEBUG(DEBUG_COLOR) ? INTEL_BATCH_DECODE_IN_COLOR : 0) |
INTEL_BATCH_DECODE_OFFSETS |
INTEL_BATCH_DECODE_FLOATS;
device->decoder_ctx.dynamic_base = DYNAMIC_STATE_POOL_MIN_ADDRESS;
device->decoder_ctx.surface_base = SURFACE_STATE_POOL_MIN_ADDRESS;
device->decoder_ctx.instruction_base =
INSTRUCTION_STATE_POOL_MIN_ADDRESS;
intel_batch_decode_ctx_init_elk(decoder,
&physical_device->compiler->isa,
&physical_device->info,
stderr, decode_flags, NULL,
decode_get_bo, NULL, device);
decoder->engine = physical_device->queue.families[i].engine_class;
decoder->dynamic_base = DYNAMIC_STATE_POOL_MIN_ADDRESS;
decoder->surface_base = SURFACE_STATE_POOL_MIN_ADDRESS;
decoder->instruction_base = INSTRUCTION_STATE_POOL_MIN_ADDRESS;
}
}
anv_device_set_physical(device, physical_device);
@@ -2788,6 +2796,8 @@ void anv_DestroyDevice(
if (!device)
return;
struct anv_physical_device *pdevice = device->physical;
anv_device_utrace_finish(device);
anv_device_finish_blorp(device);
@@ -2835,8 +2845,10 @@ void anv_DestroyDevice(
intel_gem_destroy_context(device->fd, device->context_id);
if (INTEL_DEBUG(DEBUG_BATCH))
intel_batch_decode_ctx_finish(&device->decoder_ctx);
if (INTEL_DEBUG(DEBUG_BATCH)) {
for (unsigned i = 0; i < pdevice->queue.family_count; i++)
intel_batch_decode_ctx_finish(&device->decoder[i]);
}
close(device->fd);