summaryrefslogtreecommitdiff
path: root/src/amd/vulkan/radv_meta_buffer.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-10-25 08:05:11 +1000
committerDave Airlie <airlied@redhat.com>2017-10-25 10:01:13 +1000
commit3cd3035aceeafa212a95cf3784fa21a978bdd09f (patch)
treeeaf99fca7348a37e59a5b5f99b2a9f8716db4892 /src/amd/vulkan/radv_meta_buffer.c
parentb704538b00ee082ecb32e2bd2b0d610f791bcce0 (diff)
radv: use a define for the transition point between cp and compute shader
For certain buffer meta ops we can use the CP or a compute shader, we should use a define to rather than hardcoding 4096, allows for easier testing and more consistency. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/amd/vulkan/radv_meta_buffer.c')
-rw-r--r--src/amd/vulkan/radv_meta_buffer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/amd/vulkan/radv_meta_buffer.c b/src/amd/vulkan/radv_meta_buffer.c
index e009234f045..a737dbeec39 100644
--- a/src/amd/vulkan/radv_meta_buffer.c
+++ b/src/amd/vulkan/radv_meta_buffer.c
@@ -4,6 +4,12 @@
#include "sid.h"
#include "radv_cs.h"
+/*
+ * This is the point we switch from using CP to compute shader
+ * for certain buffer operations.
+ */
+#define RADV_BUFFER_OPS_CS_THRESHOLD 4096
+
static nir_shader *
build_buffer_fill_shader(struct radv_device *dev)
{
@@ -405,7 +411,7 @@ void radv_fill_buffer(struct radv_cmd_buffer *cmd_buffer,
assert(!(offset & 3));
assert(!(size & 3));
- if (size >= 4096)
+ if (size >= RADV_BUFFER_OPS_CS_THRESHOLD)
fill_buffer_shader(cmd_buffer, bo, offset, size, value);
else if (size) {
uint64_t va = radv_buffer_get_va(bo);
@@ -422,7 +428,7 @@ void radv_copy_buffer(struct radv_cmd_buffer *cmd_buffer,
uint64_t src_offset, uint64_t dst_offset,
uint64_t size)
{
- if (size >= 4096 && !(size & 3) && !(src_offset & 3) && !(dst_offset & 3))
+ if (size >= RADV_BUFFER_OPS_CS_THRESHOLD && !(size & 3) && !(src_offset & 3) && !(dst_offset & 3))
copy_buffer_shader(cmd_buffer, src_bo, dst_bo,
src_offset, dst_offset, size);
else if (size) {
@@ -496,7 +502,7 @@ void radv_CmdUpdateBuffer(
if (!dataSize)
return;
- if (dataSize < 4096) {
+ if (dataSize < RADV_BUFFER_OPS_CS_THRESHOLD) {
si_emit_cache_flush(cmd_buffer);
cmd_buffer->device->ws->cs_add_buffer(cmd_buffer->cs, dst_buffer->bo, 8);