diff options
author | José Fonseca <jfonseca@vmware.com> | 2011-03-11 14:00:25 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2011-03-15 15:38:18 +0000 |
commit | ef33c82bfde788733aabc5dcc9647416c31ae254 (patch) | |
tree | a80df6e43642e284ea2b97da9a580028d0a0627c /src/gallium/drivers/svga/svga_resource_buffer_upload.c | |
parent | a946e840715b481065db2347696eea6bae0c9dd6 (diff) | |
download | external_mesa3d-ef33c82bfde788733aabc5dcc9647416c31ae254.zip external_mesa3d-ef33c82bfde788733aabc5dcc9647416c31ae254.tar.gz external_mesa3d-ef33c82bfde788733aabc5dcc9647416c31ae254.tar.bz2 |
svga: Ensure DMA commands are serialized with unsynchronized flag is unset.
Diffstat (limited to 'src/gallium/drivers/svga/svga_resource_buffer_upload.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_resource_buffer_upload.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c b/src/gallium/drivers/svga/svga_resource_buffer_upload.c index b7d5460..0bfa8a1 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c +++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c @@ -252,7 +252,7 @@ svga_buffer_upload_command(struct svga_context *svga, * Patch up the upload DMA command reserved by svga_buffer_upload_command * with the final ranges. */ -static void +void svga_buffer_upload_flush(struct svga_context *svga, struct svga_buffer *sbuf) { @@ -260,6 +260,10 @@ svga_buffer_upload_flush(struct svga_context *svga, unsigned i; struct pipe_resource *dummy; + if (!sbuf->dma.pending) { + return; + } + assert(sbuf->handle); assert(sbuf->hwbuf); assert(sbuf->map.num_ranges); @@ -296,6 +300,8 @@ svga_buffer_upload_flush(struct svga_context *svga, sbuf->head.next = sbuf->head.prev = NULL; #endif sbuf->dma.pending = FALSE; + sbuf->dma.flags.discard = FALSE; + sbuf->dma.flags.unsynchronized = FALSE; sbuf->dma.svga = NULL; sbuf->dma.boxes = NULL; @@ -306,7 +312,6 @@ svga_buffer_upload_flush(struct svga_context *svga, } - /** * Note a dirty range. * @@ -337,12 +342,6 @@ svga_buffer_add_range(struct svga_buffer *sbuf, /* * Try to grow one of the ranges. - * - * Note that it is not this function task to care about overlapping ranges, - * as the GMR was already given so it is too late to do anything. Situations - * where overlapping ranges may pose a problem should be detected via - * pipe_context::is_resource_referenced and the context that refers to the - * buffer should be flushed. */ for(i = 0; i < sbuf->map.num_ranges; ++i) { @@ -357,6 +356,11 @@ svga_buffer_add_range(struct svga_buffer *sbuf, if (dist <= 0) { /* * Ranges are contiguous or overlapping -- extend this one and return. + * + * Note that it is not this function's task to prevent overlapping + * ranges, as the GMR was already given so it is too late to do + * anything. If the ranges overlap here it must surely be because + * PIPE_TRANSFER_UNSYNCHRONIZED was set. */ sbuf->map.ranges[i].start = MIN2(sbuf->map.ranges[i].start, start); @@ -380,8 +384,7 @@ svga_buffer_add_range(struct svga_buffer *sbuf, * pending DMA upload and start clean. */ - if(sbuf->dma.pending) - svga_buffer_upload_flush(sbuf->dma.svga, sbuf); + svga_buffer_upload_flush(sbuf->dma.svga, sbuf); assert(!sbuf->dma.pending); assert(!sbuf->dma.svga); |