summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-12-11 17:57:45 -0700
committerBrian Paul <brianp@vmware.com>2009-12-11 17:57:45 -0700
commit4b70af918dd9040a6987c6a55e76e49f0e3f90bf (patch)
treeeb3e587da8e9a72136490461099c75972f15a8e5
parent932374073863379e9da862d6115410889f038154 (diff)
llvmpipe: added lp_rast_fence() bin function
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c25
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h14
2 files changed, 39 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 6b7aa8d729..3e7b3d7ab4 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -32,6 +32,7 @@
#include "lp_bin_queue.h"
#include "lp_debug.h"
+#include "lp_fence.h"
#include "lp_state.h"
#include "lp_rast.h"
#include "lp_rast_priv.h"
@@ -506,6 +507,30 @@ lp_rast_end_tile( struct lp_rasterizer *rast,
/**
+ * Signal on a fence. This is called during bin execution/rasterization.
+ * Called per thread.
+ */
+void lp_rast_fence( struct lp_rasterizer *rast,
+ unsigned thread_index,
+ const union lp_rast_cmd_arg arg )
+{
+ struct lp_fence *fence = arg.fence;
+
+ pipe_mutex_lock( fence->mutex );
+
+ fence->count++;
+ assert(fence->count <= fence->rank);
+
+ LP_DBG(DEBUG_RAST, "%s count=%u rank=%u\n", __FUNCTION__,
+ fence->count, fence->rank);
+
+ pipe_condvar_signal( fence->signalled );
+
+ pipe_mutex_unlock( fence->mutex );
+}
+
+
+/**
* When all the threads are done rasterizing a bin, one thread will
* call this function to reset the bin and put it onto the empty queue.
*/
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index 785be49b70..bd8f1ae1c9 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -44,6 +44,7 @@
struct lp_rasterizer;
struct lp_bins;
struct lp_bins_queue;
+struct lp_fence;
struct cmd_bin;
struct pipe_screen;
@@ -148,6 +149,7 @@ union lp_rast_cmd_arg {
const struct lp_rast_state *set_state;
uint8_t clear_color[4];
unsigned clear_zstencil;
+ struct lp_fence *fence;
};
@@ -178,6 +180,15 @@ lp_rast_arg_state( const struct lp_rast_state *state )
}
static INLINE const union lp_rast_cmd_arg
+lp_rast_arg_fence( struct lp_fence *fence )
+{
+ union lp_rast_cmd_arg arg;
+ arg.fence = fence;
+ return arg;
+}
+
+
+static INLINE const union lp_rast_cmd_arg
lp_rast_arg_null( void )
{
union lp_rast_cmd_arg arg;
@@ -221,5 +232,8 @@ void lp_rast_shade_tile( struct lp_rasterizer *,
unsigned thread_index,
const union lp_rast_cmd_arg );
+void lp_rast_fence( struct lp_rasterizer *,
+ unsigned thread_index,
+ const union lp_rast_cmd_arg );
#endif