svga: Flush the hwtnl primitives before writing to buffers.
[mesa.git] / src / gallium / drivers / svga / svga_resource_buffer.c
index 34ab9e143e68a10f4b0b6f827a81fb4e86979c1c..fa713ee88adda16c864983942dcfee6276e6faf1 100644 (file)
@@ -87,10 +87,13 @@ svga_buffer_get_transfer(struct pipe_context *pipe,
    if (usage & PIPE_TRANSFER_WRITE) {
       if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) {
          /*
-          * Finish writing any pending DMA commands, and tell the host to discard
-          * the buffer contents on the next DMA operation.
+          * Flush any pending primitives, finish writing any pending DMA
+          * commands, and tell the host to discard the buffer contents on
+          * the next DMA operation.
           */
 
+         svga_hwtnl_flush_buffer(svga, resource);
+
          if (sbuf->dma.pending) {
             svga_buffer_upload_flush(svga, sbuf);
 
@@ -117,10 +120,12 @@ svga_buffer_get_transfer(struct pipe_context *pipe,
          }
       } else {
          /*
-          * Synchronizing, so finish writing any pending DMA command, and
-          * ensure the next DMA will be done in order.
+          * Synchronizing, so flush any pending primitives, finish writing any
+          * pending DMA command, and ensure the next DMA will be done in order.
           */
 
+         svga_hwtnl_flush_buffer(svga, resource);
+
          if (sbuf->dma.pending) {
             svga_buffer_upload_flush(svga, sbuf);