summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_resource.c
diff options
context:
space:
mode:
authorLucas Stach <[email protected]>2019-03-27 12:22:57 +0100
committerLucas Stach <[email protected]>2019-04-03 12:54:09 +0200
commitf317ee1aff4365df5b8d183565eeee535ebc6576 (patch)
treed96d881803ffa39bd9c00b7dc2c251e24aca0bf7 /src/gallium/drivers/etnaviv/etnaviv_resource.c
parentc7cddc278767ef5acfd7bba35c66ebebef3b3396 (diff)
etnaviv: don't flush own context when updating resource use
The context is self synchronizing at the GPU side, as commands are executed in order. We must not flush our own context when updating the resource use, as that leads to excessive flushing on effectively every draw call, causing huge CPU overhead. Fixes: 64813541d575 (etnaviv: fix resource usage tracking across different pipe_context's) Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_resource.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index ab40414fbe2..c7eedab7418 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -666,9 +666,18 @@ etna_resource_used(struct etna_context *ctx, struct pipe_resource *prsc,
struct etna_context *extctx = (struct etna_context *)entry->key;
struct pipe_context *pctx = &extctx->base;
+ if (extctx == ctx)
+ continue;
+
pctx->flush(pctx, NULL, 0);
+ /* It's safe to clear the status here. If we need to flush it means
+ * either another context had the resource in exclusive (write) use,
+ * or we transition the resource to exclusive use in our context.
+ * In both cases the new status accurately reflects the resource use
+ * after the flush.
+ */
+ rsc->status = 0;
}
- rsc->status = 0;
}
rsc->status |= status;