intel/genxml,isl: Add gen12 stencil buffer changes
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 16 Aug 2017 23:45:47 +0000 (16:45 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 17 Oct 2019 21:47:22 +0000 (14:47 -0700)
Rework:
 * NULL stencil buffer path (Jason)
 * genxml fixes (Nanley)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
src/intel/genxml/gen12.xml
src/intel/isl/isl_emit_depth_stencil.c

index 77fc67098a003d01ed9d93a211be387d10dfc5d1..609535bc1e46c00e4a7017b321265370c60c3b4c 100644 (file)
     </group>
   </instruction>
 
-  <instruction name="3DSTATE_STENCIL_BUFFER" bias="2" length="5" engine="render">
-    <field name="DWord Length" start="0" end="7" type="uint" default="3"/>
+  <instruction name="3DSTATE_STENCIL_BUFFER" bias="2" length="8" engine="render">
+    <field name="DWord Length" start="0" end="7" type="uint" default="6"/>
     <field name="3D Command Sub Opcode" start="16" end="23" type="uint" default="6"/>
     <field name="3D Command Opcode" start="24" end="26" type="uint" default="0"/>
     <field name="Command SubType" start="27" end="28" type="uint" default="3"/>
     <field name="Command Type" start="29" end="31" type="uint" default="3"/>
     <field name="Surface Pitch" start="32" end="48" type="uint"/>
-    <field name="MOCS" start="54" end="60" type="uint"/>
-    <field name="Stencil Buffer Enable" start="63" end="63" type="bool"/>
+    <field name="Corner Texel Mode" start="55" end="55" type="bool"/>
+    <field name="Control Surface Enable" start="56" end="56" type="bool"/>
+    <field name="Stencil Compression Enable" start="57" end="57" type="bool"/>
+    <field name="Null Page Coherency Enable" start="59" end="59" type="bool"/>
+    <field name="Stencil Write Enable" start="60" end="60" type="bool"/>
+    <field name="Surface Type" start="61" end="63" type="uint">
+      <value name="SURFTYPE_2D" value="1"/>
+      <value name="SURFTYPE_CUBE" value="3"/>
+      <value name="SURFTYPE_NULL" value="7"/>
+    </field>
     <field name="Surface Base Address" start="64" end="127" type="address"/>
-    <field name="Surface QPitch" start="128" end="142" type="uint"/>
+    <field name="Width" start="129" end="142" type="uint"/>
+    <field name="Height" start="145" end="158" type="uint"/>
+    <field name="MOCS" start="160" end="166" type="uint"/>
+    <field name="Minimum Array Element" start="168" end="178" type="uint"/>
+    <field name="Depth" start="180" end="190" type="uint"/>
+    <field name="Mip Tail Start LOD" start="218" end="221" type="uint"/>
+    <field name="Tiled Mode" start="222" end="223" type="uint">
+      <value name="NONE" value="0"/>
+      <value name="TILEYF" value="1"/>
+      <value name="TILEYS" value="2"/>
+    </field>
+    <field name="Surface QPitch" start="224" end="238" type="uint"/>
+    <field name="Surf LOD" start="240" end="243" type="uint"/>
+    <field name="Render Target View Extent" start="245" end="255" type="uint"/>
   </instruction>
 
   <instruction name="3DSTATE_STREAMOUT" bias="2" length="5" engine="render">
 
   <instruction name="3DSTATE_WM_DEPTH_STENCIL" bias="2" length="4" engine="render">
     <field name="DWord Length" start="0" end="7" type="uint" default="2"/>
+    <field name="Stencil Reference Value Modify Disable" start="8" end="8" type="bool"/>
+    <field name="Stencil Test Mask Modify Disable" start="9" end="9" type="bool"/>
+    <field name="Stencil Write Mask Modify Disable" start="10" end="10" type="bool"/>
+    <field name="Stencil State Modify Disable" start="11" end="11" type="bool"/>
     <field name="Depth State Modify Disable" start="12" end="12" type="bool"/>
     <field name="3D Command Sub Opcode" start="16" end="23" type="uint" default="78"/>
     <field name="3D Command Opcode" start="24" end="26" type="uint" default="0"/>
index 66a5fe1b979ea305f9edbfae805291b1c86d37f5..382c0ce22f555f6eb8f1ec75dee735513459f47c 100644 (file)
@@ -133,7 +133,15 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
 #if GEN_GEN >= 7 && GEN_GEN < 12
       db.StencilWriteEnable = true;
 #endif
-#if GEN_GEN >= 8 || GEN_IS_HASWELL
+#if GEN_GEN >= 12
+      sb.StencilWriteEnable = true;
+      sb.SurfaceType = SURFTYPE_2D;
+      sb.Width = info->stencil_surf->logical_level0_px.width - 1;
+      sb.Height = info->stencil_surf->logical_level0_px.height - 1;
+      sb.Depth = sb.RenderTargetViewExtent = info->view->array_len - 1;
+      sb.SurfLOD = info->view->base_level;
+      sb.MinimumArrayElement = info->view->base_array_layer;
+#elif GEN_GEN >= 8 || GEN_IS_HASWELL
       sb.StencilBufferEnable = true;
 #endif
       sb.SurfaceBaseAddress = info->stencil_address;
@@ -144,6 +152,19 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
 #if GEN_GEN >= 8
       sb.SurfaceQPitch =
          isl_surf_get_array_pitch_el_rows(info->stencil_surf) >> 2;
+#endif
+   } else {
+#if GEN_GEN >= 12
+      sb.SurfaceType = SURFTYPE_NULL;
+
+      /* The docs seem to indicate that if surf-type is null, then we may need
+       * to match the depth-buffer value for `Depth`. It may be a
+       * documentation bug, since the other fields don't require this.
+       *
+       * TODO: Confirm documentation and remove seeting of `Depth` if not
+       * required.
+       */
+      sb.Depth = db.Depth;
 #endif
    }