Mesa (master): intel/genxml,isl: Add gen12 stencil buffer changes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 17 21:52:17 UTC 2019


Module: Mesa
Branch: master
Commit: 523ba0a3e71107f5ac445895109808c0d820b0d0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=523ba0a3e71107f5ac445895109808c0d820b0d0

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Wed Aug 16 16:45:47 2017 -0700

intel/genxml,isl: Add gen12 stencil buffer changes

Rework:
 * NULL stencil buffer path (Jason)
 * genxml fixes (Nanley)

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>

---

 src/intel/genxml/gen12.xml             | 35 +++++++++++++++++++++++++++++-----
 src/intel/isl/isl_emit_depth_stencil.c | 23 +++++++++++++++++++++-
 2 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/src/intel/genxml/gen12.xml b/src/intel/genxml/gen12.xml
index 77fc67098a0..609535bc1e4 100644
--- a/src/intel/genxml/gen12.xml
+++ b/src/intel/genxml/gen12.xml
@@ -2543,17 +2543,38 @@
     </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">
@@ -2969,6 +2990,10 @@
 
   <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"/>
diff --git a/src/intel/isl/isl_emit_depth_stencil.c b/src/intel/isl/isl_emit_depth_stencil.c
index 66a5fe1b979..382c0ce22f5 100644
--- a/src/intel/isl/isl_emit_depth_stencil.c
+++ b/src/intel/isl/isl_emit_depth_stencil.c
@@ -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;
@@ -145,6 +153,19 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
       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
    }
 
 #if GEN_GEN >= 6




More information about the mesa-commit mailing list