#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"
}
+/**
+ * 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.
struct lp_rasterizer;
struct lp_bins;
struct lp_bins_queue;
+struct lp_fence;
struct cmd_bin;
struct pipe_screen;
const struct lp_rast_state *set_state;
uint8_t clear_color[4];
unsigned clear_zstencil;
+ struct lp_fence *fence;
};
return arg;
}
+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 )
{
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