mirror of
https://github.com/elwrcl/intel-hard-graphics.git
synced 2026-10-31 10:58:03 +03:00
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:
1 parent
2766ca3284
commit
203bf6b58d
4 files changed
+33
-17
No files matched your search
@@ -2256,7 +2256,7 @@ anv_queue_exec_locked(struct anv_queue *queue,
|
||||
uint64_t pass_batch_offset =
|
||||
khr_perf_query_preamble_offset(perf_query_pool, perf_query_pass);
|
||||
|
||||
intel_print_batch(&device->decoder_ctx,
|
||||
intel_print_batch(queue->decoder,
|
||||
pass_batch_bo->map + pass_batch_offset, 64,
|
||||
pass_batch_bo->offset + pass_batch_offset, false);
|
||||
}
|
||||
@@ -2265,12 +2265,12 @@ anv_queue_exec_locked(struct anv_queue *queue,
|
||||
struct anv_batch_bo **bo =
|
||||
u_vector_tail(&cmd_buffers[i]->seen_bbos);
|
||||
device->cmd_buffer_being_decoded = cmd_buffers[i];
|
||||
intel_print_batch(&device->decoder_ctx, (*bo)->bo->map,
|
||||
intel_print_batch(queue->decoder, (*bo)->bo->map,
|
||||
(*bo)->bo->size, (*bo)->bo->offset, false);
|
||||
device->cmd_buffer_being_decoded = NULL;
|
||||
}
|
||||
} else {
|
||||
intel_print_batch(&device->decoder_ctx,
|
||||
intel_print_batch(queue->decoder,
|
||||
device->trivial_batch_bo->map,
|
||||
device->trivial_batch_bo->size,
|
||||
device->trivial_batch_bo->offset, false);
|
||||
@@ -2502,7 +2502,7 @@ anv_queue_submit_simple_batch(struct anv_queue *queue,
|
||||
goto fail;
|
||||
|
||||
if (INTEL_DEBUG(DEBUG_BATCH)) {
|
||||
intel_print_batch(&device->decoder_ctx,
|
||||
intel_print_batch(queue->decoder,
|
||||
batch_bo->map,
|
||||
batch_bo->size,
|
||||
batch_bo->offset, false);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -949,6 +949,8 @@ struct anv_queue {
|
||||
|
||||
const struct anv_queue_family * family;
|
||||
|
||||
struct intel_batch_decode_ctx * decoder;
|
||||
|
||||
uint32_t exec_flags;
|
||||
|
||||
/** Synchronization object for debug purposes (DEBUG_SYNC) */
|
||||
@@ -1067,7 +1069,7 @@ struct anv_device {
|
||||
|
||||
pthread_mutex_t mutex;
|
||||
|
||||
struct intel_batch_decode_ctx decoder_ctx;
|
||||
struct intel_batch_decode_ctx decoder[ANV_MAX_QUEUE_FAMILIES];
|
||||
/*
|
||||
* When decoding a anv_cmd_buffer, we might need to search for BOs through
|
||||
* the cmd_buffer's list.
|
||||
|
||||
@@ -59,6 +59,8 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue,
|
||||
queue->family = &pdevice->queue.families[queue->vk.queue_family_index];
|
||||
queue->exec_flags = exec_flags;
|
||||
|
||||
queue->decoder = &device->decoder[queue->vk.queue_family_index];
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user