From 867e2e0716ed4a753a5591542a91cca31613f46f Mon Sep 17 00:00:00 2001 From: Anuj Phogat Date: Fri, 5 Jun 2020 14:39:25 -0700 Subject: [PATCH] anv: Enable geometry distribution Using recommended values based on performance studies across a range of workloads. Rework: * Always enable geometry distribution * Set ListCutIndexEnable if primitive restart is enabled * Set distribution mode based on TEEnable * Add comment explaining the 3DSTATE_VFG bits (Sagar) v2: - Emit 3DSTATE_VFG dynamically based on primitive restart (Ken) Signed-off-by: Anuj Phogat Reviewed-by: Sagar Ghuge Reviewed-by: Jordan Justen Reviewed-by: Kenneth Graunke Part-of: --- src/intel/vulkan/gfx8_cmd_buffer.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/intel/vulkan/gfx8_cmd_buffer.c b/src/intel/vulkan/gfx8_cmd_buffer.c index 95250fa..e2b33c3 100644 --- a/src/intel/vulkan/gfx8_cmd_buffer.c +++ b/src/intel/vulkan/gfx8_cmd_buffer.c @@ -678,11 +678,42 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) ANV_CMD_DIRTY_INDEX_BUFFER | ANV_CMD_DIRTY_DYNAMIC_PRIMITIVE_RESTART_ENABLE)) { anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_VF), vf) { +#if GFX_VERx10 >= 125 + vf.GeometryDistributionEnable = true; +#endif vf.IndexedDrawCutIndexEnable = d->primitive_restart_enable; vf.CutIndex = cmd_buffer->state.restart_index; } } +#if GFX_VERx10 >= 125 + if (cmd_buffer->state.gfx.dirty & (ANV_CMD_DIRTY_PIPELINE | + ANV_CMD_DIRTY_DYNAMIC_PRIMITIVE_RESTART_ENABLE)) { + anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_VFG), vfg) { + /* If 3DSTATE_TE: TE Enable == 1 then RR_STRICT else RR_FREE*/ + vfg.DistributionMode = + anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL) ? RR_STRICT : + RR_FREE; + vfg.DistributionGranularity = BatchLevelGranularity; + vfg.ListCutIndexEnable = d->primitive_restart_enable; + /* 192 vertices for TRILIST_ADJ */ + vfg.ListNBatchSizeScale = 0; + /* Batch size of 384 vertices */ + vfg.List3BatchSizeScale = 2; + /* Batch size of 128 vertices */ + vfg.List2BatchSizeScale = 1; + /* Batch size of 128 vertices */ + vfg.List1BatchSizeScale = 2; + /* Batch size of 256 vertices for STRIP topologies */ + vfg.StripBatchSizeScale = 3; + /* 192 control points for PATCHLIST_3 */ + vfg.PatchBatchSizeScale = 1; + /* 192 control points for PATCHLIST_3 */ + vfg.PatchBatchSizeMultiplier = 31; + } + } +#endif + if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS) { genX(emit_sample_pattern)(&cmd_buffer->batch, cmd_buffer->state.gfx.dynamic.sample_locations.samples, -- 2.7.4