vc4: Add some comments about state management.
authorEric Anholt <eric@anholt.net>
Fri, 17 Oct 2014 08:40:12 +0000 (09:40 +0100)
committerEric Anholt <eric@anholt.net>
Fri, 17 Oct 2014 12:09:28 +0000 (13:09 +0100)
src/gallium/drivers/vc4/vc4_context.c
src/gallium/drivers/vc4/vc4_draw.c

index bcbb0049fb9e6538fda773c19688ac24a68f7e45..205f81d5c89bfc0a5155a5f146d19494ef2505e9 100644 (file)
@@ -319,6 +319,12 @@ vc4_flush(struct pipe_context *pctx)
 
         vc4->needs_flush = false;
         vc4->draw_call_queued = false;
+
+        /* We have no hardware context saved between our draw calls, so we
+         * need to flag the next draw as needing all state emitted.  Emitting
+         * all state at the start of our draws is also what ensures that we
+         * return to the state we need after a previous tile has finished.
+         */
         vc4->dirty = ~0;
         vc4->resolve = 0;
         vc4->cleared = 0;
index 0938a76e00008ec825eb52f5b52dbc99e57ba037..f3c225de399ba2005bc99b2133fbbcf1466627a4 100644 (file)
@@ -78,6 +78,11 @@ vc4_start_draw(struct vc4_context *vc4)
               VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_32 |
               VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_32);
 
+        /* START_TILE_BINNING resets the statechange counters in the hardware,
+         * which are what is used when a primitive is binned to a tile to
+         * figure out what new state packets need to be written to that tile's
+         * command list.
+         */
         cl_u8(&vc4->bcl, VC4_PACKET_START_TILE_BINNING);
 
         vc4->needs_flush = true;