summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c13
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.h6
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? */