From b8842bc3128a255677a1a8ea5207df46f8e54a04 Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Thu, 1 Aug 2019 13:57:14 +0300 Subject: [PATCH] i965: Emit a dummy MEDIA_VFE_STATE before switching from GPGPU to 3D There is an object-level preemption workaround which requires this. However, even without object-level preemption, we seem to have issues with geometry flickering when 3D and compute are combined in the same batch and this appears to fix it. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110395 Suggested-by: Jason Ekstrand Signed-off-by: Danylo Piliaiev Reviewed-by: Kenneth Graunke Cc: mesa-stable@lists.freedesktop.org --- src/mesa/drivers/dri/i965/brw_misc_state.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index b752294250e..e73cadc5d3e 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -493,6 +493,27 @@ brw_emit_select_pipeline(struct brw_context *brw, enum brw_pipeline pipeline) } } + if (devinfo->gen == 9 && pipeline == BRW_RENDER_PIPELINE) { + /* We seem to have issues with geometry flickering when 3D and compute + * are combined in the same batch and this appears to fix it. + */ + const uint32_t subslices = MAX2(brw->screen->subslice_total, 1); + const uint32_t maxNumberofThreads = + devinfo->max_cs_threads * subslices - 1; + + BEGIN_BATCH(9); + OUT_BATCH(MEDIA_VFE_STATE << 16 | (9 - 2)); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(2 << 8 | maxNumberofThreads << 16); + OUT_BATCH(0); + OUT_BATCH(2 << 16); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } + if (devinfo->gen >= 6) { /* From "BXML » GT » MI » vol1a GPU Overview » [Instruction] * PIPELINE_SELECT [DevBWR+]": -- 2.30.2