Mesa (lp-binning): llvmpipe: checkpoint: plug in the new fencing code

Brian Paul brianp at kemper.freedesktop.org
Sat Dec 12 01:01:21 UTC 2009


Module: Mesa
Branch: lp-binning
Commit: 6cbb1219a3f6b83ee4d24aecb61f5b5943e3cac3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6cbb1219a3f6b83ee4d24aecb61f5b5943e3cac3

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Dec 11 17:59:26 2009 -0700

llvmpipe: checkpoint: plug in the new fencing code

This has only been very lightly tested.  More work to come.

---

 src/gallium/drivers/llvmpipe/lp_flush.c |   20 +++++++++++++++++---
 src/gallium/drivers/llvmpipe/lp_setup.c |   23 +++++++++++++++++++++++
 src/gallium/drivers/llvmpipe/lp_setup.h |    4 ++++
 3 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c
index f7a1d89..e6519cb 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.c
+++ b/src/gallium/drivers/llvmpipe/lp_flush.c
@@ -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;
 }
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index d976934..3967b4f 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -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,
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index 66a7f29..5c606e8 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -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],




More information about the mesa-commit mailing list