[Mesa-dev] [PATCH 08/11] freedreno: a2xx: split large draws on a20x

Ilia Mirkin imirkin at alum.mit.edu
Mon Oct 8 04:13:45 UTC 2018


See my feedback from your earlier submission for how to make this work
on more than triangles. Seems easy enough to just do it.

https://patchwork.freedesktop.org/patch/250192/
On Mon, Oct 8, 2018 at 12:07 AM Jonathan Marek <jonathan at marek.ca> wrote:
>
> a20x can only draw 65535 vertices at once. this fix only applies to
> triangles.
>
> Signed-off-by: Jonathan Marek <jonathan at marek.ca>
> ---
>  src/gallium/drivers/freedreno/a2xx/fd2_draw.c | 30 +++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c
> index 1792505808..7ccbee587f 100644
> --- a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c
> +++ b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c
> @@ -171,8 +171,34 @@ fd2_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *pinfo,
>         fd2_emit_state(ctx, ctx->batch->draw, ctx->dirty);
>         fd2_emit_state(ctx, ctx->batch->binning, ctx->dirty);
>
> -       draw_impl(ctx, pinfo, ctx->batch->draw, index_offset, false);
> -       draw_impl(ctx, pinfo, ctx->batch->binning, index_offset, true);
> +       /* a20x can only draw 65535 vertices at once... */
> +       if (is_a20x(ctx->screen) && pinfo->count > 0xffff) {
> +               struct pipe_draw_info info = *pinfo;
> +               unsigned count = info.count;
> +               unsigned num_vertices = ctx->batch->num_vertices;
> +
> +               /* other primitives require more work
> +                * (triangles works because 0xffff is divible by 3)
> +                */
> +               if (info.mode != PIPE_PRIM_TRIANGLES)
> +                       return false;
> +
> +               for (; count; ) {
> +                       info.count = MIN2(count, 0xffff);
> +
> +                       draw_impl(ctx, &info, ctx->batch->draw, index_offset, false);
> +                       draw_impl(ctx, &info, ctx->batch->binning, index_offset, true);
> +
> +                       info.start += 0xffff;
> +                       ctx->batch->num_vertices += 0xffff;
> +                       count -= info.count;
> +               }
> +               /* changing this value is a hack, restore it */
> +               ctx->batch->num_vertices = num_vertices;
> +       } else {
> +               draw_impl(ctx, pinfo, ctx->batch->draw, index_offset, false);
> +               draw_impl(ctx, pinfo, ctx->batch->binning, index_offset, true);
> +       }
>
>         fd_context_all_clean(ctx);
>
> --
> 2.17.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