diff options
author | Keith Whitwell <[email protected]> | 2010-07-08 15:13:35 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2010-07-13 17:23:48 +0100 |
commit | 3bd9aedbac79eec16bfe6f5fc6f6a021eebe769a (patch) | |
tree | ed8c7d28d1d6c7b8cd33b1c68e3ac996c5b64ea8 /src/gallium/drivers/llvmpipe/lp_setup.c | |
parent | 6d17f00600ffca7cb39e6f66277cec018ff2c151 (diff) |
llvmpipe: move fences from per-bin to per-thread
Rather than inserting an lp_rast_fence command at the end of each
bin, have each rasterizer thread call this function directly once
it has run out of work to do on a particular scene.
This results in fewer calls to the mutex & related functions, but more
importantly makes it easier to recognize empty bins.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 2bd6fcebe7f..3b83f4e7428 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -271,7 +271,8 @@ set_scene_state( struct lp_setup_context *setup, */ void lp_setup_flush( struct lp_setup_context *setup, - unsigned flags ) + unsigned flags, + struct pipe_fence_handle **fence) { LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); @@ -288,6 +289,15 @@ lp_setup_flush( struct lp_setup_context *setup, */ lp_scene_bin_everywhere(scene, lp_rast_store_color, dummy); } + + + if (fence) { + /* if we're going to flush the setup/rasterization modules, emit + * a fence. + */ + *fence = lp_setup_fence( setup ); + } + } set_scene_state( setup, SETUP_FLUSHED ); @@ -433,24 +443,27 @@ lp_setup_clear( struct lp_setup_context *setup, struct pipe_fence_handle * lp_setup_fence( struct lp_setup_context *setup ) { - if (setup->num_threads == 0) { + if (setup->scene == NULL) return NULL; - } - else { + else if (setup->num_threads == 0) + return NULL; + else + { struct lp_scene *scene = lp_setup_get_current_scene(setup); - const unsigned rank = lp_scene_get_num_bins( scene ); /* xxx */ - struct lp_fence *fence = lp_fence_create(rank); - - LP_DBG(DEBUG_SETUP, "%s rank %u\n", __FUNCTION__, rank); + const unsigned rank = setup->num_threads; set_scene_state( setup, SETUP_ACTIVE ); + + assert(scene->fence == NULL); - /* insert the fence into all command bins */ - lp_scene_bin_everywhere( scene, - lp_rast_fence, - lp_rast_arg_fence(fence) ); + /* The caller gets a reference, we keep a copy too, so need to + * bump the refcount: + */ + lp_fence_reference(&scene->fence, lp_fence_create(rank)); + + LP_DBG(DEBUG_SETUP, "%s rank %u\n", __FUNCTION__, rank); - return (struct pipe_fence_handle *) fence; + return (struct pipe_fence_handle *) scene->fence; } } |