etnaviv: don't read back resource if transfer discards contents
authorLucas Stach <l.stach@pengutronix.de>
Thu, 18 May 2017 14:30:02 +0000 (16:30 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Thu, 8 Jun 2017 16:29:36 +0000 (18:29 +0200)
Reduces bandwidth usage of transfers which discard the buffer contents,
as well as skipping unnecessary command stream flushes and CPU/GPU
synchronization.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_transfer.c

index 4ead6dff7f4cb97a4e8f5955205b8193ab4407ca..707029865a52312e0c6d2b6eee6aae6fc616b8e8 100644 (file)
@@ -197,7 +197,9 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
          return NULL;
       }
 
-      etna_copy_resource(pctx, trans->rsc, prsc, level, trans->rsc->last_level);
+      if (!(usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE))
+         etna_copy_resource(pctx, trans->rsc, prsc, level,
+                            trans->rsc->last_level);
 
       /* Switch to using the temporary resource instead */
       rsc = etna_resource(trans->rsc);