[Mesa-dev] [PATCH 1/2] panfrost: Track BO lifetime with jobs and reference counts

Boris Brezillon boris.brezillon at collabora.com
Tue Apr 16 07:31:46 UTC 2019


On Tue, 16 Apr 2019 01:49:21 +0000
Alyssa Rosenzweig <alyssa at rosenzweig.io> wrote:

> @@ -1793,22 +1799,9 @@ panfrost_set_vertex_buffers(
>          const struct pipe_vertex_buffer *buffers)
>  {
>          struct panfrost_context *ctx = pan_context(pctx);
> -        assert(num_buffers <= PIPE_MAX_ATTRIBS);
> -
> -        /* XXX: Dirty tracking? etc */
> -        if (buffers) {
> -                size_t sz = sizeof(buffers[0]) * num_buffers;
> -                ctx->vertex_buffers = malloc(sz);
> -                ctx->vertex_buffer_count = num_buffers;
> -                memcpy(ctx->vertex_buffers, buffers, sz);
> -        } else {
> -                if (ctx->vertex_buffers) {
> -                        free(ctx->vertex_buffers);
> -                        ctx->vertex_buffers = NULL;
> -                }
>  
> -                ctx->vertex_buffer_count = 0;
> -        }
> +        util_set_vertex_buffers_mask(ctx->vertex_buffers, &ctx->vb_mask, buffers, start_slot, num_buffers);
> +        ctx->vertex_buffer_count = num_buffers;

->vertex_buffer_count should be set to fls(ctx->vb_mask) (fls == find
last bit set) if you want the

	for (int i = 0; i < ctx->vertex_buffer_count; ++i)

loop in panfrost_emit_vertex_data() to do the right thing. But I think
we can get rid of ->vertex_buffer_count entirely and just do a

	for (int i = 0; i < ARRAY_SIZE(ctx->vertex_buffers); ++i)

>  }


More information about the mesa-dev mailing list