[PATCH v2 2/3] etnaviv: add resource subregion copy

Christian Gmeiner christian.gmeiner at gmail.com
Tue Oct 3 17:59:22 UTC 2017


2017-09-22 11:31 GMT+02:00 Lucas Stach <l.stach at pengutronix.de>:
> This is useful if we only need to copy part of a larger resource, mostly
> when using the RS engine to de-/tile on pipe transfers.
>
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> Reviewed-by: Wladimir J. van der Laan <laanwj at gmail.com>

Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 27 ++++++++++++++++++++++++
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.h |  5 +++++
>  2 files changed, 32 insertions(+)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index 8030450dd1b0..971403c45476 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -727,6 +727,33 @@ etna_copy_resource(struct pipe_context *pctx, struct pipe_resource *dst,
>  }
>
>  void
> +etna_copy_resource_box(struct pipe_context *pctx, struct pipe_resource *dst,
> +                       struct pipe_resource *src, int level,
> +                       struct pipe_box *box)
> +{
> +   assert(src->format == dst->format);
> +   assert(src->array_size == dst->array_size);
> +
> +   struct pipe_blit_info blit = {};
> +   blit.mask = util_format_get_mask(dst->format);
> +   blit.filter = PIPE_TEX_FILTER_NEAREST;
> +   blit.src.resource = src;
> +   blit.src.format = src->format;
> +   blit.src.box = *box;
> +   blit.dst.resource = dst;
> +   blit.dst.format = dst->format;
> +   blit.dst.box = *box;
> +
> +   blit.dst.box.depth = blit.src.box.depth = 1;
> +   blit.src.level = blit.dst.level = level;
> +
> +   for (int layer = 0; layer < dst->array_size; layer++) {
> +      blit.src.box.z = blit.dst.box.z = layer;
> +      pctx->blit(pctx, &blit);
> +   }
> +}
> +
> +void
>  etna_clear_blit_init(struct pipe_context *pctx)
>  {
>     pctx->clear = etna_clear;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h
> index 73d07044b2b3..9bba6236b4db 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h
> @@ -43,6 +43,11 @@ etna_copy_resource(struct pipe_context *pctx, struct pipe_resource *dst,
>                     struct pipe_resource *src, int first_level, int last_level);
>
>  void
> +etna_copy_resource_box(struct pipe_context *pctx, struct pipe_resource *dst,
> +                       struct pipe_resource *src, int level,
> +                       struct pipe_box *box);
> +
> +void
>  etna_clear_blit_init(struct pipe_context *pctx);
>
>  #endif
> --
> 2.11.0
>
> _______________________________________________
> etnaviv mailing list
> etnaviv at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv

greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info


More information about the etnaviv mailing list