summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLucas Stach <[email protected]>2017-05-18 17:05:02 +0200
committerLucas Stach <[email protected]>2017-06-08 18:29:36 +0200
commit0f888ad4be32d1c66e2749feacb8b88def03fac9 (patch)
tree1524444bc5cbbc9ceb16d0ce9215c6ec9d05cb50 /src
parentd4e6de9e385579d49cd5f51e643d0141c81b5604 (diff)
etnaviv: upgrade DISCARD_RANGE to DISCARD_WHOLE_RESOURCE if possible
Stolen from VC4. As we don't do any fancy reallocation tricks yet, it's possible to upgrade also coherent mappings and shared resources. Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Wladimir J. van der Laan <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_transfer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
index 8a18dbb8fc3..27e1be19579 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
@@ -157,6 +157,20 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
assert(level <= prsc->last_level);
+ /* Upgrade DISCARD_RANGE to WHOLE_RESOURCE if the whole resource is
+ * being mapped. If we add buffer reallocation to avoid CPU/GPU sync this
+ * check needs to be extended to coherent mappings and shared resources.
+ */
+ if ((usage & PIPE_TRANSFER_DISCARD_RANGE) &&
+ !(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&
+ prsc->last_level == 0 &&
+ prsc->width0 == box->width &&
+ prsc->height0 == box->height &&
+ prsc->depth0 == box->depth &&
+ prsc->array_size == 1) {
+ usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+ }
+
if (rsc->texture && !etna_resource_newer(rsc, etna_resource(rsc->texture))) {
/* We have a texture resource which is the same age or newer than the
* render resource. Use the texture resource, which avoids bouncing