summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-02-10 20:53:55 +0000
committerJosé Fonseca <[email protected]>2011-02-10 20:55:10 +0000
commit05a16b8e1cf5f402636ae5f870ed0ae5e250735e (patch)
tree83ac694e540abbeaad416c348bbf88c852e07390 /src/gallium/auxiliary
parentd60f07489ef45fcdc46edbc51e662d2157a55cab (diff)
u_upload_mgr: Use PIPE_TRANSFER_FLUSH_EXPLICIT.
This can avoid DMAing the whole buffer when just a fraction was changed.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 865dab864b3..69b11f9bb77 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -85,6 +85,10 @@ void u_upload_flush( struct u_upload_mgr *upload )
{
/* Unmap and unreference the upload buffer. */
if (upload->transfer) {
+ if (upload->size) {
+ pipe_buffer_flush_mapped_range(upload->pipe, upload->transfer,
+ 0, upload->size);
+ }
pipe_transfer_unmap(upload->pipe, upload->transfer);
pipe_transfer_destroy(upload->pipe, upload->transfer);
upload->transfer = NULL;
@@ -122,8 +126,11 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
goto fail;
/* Map the new buffer. */
- upload->map = pipe_buffer_map(upload->pipe, upload->buffer,
- PIPE_TRANSFER_WRITE, &upload->transfer);
+ upload->map = pipe_buffer_map_range(upload->pipe, upload->buffer,
+ 0, size,
+ PIPE_TRANSFER_WRITE |
+ PIPE_TRANSFER_FLUSH_EXPLICIT,
+ &upload->transfer);
upload->size = size;