From 33b452aae72a185c877d6f9cd806d8ffa20d13e2 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 21 Feb 2020 17:36:36 +0200 Subject: [PATCH] anv: store the workaround address This will allow to select a different address later, leaving the beginning of the buffer to some other use. Signed-off-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_device.c | 4 ++++ src/intel/vulkan/anv_private.h | 12 +++++++----- src/intel/vulkan/genX_blorp_exec.c | 3 ++- src/intel/vulkan/genX_cmd_buffer.c | 9 +++------ src/intel/vulkan/genX_pipeline.c | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 5b4c952a338..ec30e2d0251 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -2932,6 +2932,10 @@ VkResult anv_CreateDevice( if (result != VK_SUCCESS) goto fail_surface_aux_map_pool; + device->workaround_address = (struct anv_address) { + .bo = device->workaround_bo, + }; + result = anv_device_init_trivial_batch(device); if (result != VK_SUCCESS) goto fail_workaround_bo; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index fa44307457b..7e9270d62f3 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1297,6 +1297,11 @@ anv_device_upload_nir(struct anv_device *device, const struct nir_shader *nir, unsigned char sha1_key[20]); +struct anv_address { + struct anv_bo *bo; + uint32_t offset; +}; + struct anv_device { struct vk_device vk; @@ -1340,6 +1345,8 @@ struct anv_device { * For that, we use the high bytes (>= 1024) of the workaround BO. */ struct anv_bo * workaround_bo; + struct anv_address workaround_address; + struct anv_bo * trivial_batch_bo; struct anv_bo * hiz_clear_bo; struct anv_state null_surface_state; @@ -1602,11 +1609,6 @@ struct anv_batch_bo { struct anv_reloc_list relocs; }; -struct anv_address { - struct anv_bo *bo; - uint32_t offset; -}; - struct anv_batch { const VkAllocationCallbacks * alloc; diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index 56a3c8868eb..15ecf7805af 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -184,7 +184,8 @@ blorp_get_workaround_address(struct blorp_batch *batch) struct anv_cmd_buffer *cmd_buffer = batch->driver_batch; return (struct blorp_address) { - .buffer = cmd_buffer->device->workaround_bo, + .buffer = cmd_buffer->device->workaround_address.bo, + .offset = cmd_buffer->device->workaround_address.offset, }; } diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index e1389699750..9c67e6796db 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2251,8 +2251,7 @@ genX(cmd_buffer_apply_pipe_flushes)(struct anv_cmd_buffer *cmd_buffer) */ if (GEN_GEN == 9 && pipe.VFCacheInvalidationEnable) { pipe.PostSyncOperation = WriteImmediateData; - pipe.Address = - (struct anv_address) { cmd_buffer->device->workaround_bo, 0 }; + pipe.Address = cmd_buffer->device->workaround_address; } } @@ -3404,8 +3403,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.DepthStallEnable = true; pc.PostSyncOperation = WriteImmediateData; - pc.Address = - (struct anv_address) { cmd_buffer->device->workaround_bo, 0 }; + pc.Address = cmd_buffer->device->workaround_address; } } #endif @@ -4950,8 +4948,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer) */ anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.PostSyncOperation = WriteImmediateData; - pc.Address = - (struct anv_address) { cmd_buffer->device->workaround_bo, 0 }; + pc.Address = cmd_buffer->device->workaround_address; } } cmd_buffer->state.hiz_enabled = isl_aux_usage_has_hiz(info.hiz_usage); diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index e17ba6750d4..43078ce2b84 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -290,7 +290,7 @@ genX(emit_urb_setup)(struct anv_device *device, struct anv_batch *batch, anv_batch_emit(batch, GEN7_PIPE_CONTROL, pc) { pc.DepthStallEnable = true; pc.PostSyncOperation = WriteImmediateData; - pc.Address = (struct anv_address) { device->workaround_bo, 0 }; + pc.Address = device->workaround_address; } #endif -- 2.30.2