Mesa (master): r300g: update my notes about fastfill and zbuffer compression

Marek Olšák mareko at kemper.freedesktop.org
Sun Jun 27 06:17:52 PDT 2010


Module: Mesa
Branch: master
Commit: 5acdfdbf42a00352972f0f9cdd06188d0630b3dc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5acdfdbf42a00352972f0f9cdd06188d0630b3dc

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat Jun 26 17:41:42 2010 +0200

r300g: update my notes about fastfill and zbuffer compression

---

 src/gallium/drivers/r300/r300_blit.c    |   33 +++++++++++++++++++++---------
 src/gallium/drivers/r300/r300_context.c |    2 +-
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index c88f44b..97d53a1 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -86,24 +86,37 @@ static void r300_clear(struct pipe_context* pipe,
                        double depth,
                        unsigned stencil)
 {
-    /* XXX Implement fastfill.
+    /* My notes about fastfill:
      *
-     * If fastfill is enabled, a few facts should be considered:
+     * 1) Only the zbuffer is cleared.
      *
-     * 1) Zbuffer must be micro-tiled and whole microtiles must be
-     *    written.
+     * 2) The zbuffer must be micro-tiled and whole microtiles must be
+     *    written. If microtiling is disabled, it locks up.
      *
-     * 2) ZB_DEPTHCLEARVALUE is used to clear a zbuffer and Z Mask must be
-     *    equal to 0.
+     * 3) There is Z Mask RAM which contains a compressed zbuffer and
+     *    it interacts with fastfill. We should figure out how to use it
+     *    to get more performance.
+     *    This is what we know about the Z Mask:
      *
-     * 3) For 16-bit integer buffering, compression causes a hung with one or
+     *       Each dword of the Z Mask contains compression information
+     *       for 16 4x4 pixel blocks, that is 2 bits for each block.
+     *       On chips with 2 Z pipes, every other dword maps to a different
+     *       pipe.
+     *
+     * 4) ZB_DEPTHCLEARVALUE is used to clear the zbuffer and the Z Mask must
+     *    be equal to 0. (clear the Z Mask RAM with zeros)
+     *
+     * 5) For 16-bit zbuffer, compression causes a hung with one or
      *    two samples and should not be used.
      *
-     * 4) Fastfill must not be used if reading of compressed Z data is disabled
+     * 6) FORCE_COMPRESSED_STENCIL_VALUE should be enabled for stencil clears
+     *    to avoid needless decompression.
+     *
+     * 7) Fastfill must not be used if reading of compressed Z data is disabled
      *    and writing of compressed Z data is enabled (RD/WR_COMP_ENABLE),
      *    i.e. it cannot be used to compress the zbuffer.
-     *    (what the hell does that mean and how does it fit in clearing
-     *    the buffers?)
+     *
+     * 8) ZB_CB_CLEAR does not interact with fastfill in any way.
      *
      * - Marek
      */
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 46d1ed9..4e3be07 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -151,7 +151,7 @@ static void r300_setup_atoms(struct r300_context* r300)
     R300_INIT_ATOM(query_start, 4);
 
     /* Replace emission functions for r500. */
-    if (r300->screen->caps.is_r500) {
+    if (is_r500) {
         r300->fs.emit = r500_emit_fs;
         r300->fs_rc_constant_state.emit = r500_emit_fs_rc_constant_state;
         r300->fs_constants.emit = r500_emit_fs_constants;



More information about the mesa-commit mailing list