diff options
author | Samuel Pitoiset <[email protected]> | 2018-09-13 12:30:21 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-09-14 10:59:52 +0200 |
commit | c79aad30ae1f89dfb392f7cbe0f971939629c520 (patch) | |
tree | 9c86a2a8d139a66cbd4b8ad98a055aa09c55f364 /src/amd/vulkan/radv_device.c | |
parent | 9de062ef207c6062d1fabb70209f4bbc9dc4732d (diff) |
radv: emit the initial config only once in the preambles
It shouldn't be needed to emit the initial graphics or compute
state when beginning a new command buffer. Emitting them in
the preamble should be enough and this will reduce IB sizes.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_device.c')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 7917ed7ffe5..8989ec3553f 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -2090,6 +2090,33 @@ radv_emit_global_shader_pointers(struct radv_queue *queue, } } +static void +radv_init_graphics_state(struct radeon_cmdbuf *cs, struct radv_queue *queue) +{ + struct radv_device *device = queue->device; + + if (device->gfx_init) { + uint64_t va = radv_buffer_get_va(device->gfx_init); + + radeon_emit(cs, PKT3(PKT3_INDIRECT_BUFFER_CIK, 2, 0)); + radeon_emit(cs, va); + radeon_emit(cs, va >> 32); + radeon_emit(cs, device->gfx_init_size_dw & 0xffff); + + radv_cs_add_buffer(device->ws, cs, device->gfx_init); + } else { + struct radv_physical_device *physical_device = device->physical_device; + si_emit_graphics(physical_device, cs); + } +} + +static void +radv_init_compute_state(struct radeon_cmdbuf *cs, struct radv_queue *queue) +{ + struct radv_physical_device *physical_device = queue->device->physical_device; + si_emit_compute(physical_device, cs); +} + static VkResult radv_get_preamble_cs(struct radv_queue *queue, uint32_t scratch_size, @@ -2244,6 +2271,18 @@ radv_get_preamble_cs(struct radv_queue *queue, if (scratch_bo) radv_cs_add_buffer(queue->device->ws, cs, scratch_bo); + /* Emit initial configuration. */ + switch (queue->queue_family_index) { + case RADV_QUEUE_GENERAL: + radv_init_graphics_state(cs, queue); + break; + case RADV_QUEUE_COMPUTE: + radv_init_compute_state(cs, queue); + break; + case RADV_QUEUE_TRANSFER: + break; + } + if (descriptor_bo != queue->descriptor_bo) { uint32_t *map = (uint32_t*)queue->device->ws->buffer_map(descriptor_bo); |