[Mesa-dev] i965 Valleyview: 3DSTATE_URB_VS Minimum URB Entries Fix

Cheah, Douglas douglas.cheah at intel.com
Wed Jul 4 19:56:16 PDT 2012



Hello folks,

I am not too sure if this right avenue but I am trying to get the patch below integrated into MESA. The patch below solves a bug where for several 3D application running on Intel's Valleyview hardware there would be massive corruption. Corruptions includes vertex being wrongly clipped to missing texture.

The patch basically ensure that the correct number of URB entries is programmed when the URB allocation us less than 9 512-bit units. This is consistent with what is documented in the 3D Pipeline PRM, right now the current MESA codes would program the maximum number of entries instead.

I have tested on the following mesa demos which after the patch it was rendering correctly:- spectex, fbo_firecube, gloss, ipers, teapot, terrain, tunnel and tunnel2.


diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index ff6cc6e..8ed3c8e 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -1039,6 +1039,7 @@ enum brw_message_target {
 #define _3DSTATE_URB_GS                         0x7833 /* GEN7+ */
 # define GEN7_URB_ENTRY_SIZE_SHIFT                      16
 # define GEN7_URB_STARTING_ADDRESS_SHIFT                25
+# define GEN7_URB_VS_MIN_ENTRIES                       32

 #define _3DSTATE_PUSH_CONSTANT_ALLOC_VS         0x7912 /* GEN7+ */
 #define _3DSTATE_PUSH_CONSTANT_ALLOC_PS         0x7916 /* GEN7+ */
diff --git a/src/mesa/drivers/dri/i965/gen7_urb.c b/src/mesa/drivers/dri/i965/gen7_urb.c
index 481497b..7d31a3c 100644
--- a/src/mesa/drivers/dri/i965/gen7_urb.c
+++ b/src/mesa/drivers/dri/i965/gen7_urb.c
@@ -88,6 +88,12 @@ gen7_upload_urb(struct brw_context *brw)
    if (nr_vs_entries > brw->urb.max_vs_entries)
       nr_vs_entries = brw->urb.max_vs_entries;

+   /* If the number of URB Allocation Size is smaller than 9 512 bit
+    * units set the number or URB to Entries to 32
+    */
+   if(brw->urb.vs_size < 9)
+        nr_vs_entries = GEN7_URB_VS_MIN_ENTRIES;
+
    /* According to volume 2a, nr_vs_entries must be a multiple of 8. */
    brw->urb.nr_vs_entries = ROUND_DOWN_TO(nr_vs_entries, 8);



Douglas


More information about the mesa-dev mailing list