anv/iris: warn gen12 3DSTATE_HS restriction
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 21 Jan 2020 15:54:01 +0000 (17:54 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 23 Jan 2020 13:06:59 +0000 (15:06 +0200)
This should never happen but better off documenting it in case someone
plays with max threads numbers.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3489>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3489>

src/gallium/drivers/iris/iris_state.c
src/intel/vulkan/genX_pipeline.c

index f36192796567172ed2b252d834b9f71ffec87ee1..5fbb24bdf7f92c196b447480c04512d060ad3b87 100644 (file)
@@ -4187,6 +4187,16 @@ iris_store_tcs_state(struct iris_context *ice,
    iris_pack_command(GENX(3DSTATE_HS), shader->derived_data, hs) {
       INIT_THREAD_DISPATCH_FIELDS(hs, Vertex, MESA_SHADER_TESS_CTRL);
 
+#if GEN_GEN >= 12
+      /* GEN:BUG:1604578095:
+       *
+       *    Hang occurs when the number of max threads is less than 2 times
+       *    the number of instance count. The number of max threads must be
+       *    more than 2 times the number of instance count.
+       */
+      assert((devinfo->max_tcs_threads / 2) > tcs_prog_data->instances);
+#endif
+
       hs.InstanceCount = tcs_prog_data->instances - 1;
       hs.MaximumNumberofThreads = devinfo->max_tcs_threads - 1;
       hs.IncludeVertexHandles = true;
index 82be5ab90ea6ebb924c61a9f427e7f37e663079b..4dda92202d782600c71c56ab097f3207fc3d721b 100644 (file)
@@ -1589,6 +1589,17 @@ emit_3dstate_hs_te_ds(struct anv_pipeline *pipeline,
       /* WA_1606682166 */
       hs.SamplerCount = GEN_GEN == 11 ? 0 : get_sampler_count(tcs_bin);
       hs.BindingTableEntryCount = get_binding_table_entry_count(tcs_bin);
+
+#if GEN_GEN >= 12
+      /* GEN:BUG:1604578095:
+       *
+       *    Hang occurs when the number of max threads is less than 2 times
+       *    the number of instance count. The number of max threads must be
+       *    more than 2 times the number of instance count.
+       */
+      assert((devinfo->max_tcs_threads / 2) > tcs_prog_data->instances);
+#endif
+
       hs.MaximumNumberofThreads = devinfo->max_tcs_threads - 1;
       hs.IncludeVertexHandles = true;
       hs.InstanceCount = tcs_prog_data->instances - 1;