[Mesa-dev] [PATCH 2/2] radv/winsys: Fix radv_amdgpu_cs_grow min_size argument.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Oct 6 16:24:49 UTC 2016


On Thu, Oct 6, 2016 at 1:09 AM, Gustaw Smolarczyk <wielkiegie at gmail.com> wrote:
> It's supposed to be how much at least we want to grow the cs, not the
> minimum size of the cs after growth.
> ---
>  src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
> index dedc778..205b598 100644
> --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
> +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
> @@ -178,7 +178,8 @@ radv_amdgpu_cs_create(struct radeon_winsys *ws,
>  static void radv_amdgpu_cs_grow(struct radeon_winsys_cs *_cs, size_t min_size)
>  {
>         struct radv_amdgpu_cs *cs = radv_amdgpu_cs(_cs);
> -       uint64_t ib_size = MAX2(min_size * 4 + 16, cs->base.max_dw * 4 * 2);
> +       uint64_t ib_size = MAX2((cs->base.cdw + min_size) * 4 + 16,
> +                               cs->base.max_dw * 4 * 2);

The old code is correct when cs->ws->use_ib_bos is set, as we don't
resize the IB but allocate a new one and link, so cdw gets reset to 0.
In the other case there is indeed a bug though.
>
>         /* max that fits in the chain size field. */
>         ib_size = MIN2(ib_size, 0xfffff);
> --
> 2.10.0
>
> _______________________________________________
> 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