[Mesa-dev] [PATCH] radv/winsys: fix padding command stream for SI
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Wed Jul 26 07:25:57 UTC 2017
On Wed, Jul 26, 2017 at 4:29 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> We were adding pad to size after creating the object, so we could
> submit a CS bigger than the bo created for it.
So while this is indeed pedantically more correct, I wonder what would
trigger it, since bo size is always a 4096 multiple, and the padding
shouldn't cross between 32 byte blocks.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
> index 0d89b95..ad4b0b3 100644
> --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
> +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
> @@ -841,7 +841,7 @@ static int radv_amdgpu_winsys_cs_submit_sysmem(struct radeon_winsys_ctx *_ctx,
> uint32_t *ptr;
> unsigned cnt = 0;
> unsigned size = 0;
> -
> + unsigned pad_words = 0;
> if (preamble_cs)
> size += preamble_cs->cdw;
>
> @@ -850,6 +850,10 @@ static int radv_amdgpu_winsys_cs_submit_sysmem(struct radeon_winsys_ctx *_ctx,
> ++cnt;
> }
>
> + while(!size || (size & 7)) {
> + size++;
> + pad_words++;
> + }
> assert(cnt);
>
> bo = ws->buffer_create(ws, 4 * size, 4096, RADEON_DOMAIN_GTT, RADEON_FLAG_CPU_ACCESS);
> @@ -867,10 +871,8 @@ static int radv_amdgpu_winsys_cs_submit_sysmem(struct radeon_winsys_ctx *_ctx,
>
> }
>
> - while(!size || (size & 7)) {
> + for (unsigned j = 0; j < pad_words; ++j)
> *ptr++ = pad_word;
> - ++size;
> - }
>
> memset(&request, 0, sizeof(request));
>
> --
> 2.9.4
>
> _______________________________________________
> 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