svga: Flush upload buffers or we get asserts
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 2 Feb 2011 11:28:41 +0000 (11:28 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 2 Feb 2011 11:28:41 +0000 (11:28 +0000)
Based on work from Jakob Bornecrantz, Michel Dänzer, and Brian Paul.

src/gallium/drivers/svga/svga_context.c
src/gallium/drivers/svga/svga_draw.c

index 61f99d1eb18f5f8b276ba6e42b9e5768ea9f3e98..2b8a70d18f1c2e96eca3be14ef6d00af8875cf60 100644 (file)
@@ -207,11 +207,6 @@ void svga_context_flush( struct svga_context *svga,
 
    svga->curr.nr_fbs = 0;
 
-   /* Unmap upload manager buffers: 
-    */
-   u_upload_flush(svga->upload_vb);
-   u_upload_flush(svga->upload_ib);
-
    /* Ensure that texture dma uploads are processed
     * before submitting commands.
     */
index 97cbac447d6ba506667de84c1f950fb8374d0d8f..2c873a0f7ac276fc65ccb80c0c12df6ef20fecb2 100644 (file)
@@ -28,6 +28,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
+#include "util/u_upload_mgr.h"
 
 #include "svga_context.h"
 #include "svga_draw.h"
@@ -143,6 +144,9 @@ svga_hwtnl_flush( struct svga_hwtnl *hwtnl )
       SVGA3dPrimitiveRange *prim;
       unsigned i;
 
+      /* Unmap upload manager vertex buffers */
+      u_upload_flush(svga->upload_vb);
+
       for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
          handle = svga_buffer_handle(svga, hwtnl->cmd.vdecl_vb[i]);
          if (handle == NULL)
@@ -151,6 +155,9 @@ svga_hwtnl_flush( struct svga_hwtnl *hwtnl )
          vb_handle[i] = handle;
       }
 
+      /* Unmap upload manager index buffers */
+      u_upload_flush(svga->upload_ib);
+
       for (i = 0; i < hwtnl->cmd.prim_count; i++) {
          if (hwtnl->cmd.prim_ib[i]) {
             handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i]);