Mesa (master): llvmpipe: optimize the lp_setup_fence() function
Brian Paul
brianp at kemper.freedesktop.org
Thu Mar 25 02:50:47 UTC 2010
Module: Mesa
Branch: master
Commit: a9063cad0f0190ff88cd20fbad5aa87bf1a943f6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9063cad0f0190ff88cd20fbad5aa87bf1a943f6
Author: Brian Paul <brianp at vmware.com>
Date: Wed Mar 24 20:49:12 2010 -0600
llvmpipe: optimize the lp_setup_fence() function
Avoid emitting fences when not needed.
Speeds up glReadPixels quite a bit when reading image row by row.
---
src/gallium/drivers/llvmpipe/lp_setup.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 76a8b87..4eeb986 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -318,16 +318,30 @@ lp_setup_fence( struct lp_setup_context *setup )
{
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);
+ struct lp_fence *fence;
LP_DBG(DEBUG_SETUP, "%s rank %u\n", __FUNCTION__, rank);
- set_scene_state( setup, SETUP_ACTIVE );
+ if (setup->state == SETUP_FLUSHED) {
+ /* We're in a flushed state so there's nothing in the bins.
+ * No need to wait on a fence.
+ */
+ fence = NULL;
+ }
+ else {
+ /* There's material in the bins. Emit the fence into the bins.
+ * When the rasterizer(s) find the fence, they'll signal on it.
+ */
+ fence = lp_fence_create(rank);
+
+ set_scene_state( setup, SETUP_ACTIVE );
- /* insert the fence into all command bins */
- lp_scene_bin_everywhere( scene,
- lp_rast_fence,
- lp_rast_arg_fence(fence) );
+ /* insert the fence into all command bins */
+ lp_scene_bin_everywhere( scene,
+ lp_rast_fence,
+ lp_rast_arg_fence(fence) );
+
+ }
return (struct pipe_fence_handle *) fence;
}
More information about the mesa-commit
mailing list