[Mesa-dev] [PATCH] radeonsi: Track pipe_vertex_buffers for relocs.
Marek Olšák
maraeo at gmail.com
Sun May 20 14:42:51 UTC 2018
Can you explain what the difference is between the old and new code?
Marek
On Sat, May 19, 2018 at 4:30 AM, <Mathias.Froehlich at gmx.net> wrote:
> From: Mathias Fröhlich <mathias.froehlich at web.de>
>
> Hi,
>
> Below a patch to radeonsi to get a small bit more out of the recent
> VAO changes.
> The change did not introduce regressions into piglit and some variant
> of deqp availble through piglit on a radeonsi system.
> Please review!
>
> best Mathias
>
>
> Instead of tracking which pipe_vertex_elements backing buffer objects
> have already been uploaded, do this for the pipe_vertex_buffers, which
> is the data structure that contains the buffer objects.
> That should slightly decrease some unnecessary load on calls to
> radeon_add_to_buffer_list.
>
> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
> ---
> src/gallium/drivers/radeonsi/si_descriptors.c | 4 +++-
> src/gallium/drivers/radeonsi/si_state.c | 11 ++++++-----
> 2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c
> b/src/gallium/drivers/radeonsi/si_descriptors.c
> index 1d14c9df1e..3e3a3a2164 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -1161,7 +1161,9 @@ bool si_upload_vertex_buffer_descriptors(struct
> si_context *sctx)
> desc[2] = num_records;
> desc[3] = velems->rsrc_word3[i];
>
> - if (first_vb_use_mask & (1 << i)) {
> + const unsigned vbo_bit = 1u << vbo_index;
> + if (first_vb_use_mask & vbo_bit) {
> + first_vb_use_mask ^= vbo_bit;
> radeon_add_to_buffer_list(sctx, sctx->gfx_cs,
> r600_resource(vb->buffer.
> resource),
> RADEON_USAGE_READ,
> RADEON_PRIO_VERTEX_BUFFER);
> diff --git a/src/gallium/drivers/radeonsi/si_state.c
> b/src/gallium/drivers/radeonsi/si_state.c
> index 675b1adbe6..4306cf42bf 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -4323,10 +4323,11 @@ static void *si_create_vertex_elements(struct
> pipe_context *ctx,
> {
> struct si_screen *sscreen = (struct si_screen*)ctx->screen;
> struct si_vertex_elements *v = CALLOC_STRUCT(si_vertex_elements);
> - bool used[SI_NUM_VERTEX_BUFFERS] = {};
> + unsigned first_vb_use_mask = 0;
> int i;
>
> assert(count <= SI_MAX_ATTRIBS);
> + assert(SI_NUM_VERTEX_BUFFERS <= sizeof(unsigned)*CHAR_BIT);
> if (!v)
> return NULL;
>
> @@ -4356,10 +4357,7 @@ static void *si_create_vertex_elements(struct
> pipe_context *ctx,
> v->instance_divisor_is_fetched |= 1u << i;
> }
>
> - if (!used[vbo_index]) {
> - v->first_vb_use_mask |= 1 << i;
> - used[vbo_index] = true;
> - }
> + first_vb_use_mask |= (1u << vbo_index);
>
> desc = util_format_description(elements[i].src_format);
> first_non_void = util_format_get_first_non_
> void_channel(elements[i].src_format);
> @@ -4463,6 +4461,9 @@ static void *si_create_vertex_elements(struct
> pipe_context *ctx,
> S_008F0C_NUM_FORMAT(num_format) |
> S_008F0C_DATA_FORMAT(data_format);
> }
> +
> + v->first_vb_use_mask = first_vb_use_mask;
> +
> return v;
> }
>
> --
> 2.14.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180520/3cf75dd2/attachment.html>
More information about the mesa-dev
mailing list