Mesa (master): svga: Avoid synchronizing when doing piecewise upload of textures.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Mar 21 18:47:35 UTC 2011


Module: Mesa
Branch: master
Commit: b881ea87f1d59482420047e6d7454c78dd4f0e89
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b881ea87f1d59482420047e6d7454c78dd4f0e89

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Mar 21 17:28:21 2011 +0000

svga: Avoid synchronizing when doing piecewise upload of textures.

---

 src/gallium/drivers/svga/svga_resource_texture.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index b61f859..f9eb494 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -231,18 +231,19 @@ svga_transfer_dma(struct svga_context *svga,
 
          sw = (uint8_t *)st->swbuf + offset;
 
-         if(transfer == SVGA3D_WRITE_HOST_VRAM) {
+         if (transfer == SVGA3D_WRITE_HOST_VRAM) {
+            unsigned usage = PIPE_TRANSFER_WRITE;
+
             /* Wait for the previous DMAs to complete */
             /* TODO: keep one DMA (at half the size) in the background */
-            if(y) {
-               svga_context_flush(svga, &fence);
-               sws->fence_finish(sws, fence, 0);
-               sws->fence_reference(sws, &fence, NULL);
+            if (y) {
+               svga_context_flush(svga, NULL);
+               usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
             }
 
-            hw = sws->buffer_map(sws, st->hwbuf, PIPE_TRANSFER_WRITE);
+            hw = sws->buffer_map(sws, st->hwbuf, usage);
             assert(hw);
-            if(hw) {
+            if (hw) {
                memcpy(hw, sw, length);
                sws->buffer_unmap(sws, st->hwbuf);
             }




More information about the mesa-commit mailing list