[Mesa-dev] [PATCH] i965/vs: Fix URB entry size calculations on Ivybridge.

Kenneth Graunke kenneth at whitecape.org
Tue Jan 17 21:33:09 PST 2012


This is inspired by the BSpec, vol2a 3D Pipeline - Overview:
3D Pipeline / 3D Pipeline State Overview / Push Constant URB Allocation.
In particular, the last paragraph.

The new VS change fixes vertex scrambling in GLBenchmark PRO; the old VS
change is just for good measure/symmetry.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |    4 +++-
 src/mesa/drivers/dri/i965/brw_vs_emit.c        |    7 ++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

I apologize for not having a specific quote from the spec.  The text I cited
gave me the idea for the patch, but doesn't definitively say "yes, this is
required!".

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 5df2470..1119842 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2287,7 +2287,9 @@ vec4_visitor::emit_urb_writes()
       inst->offset = (max_usable_mrf - base_mrf) / 2;
    }
 
-   if (intel->gen == 6)
+   if (intel->gen == 7)
+      c->prog_data.urb_entry_size = ALIGN(c->vue_map.num_slots, 8) / 4;
+   else if (intel->gen == 6)
       c->prog_data.urb_entry_size = ALIGN(c->vue_map.num_slots, 8) / 8;
    else
       c->prog_data.urb_entry_size = ALIGN(c->vue_map.num_slots, 4) / 4;
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 2b4b13a..9bfe82c 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -407,7 +407,12 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
     */
    attributes_in_vue = MAX2(c->vue_map.num_slots, c->nr_inputs);
 
-   if (intel->gen == 6) {
+   if (intel->gen == 7) {
+      /* Ivybridge counts in 512-bit units, but still needs the larger
+       * alignment restriction.
+       */
+      c->prog_data.urb_entry_size = ALIGN(attributes_in_vue, 8) / 4;
+   } else if (intel->gen == 6) {
       /* Each attribute is 32 bytes (2 vec4s), so dividing by 8 gives us the
        * number of 128-byte (1024-bit) units.
        */
-- 
1.7.7.1



More information about the mesa-dev mailing list