[Mesa-dev] [PATCH v2 2/5] etnaviv: Check that resource has a valid TS in etna_resource_needs_flush

Lucas Stach l.stach at pengutronix.de
Wed Nov 15 15:50:11 UTC 2017


Am Dienstag, den 14.11.2017, 10:21 +0100 schrieb Wladimir J. van der
Laan:
> Resources only need a resolve-to-itself if their TS is valid for any
> level, not just if it happens to be allocated.
> 
> Signed-off-by: Wladimir J. van der Laan <laanwj at gmail.com>

Reviewed-by: Lucas Stach <l.stach at pengutronix.de>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 13 +++++++++++++
>  src/gallium/drivers/etnaviv/etnaviv_resource.h |  6 +++++-
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 0a82807..1fb73c4 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -629,6 +629,19 @@ etna_resource_used(struct etna_context *ctx,
> struct pipe_resource *prsc,
>     rsc->pending_ctx = ctx;
>  }
>  
> +bool
> +etna_resource_has_valid_ts(struct etna_resource *rsc)
> +{
> +   if (!rsc->ts_bo)
> +      return false;
> +
> +   for (int level = 0; level <= rsc->base.last_level; level++)
> +      if (rsc->levels[level].ts_valid)
> +         return true;
> +
> +   return false;
> +}
> +
>  void
>  etna_resource_screen_init(struct pipe_screen *pscreen)
>  {
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h
> b/src/gallium/drivers/etnaviv/etnaviv_resource.h
> index 0b135e2..11ccf8f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h
> @@ -103,11 +103,15 @@ etna_resource_older(struct etna_resource *a,
> struct etna_resource *b)
>     return (int)(a->seqno - b->seqno) < 0;
>  }
>  
> +/* returns TRUE if a resource has a TS, and it is valid for at least
> one level */
> +bool
> +etna_resource_has_valid_ts(struct etna_resource *res);
> +
>  /* returns TRUE if the resource needs a resolve to itself */
>  static inline bool
>  etna_resource_needs_flush(struct etna_resource *res)
>  {
> -   return res->ts_bo && ((int)(res->seqno - res->flush_seqno) > 0);
> +   return etna_resource_has_valid_ts(res) && ((int)(res->seqno -
> res->flush_seqno) > 0);
>  }
>  
>  /* is the resource only used on the sampler? */


More information about the mesa-dev mailing list