Module: Mesa Branch: main Commit: 07b57deea296375b597fcdf1fc8210fb2b6f69f9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=07b57deea296375b597fcdf1fc8210fb2b6f69f9
Author: Sviatoslav Peleshko <[email protected]> Date: Wed Feb 22 04:24:09 2023 +0200 anv: Move WA MEDIA_VFE_STATE after stalling PIPE_CONTROL Fixes: bc612536 ("anv: Emit a dummy MEDIA_VFE_STATE before switching from GPGPU to 3D") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6172 Signed-off-by: Sviatoslav Peleshko <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21472> --- src/intel/vulkan/genX_cmd_buffer.c | 53 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 27c3f6c00f4..824ee701ea5 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -6494,28 +6494,6 @@ genX(flush_pipeline_select)(struct anv_cmd_buffer *cmd_buffer, */ if (pipeline == GPGPU) anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), t); - - if (pipeline == _3D) { - /* There is a mid-object preemption workaround which requires you to - * re-emit MEDIA_VFE_STATE after switching from GPGPU to 3D. However, - * even without preemption, we have issues with geometry flickering when - * GPGPU and 3D are back-to-back and this seems to fix it. We don't - * really know why. - */ - anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_VFE_STATE), vfe) { - vfe.MaximumNumberofThreads = - devinfo->max_cs_threads * devinfo->subslice_total - 1; - vfe.NumberofURBEntries = 2; - vfe.URBEntryAllocationSize = 2; - } - - /* We just emitted a dummy MEDIA_VFE_STATE so now that packet is - * invalid. Set the compute pipeline to dirty to force a re-emit of the - * pipeline in case we get back-to-back dispatch calls with the same - * pipeline and a PIPELINE_SELECT in between. - */ - cmd_buffer->state.compute.pipeline_dirty = true; - } #endif #if GFX_VER >= 12 @@ -6571,6 +6549,37 @@ genX(flush_pipeline_select)(struct anv_cmd_buffer *cmd_buffer, #endif genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer); +#if GFX_VER == 9 + if (pipeline == _3D) { + /* There is a mid-object preemption workaround which requires you to + * re-emit MEDIA_VFE_STATE after switching from GPGPU to 3D. However, + * even without preemption, we have issues with geometry flickering when + * GPGPU and 3D are back-to-back and this seems to fix it. We don't + * really know why. + * + * Also, from the Sky Lake PRM Vol 2a, MEDIA_VFE_STATE: + * + * "A stalling PIPE_CONTROL is required before MEDIA_VFE_STATE unless + * the only bits that are changed are scoreboard related ..." + * + * This is satisfied by applying pre-PIPELINE_SELECT pipe flushes above. + */ + anv_batch_emit(&cmd_buffer->batch, GENX(MEDIA_VFE_STATE), vfe) { + vfe.MaximumNumberofThreads = + devinfo->max_cs_threads * devinfo->subslice_total - 1; + vfe.NumberofURBEntries = 2; + vfe.URBEntryAllocationSize = 2; + } + + /* We just emitted a dummy MEDIA_VFE_STATE so now that packet is + * invalid. Set the compute pipeline to dirty to force a re-emit of the + * pipeline in case we get back-to-back dispatch calls with the same + * pipeline and a PIPELINE_SELECT in between. + */ + cmd_buffer->state.compute.pipeline_dirty = true; + } +#endif + genX(emit_pipeline_select)(&cmd_buffer->batch, pipeline); #if GFX_VER == 9
