llvmpipe: added lp_rast_fence() bin function

This commit is contained in:
Brian Paul 2009-12-11 17:57:45 -07:00
parent 9323740738
commit 4b70af918d
2 changed files with 39 additions and 0 deletions

View file

@ -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"
@ -505,6 +506,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.

View file

@ -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;
};
@ -177,6 +179,15 @@ lp_rast_arg_state( const struct lp_rast_state *state )
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 )
{
@ -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