[Mesa-dev] [PATCH 2/2] i965: Allocate the whole URB to the VS and clarify calculations.

Kenneth Graunke kenneth at whitecape.org
Thu Apr 7 16:49:18 PDT 2011


Since we currently do not support Geometry Shaders, there's no need to
allocate any URB space to the GS unit.  Give all of it to the VS, and
document some of the units, restrictions, and calculations.
---
 src/mesa/drivers/dri/i965/brw_context.h |    2 +-
 src/mesa/drivers/dri/i965/gen6_urb.c    |   18 +++++++++++-------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index d63e8a4..6be7188 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -560,7 +560,7 @@ struct brw_context
        * a number of 1024-bit (128-byte) units.  Should be >= 1.
        */
       GLuint vs_size;
-/*       GLuint gs_size; */
+      GLuint gs_size;
 
       GLuint vs_start;
       GLuint gs_start;
diff --git a/src/mesa/drivers/dri/i965/gen6_urb.c b/src/mesa/drivers/dri/i965/gen6_urb.c
index c3819f9..83a6b97 100644
--- a/src/mesa/drivers/dri/i965/gen6_urb.c
+++ b/src/mesa/drivers/dri/i965/gen6_urb.c
@@ -45,15 +45,19 @@ prepare_urb( struct brw_context *brw )
 	max_urb_entry = 256;
    }
 
-   brw->urb.nr_vs_entries = max_urb_entry;
-   brw->urb.nr_gs_entries = max_urb_entry;
-
    /* CACHE_NEW_VS_PROG */
+   /* According to volume 2a, nr_vs_entries must be a multiple of 4 in the
+    * range [24, 256] on GT2 and [24, 128] on GT1.
+    */
+   brw->urb.nr_vs_entries = max_urb_entry;
    brw->urb.vs_size = MAX2(brw->vs.prog_data->urb_entry_size, 1);
 
-   if (2 * brw->urb.vs_size > urb_size)
-	   brw->urb.nr_vs_entries = brw->urb.nr_gs_entries = 
-		(urb_size ) / (2 * brw->urb.vs_size);
+   /* CACHE_NEW_GS_PROG */
+   /* nr_gs_entries must be a multiple of 4 in the range [0, 256] on GT2
+    * and [0, 254] on GT1.  We don't believe it either.
+    */
+   brw->urb.nr_gs_entries = 0;
+   brw->urb.gs_size = 1; /* wrong, but with 0 GS entries it doesn't matter */
 }
 
 static void
@@ -70,7 +74,7 @@ upload_urb(struct brw_context *brw)
    OUT_BATCH(_3DSTATE_URB << 16 | (3 - 2));
    OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_VS_SIZE_SHIFT) |
 	     ((brw->urb.nr_vs_entries) << GEN6_URB_VS_ENTRIES_SHIFT));
-   OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_GS_SIZE_SHIFT) |
+   OUT_BATCH(((brw->urb.gs_size - 1) << GEN6_URB_GS_SIZE_SHIFT) |
 	     ((brw->urb.nr_gs_entries) << GEN6_URB_GS_ENTRIES_SHIFT));
    ADVANCE_BATCH();
 }
-- 
1.7.4.3



More information about the mesa-dev mailing list