[Mesa-dev] [PATCH] radv: use a define for the transition point between cp and compute shader

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Tue Oct 24 22:18:58 UTC 2017


r-b

On Wed, Oct 25, 2017 at 12:06 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> 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.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/amd/vulkan/radv_meta_buffer.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_meta_buffer.c b/src/amd/vulkan/radv_meta_buffer.c
> index e009234..a737dbe 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);
> --
> 2.9.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list