summaryrefslogtreecommitdiff
path: root/src/amd/vulkan/radv_meta_buffer.c
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2020-10-06 03:23:06 +0200
committerMarge Bot <eric+marge@anholt.net>2021-01-13 16:27:19 +0000
commit8f8d72af555c2f4d7a44107bf52602571fc0c4d2 (patch)
tree5b1ea441e7dd15287f6684b9b3fff15fe0794387 /src/amd/vulkan/radv_meta_buffer.c
parentdba0a523a0aaef5937772472bf1b43c7c27df563 (diff)
radv: Use access helpers for flushing with meta operations.
This way we're properly using the vulkan barrier paradigm instead of adhoc guessing what caches need to be flushed. This is more robust for cache policy changes as we now don't have to revisit all the meta operations all the time. Note that a barrier has both a src and dst part though. So barrier: flush src meta op flush dst becomes barrier: flush barrier src flush meta op dst meta op flush meta op src flush barrier dst And there are some places where we've been able to replace a CB flush with a shader flush because that is what we'd need according to vulkan rules (and it turns out that in the cases the CB flush mattered the app will set the bit in one of the relevant flushes or it was needed as a result of an optimization that we counter-acted in the previous patch.) Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7202>
Diffstat (limited to 'src/amd/vulkan/radv_meta_buffer.c')
-rw-r--r--src/amd/vulkan/radv_meta_buffer.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/amd/vulkan/radv_meta_buffer.c b/src/amd/vulkan/radv_meta_buffer.c
index ba1a2e8d2b8..a08b6e408c5 100644
--- a/src/amd/vulkan/radv_meta_buffer.c
+++ b/src/amd/vulkan/radv_meta_buffer.c
@@ -351,10 +351,10 @@ static void copy_buffer_shader(struct radv_cmd_buffer *cmd_buffer,
radv_meta_restore(&saved_state, cmd_buffer);
}
-
uint32_t radv_fill_buffer(struct radv_cmd_buffer *cmd_buffer,
- struct radeon_winsys_bo *bo,
- uint64_t offset, uint64_t size, uint32_t value)
+ const struct radv_image *image,
+ struct radeon_winsys_bo *bo,
+ uint64_t offset, uint64_t size, uint32_t value)
{
uint32_t flush_bits = 0;
@@ -362,10 +362,13 @@ uint32_t radv_fill_buffer(struct radv_cmd_buffer *cmd_buffer,
assert(!(size & 3));
if (size >= RADV_BUFFER_OPS_CS_THRESHOLD) {
+ cmd_buffer->state.flush_bits |=
+ radv_dst_access_flush(cmd_buffer, VK_ACCESS_SHADER_WRITE_BIT, image);
+
fill_buffer_shader(cmd_buffer, bo, offset, size, value);
+
flush_bits = RADV_CMD_FLAG_CS_PARTIAL_FLUSH |
- RADV_CMD_FLAG_INV_VCACHE |
- RADV_CMD_FLAG_WB_L2;
+ radv_src_access_flush(cmd_buffer, VK_ACCESS_SHADER_WRITE_BIT, image);
} else if (size) {
uint64_t va = radv_buffer_get_va(bo);
va += offset;
@@ -412,7 +415,7 @@ void radv_CmdFillBuffer(
if (fillSize == VK_WHOLE_SIZE)
fillSize = (dst_buffer->size - dstOffset) & ~3ull;
- radv_fill_buffer(cmd_buffer, dst_buffer->bo, dst_buffer->offset + dstOffset,
+ radv_fill_buffer(cmd_buffer, NULL, dst_buffer->bo, dst_buffer->offset + dstOffset,
fillSize, data);
}