Mesa (lp-binning): llvmpipe: quick hack to short-circuit empty bins

Keith Whitwell keithw at kemper.freedesktop.org
Wed Jan 13 15:38:16 UTC 2010


Module: Mesa
Branch: lp-binning
Commit: da45f49cc63fff06513dc28d9616084fc81798d4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=da45f49cc63fff06513dc28d9616084fc81798d4

Author: Keith Whitwell <keithw at vmware.com>
Date:   Wed Jan 13 14:41:02 2010 +0000

llvmpipe: quick hack to short-circuit empty bins

---

 src/gallium/drivers/llvmpipe/lp_rast.c  |   23 ++++++++++++++++++++++-
 src/gallium/drivers/llvmpipe/lp_setup.c |    4 +++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 38c27b9..4c13d4d 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -576,6 +576,26 @@ rasterize_bin( struct lp_rasterizer *rast,
    lp_rast_end_tile( rast, thread_index );
 }
 
+static boolean
+is_empty_bin( struct lp_rasterizer *rast,
+              const struct cmd_bin *bin )
+{
+   const struct cmd_block *head = bin->commands.head;
+   int i;
+
+   if (head->next != NULL ||
+       head->count > PIPE_MAX_COLOR_BUFS + 1)
+      return FALSE;
+
+   for (i = 0; i < head->count; i++)
+      if (head->cmd[i] != lp_rast_load_color &&
+          head->cmd[i] != lp_rast_load_zstencil)
+         return FALSE;
+
+   return TRUE;
+}
+
+
 
 /**
  * Rasterize/execute all bins within a scene.
@@ -606,7 +626,8 @@ rasterize_scene( struct lp_rasterizer *rast,
 
       assert(scene);
       while ((bin = lp_scene_bin_iter_next(scene, &x, &y))) {
-         rasterize_bin( rast, thread_index, bin, x * TILE_SIZE, y * TILE_SIZE);
+         if (!is_empty_bin( rast, bin ))
+            rasterize_bin( rast, thread_index, bin, x * TILE_SIZE, y * TILE_SIZE);
       }
    }
 #endif
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 74f3054..38ea0c6 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -153,7 +153,9 @@ begin_binning( struct setup_context *setup )
 {
    struct lp_scene *scene = lp_setup_get_current_scene(setup);
 
-   LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
+   LP_DBG(DEBUG_SETUP, "%s color: %s depth: %s\n", __FUNCTION__,
+          (setup->clear.flags & PIPE_CLEAR_COLOR) ? "clear": "load",
+          (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) ? "clear": "load");
 
    if (setup->fb.nr_cbufs) {
       if (setup->clear.flags & PIPE_CLEAR_COLOR)




More information about the mesa-commit mailing list