Mesa (master): u_upload_mgr: Use PIPE_TRANSFER_FLUSH_EXPLICIT.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Thu Feb 10 20:56:39 UTC 2011
Module: Mesa
Branch: master
Commit: 05a16b8e1cf5f402636ae5f870ed0ae5e250735e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=05a16b8e1cf5f402636ae5f870ed0ae5e250735e
Author: José Fonseca <jfonseca at vmware.com>
Date: Thu Feb 10 20:53:55 2011 +0000
u_upload_mgr: Use PIPE_TRANSFER_FLUSH_EXPLICIT.
This can avoid DMAing the whole buffer when just a fraction was changed.
---
src/gallium/auxiliary/util/u_upload_mgr.c | 11 +++++++++--
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 865dab8..69b11f9 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;
More information about the mesa-commit
mailing list