llvmpipe: checkpoint: plug in the new fencing code
authorBrian Paul <brianp@vmware.com>
Sat, 12 Dec 2009 00:59:26 +0000 (17:59 -0700)
committerBrian Paul <brianp@vmware.com>
Sat, 12 Dec 2009 00:59:32 +0000 (17:59 -0700)
This has only been very lightly tested.  More work to come.

src/gallium/drivers/llvmpipe/lp_flush.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup.h

index f7a1d897019810dcf6206139a654690c76e909a8..e6519cb216bdd81c55cda302c0affec144db3499 100644 (file)
@@ -49,6 +49,23 @@ llvmpipe_flush( struct pipe_context *pipe,
 
    draw_flush(llvmpipe->draw);
 
+   if (fence) {
+      if ((flags & (PIPE_FLUSH_SWAPBUFFERS |
+                    PIPE_FLUSH_RENDER_CACHE))) {
+         /* if we're going to flush the setup/rasterization modules, emit
+          * a fence.
+          * XXX this (and the code below) may need fine tuning...
+          */
+         *fence = lp_setup_fence( llvmpipe->setup );
+      }
+      else {
+         *fence = NULL;
+      }
+   }
+
+   /* XXX the lp_setup_flush(flags) param is not a bool, and it's ignored
+    * at this time!
+    */
    if (flags & PIPE_FLUSH_SWAPBUFFERS) {
       lp_setup_flush( llvmpipe->setup, FALSE );
    }
@@ -68,8 +85,5 @@ llvmpipe_flush( struct pipe_context *pipe,
       ++frame_no;
    }
 #endif
-   
-   if (fence)
-      *fence = NULL;
 }
 
index d976934a5dd47a9757f1b7a72465438b10e67298..3967b4f21ede5b0f0bd565c50b19d1243e989dd1 100644 (file)
@@ -39,6 +39,7 @@
 #include "lp_bin.h"
 #include "lp_bin_queue.h"
 #include "lp_debug.h"
+#include "lp_fence.h"
 #include "lp_state.h"
 #include "lp_buffer.h"
 #include "lp_texture.h"
@@ -308,6 +309,28 @@ lp_setup_clear( struct setup_context *setup,
 }
 
 
+/**
+ * Emit a fence.
+ */
+struct pipe_fence_handle *
+lp_setup_fence( struct setup_context *setup )
+{
+   struct lp_bins *bins = lp_setup_get_current_bins(setup);
+   const unsigned rank = lp_bin_get_num_bins( bins );
+   struct lp_fence *fence = lp_fence_create(rank);
+
+   LP_DBG(DEBUG_SETUP, "%s rank %u\n", __FUNCTION__, rank);
+
+   set_state( setup, SETUP_ACTIVE );
+
+   /* insert the fence into all command bins */
+   lp_bin_everywhere( bins,
+                      lp_rast_fence,
+                      lp_rast_arg_fence(fence) );
+
+   return (struct pipe_fence_handle *) fence;
+}
+
 
 void 
 lp_setup_set_triangle_state( struct setup_context *setup,
index 66a7f29f1e7da5ed34b64d44cc4a404b11a16582..5c606e86afcdc085aaec11a5f132d1891acc9609 100644 (file)
@@ -67,6 +67,10 @@ lp_setup_clear(struct setup_context *setup,
                unsigned clear_stencil,
                unsigned flags);
 
+struct pipe_fence_handle *
+lp_setup_fence( struct setup_context *setup );
+
+
 void
 lp_setup_tri(struct setup_context *setup,
              const float (*v0)[4],