From 05a16b8e1cf5f402636ae5f870ed0ae5e250735e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 10 Feb 2011 20:53:55 +0000 Subject: [PATCH] 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 file 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; -- 2.30.2