svga: Avoid synchronizing when doing piecewise upload of textures.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 21 Mar 2011 17:28:21 +0000 (17:28 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 21 Mar 2011 18:47:24 +0000 (18:47 +0000)
src/gallium/drivers/svga/svga_resource_texture.c

index b61f85955a2424d766f71907cd49298f51d7a7cc..f9eb4949b2c1459ecb1a71be58c4baf093726d80 100644 (file)
@@ -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);
             }