r600: set VGT NUM_INSTANCES as part of the draw command
authorAlex Deucher <alexdeucher@gmail.com>
Mon, 27 Jul 2009 06:07:59 +0000 (02:07 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Mon, 27 Jul 2009 06:26:41 +0000 (02:26 -0400)
set VGT NUM_INSTANCES as part of the draw command rather
than as state as recommended by the pm4 guide.  Also,
use the NUM_INSTANCES packet.

src/mesa/drivers/dri/r600/r700_chip.c
src/mesa/drivers/dri/r600/r700_chip.h
src/mesa/drivers/dri/r600/r700_render.c
src/mesa/drivers/dri/r600/r700_state.c

index 899b464c547cc1d413e9d02a94d64eb421b4d586..e683c8cf92003242b71ad0c63ad09c741fe545f0 100644 (file)
@@ -160,7 +160,6 @@ GLboolean r700InitChipObject(context_t *context)
     LINK_STATES(VGT_GROUP_VECT_1_FMT_CNTL);
     LINK_STATES(VGT_GS_MODE);
     LINK_STATES(VGT_PRIMITIVEID_EN);
-    LINK_STATES(VGT_DMA_NUM_INSTANCES);
     LINK_STATES(VGT_MULTI_PRIM_IB_RESET_EN);
     LINK_STATES(VGT_INSTANCE_STEP_RATE_0);
     LINK_STATES(VGT_INSTANCE_STEP_RATE_1);
index fa419aa49957d0081abfd866efdee255afccbd96..ca3364bb489b6d4edb6069566baca9d0ee4a1b49 100644 (file)
@@ -393,7 +393,6 @@ typedef struct _R700_CHIP_CONTEXT
        union UINT_FLOAT                VGT_GROUP_VECT_1_FMT_CNTL ;  /* 0xA28F */
        union UINT_FLOAT                VGT_GS_MODE               ;  /* 0xA290 */
        union UINT_FLOAT                VGT_PRIMITIVEID_EN        ;  /* 0xA2A1 */
-       union UINT_FLOAT                VGT_DMA_NUM_INSTANCES     ;  /* 0xA2A2 */
        union UINT_FLOAT                VGT_MULTI_PRIM_IB_RESET_EN;  /* 0xA2A5 */
        union UINT_FLOAT                VGT_INSTANCE_STEP_RATE_0  ;  /* 0xA2A8 */
        union UINT_FLOAT                VGT_INSTANCE_STEP_RATE_1  ;  /* 0xA2A9 */
index 77cbe3cfd0f06393f287224e7b57ff6f6b7815db..0a5e04154792b7b90b55dae98454185baad1c3f8 100644 (file)
@@ -329,7 +329,7 @@ static GLboolean r700RunRender(GLcontext * ctx,
     r700SendDepthTargetState(context);
 
     /* richard test code */
-    for (i = 0; i < vb->PrimitiveCount; i++) 
+    for (i = 0; i < vb->PrimitiveCount; i++)
     {
         GLuint prim = _tnl_translate_prim(&vb->Primitive[i]);
         GLuint start = vb->Primitive[i].start;
@@ -341,25 +341,31 @@ static GLboolean r700RunRender(GLcontext * ctx,
         unsigned int VGT_INDEX_TYPE     = 0;
         unsigned int VGT_PRIMITIVE_TYPE = 0;
         unsigned int VGT_NUM_INDICES    = 0;
-        
-        numEntires = 2 /* VGT_INDEX_TYPE */
-                     + 3 /* VGT_PRIMITIVE_TYPE */
-                     + numIndices + 3; /* DRAW_INDEX_IMMD */                  
-                     
-        BEGIN_BATCH_NO_AUTOSTATE(numEntires);  
 
-        VGT_INDEX_TYPE |= DI_INDEX_SIZE_32_BIT << INDEX_TYPE_shift;
-
-        R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0));
-        R600_OUT_BATCH(VGT_INDEX_TYPE);
+        numEntires =   3 /* VGT_PRIMITIVE_TYPE */
+                    + 2 /* VGT_INDEX_TYPE */
+                    + 2 /* NUM_INSTANCES */
+                     + numIndices + 3; /* DRAW_INDEX_IMMD */
 
-        VGT_NUM_INDICES = numIndices;
+        BEGIN_BATCH_NO_AUTOSTATE(numEntires);
 
+       // prim
         VGT_PRIMITIVE_TYPE |= r700PrimitiveType(prim) << VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift;
         R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1));
         R600_OUT_BATCH(mmVGT_PRIMITIVE_TYPE - ASIC_CONFIG_BASE_INDEX);
         R600_OUT_BATCH(VGT_PRIMITIVE_TYPE);
 
+       // index type
+        VGT_INDEX_TYPE |= DI_INDEX_SIZE_32_BIT << INDEX_TYPE_shift;
+        R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0));
+        R600_OUT_BATCH(VGT_INDEX_TYPE);
+
+       // num instances
+       R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0));
+        R600_OUT_BATCH(1);
+
+       // draw packet
+        VGT_NUM_INDICES = numIndices;
         VGT_DRAW_INITIATOR |= DI_SRC_SEL_IMMEDIATE << SOURCE_SELECT_shift;
         VGT_DRAW_INITIATOR |= DI_MAJOR_MODE_0 << MAJOR_MODE_shift;
 
index a2ddebb1cee51e9863725b5189e4c00028a5c7cb..bd0abc06e384708c5b24ea4fed9ba1f68307461b 100644 (file)
@@ -1653,9 +1653,6 @@ void r700InitState(GLcontext * ctx) //-------------------
     r700->VGT_MIN_VTX_INDX.u32All      = 0;
     r700->VGT_INDX_OFFSET.u32All    = 0;
 
-    /* Specify the number of instances */
-    r700->VGT_DMA_NUM_INSTANCES.u32All = 1;
-
     /* default shader connections. */
     r700->SPI_VS_OUT_ID_0.u32All  = 0x03020100;
     r700->SPI_VS_OUT_ID_1.u32All  = 0x07060504;