[Mesa-dev] [PATCH 6/6] radv: make shader BOs read-only for the GPU

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Jan 8 10:27:11 UTC 2018


Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

for the series.

On Thu, Jan 4, 2018 at 6:39 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_device.c  | 2 ++
>  src/amd/vulkan/radv_private.h | 1 +
>  src/amd/vulkan/radv_shader.c  | 5 ++++-
>  3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 5f78af624b..528d3539c9 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -263,6 +263,8 @@ radv_physical_device_init(struct radv_physical_device *device,
>          */
>         device->has_clear_state = device->rad_info.chip_class >= CIK;
>
> +       device->cpdma_prefetch_writes_memory = device->rad_info.chip_class <= VI;
> +
>         radv_physical_device_init_mem_types(device);
>
>         result = radv_init_wsi(device);
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index bae353c0e5..6a19394ad5 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -272,6 +272,7 @@ struct radv_physical_device {
>         bool has_rbplus; /* if RB+ register exist */
>         bool rbplus_allowed; /* if RB+ is allowed */
>         bool has_clear_state;
> +       bool cpdma_prefetch_writes_memory;
>
>         /* This is the drivers on-disk cache used as a fallback as opposed to
>          * the pipeline cache defined by apps.
> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
> index ab8ba42511..74f2384a64 100644
> --- a/src/amd/vulkan/radv_shader.c
> +++ b/src/amd/vulkan/radv_shader.c
> @@ -330,7 +330,10 @@ radv_alloc_shader_memory(struct radv_device *device,
>
>         slab->size = 256 * 1024;
>         slab->bo = device->ws->buffer_create(device->ws, slab->size, 256,
> -                                            RADEON_DOMAIN_VRAM, RADEON_FLAG_NO_INTERPROCESS_SHARING);
> +                                            RADEON_DOMAIN_VRAM,
> +                                            RADEON_FLAG_NO_INTERPROCESS_SHARING |
> +                                            device->physical_device->cpdma_prefetch_writes_memory ?
> +                                                    0 : RADEON_FLAG_READ_ONLY);
>         slab->ptr = (char*)device->ws->buffer_map(slab->bo);
>         list_inithead(&slab->shaders);
>
> --
> 2.15.1
>
> _______________________________________________
> 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