diff options
author | Wladimir J. van der Laan <[email protected]> | 2017-11-14 10:21:20 +0100 |
---|---|---|
committer | Christian Gmeiner <[email protected]> | 2017-11-15 23:27:09 +0100 |
commit | ade528edd1c48475684b68831dae6afdc27da867 (patch) | |
tree | cc5ccd1be51a72cd2faa2ebec399d594e5562779 /src/gallium | |
parent | b24cb40188997aa4920812d5d52e14e64dab64d6 (diff) |
etnaviv: Check that resource has a valid TS in etna_resource_needs_flush
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 <[email protected]>
Reviewed-by: Lucas Stach <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_resource.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_resource.h | 6 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c index 0a82807b401..1fb73c49394 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 0b135e2373b..11ccf8f7bcb 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? */ |