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

Christian Gmeiner christian.gmeiner at gmail.com
Wed Nov 15 22:14:43 UTC 2017


2017-11-14 10:21 GMT+01:00 Wladimir J. van der Laan <laanwj at gmail.com>:
> 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: Christian Gmeiner <christian.gmeiner at gmail.com>

> ---
>  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? */
> --
> 2.7.4
>



-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info


More information about the etnaviv mailing list