From 6222be278c4c2ab65b5a0df209e097cfdb4aafec Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 14 Sep 2021 16:59:03 +1000 Subject: crocus/gen7: add missing IVB/GT2 geom shader workaround. Noticed this in passing. Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7") Part-of: (cherry picked from commit 4149a60209ddd91f52e35318d58831e3196dd67f) --- .pick_status.json | 2 +- src/gallium/drivers/crocus/crocus_context.h | 2 ++ src/gallium/drivers/crocus/crocus_state.c | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 2b9659a6f91..8bb56874265 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -724,7 +724,7 @@ "description": "crocus/gen7: add missing IVB/GT2 geom shader workaround.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f3630548f1da904ec6c63b43ece7e68afdb8867e" }, diff --git a/src/gallium/drivers/crocus/crocus_context.h b/src/gallium/drivers/crocus/crocus_context.h index a907af36665..4249af904f8 100644 --- a/src/gallium/drivers/crocus/crocus_context.h +++ b/src/gallium/drivers/crocus/crocus_context.h @@ -625,6 +625,8 @@ struct crocus_context { struct crocus_shader_state shaders[MESA_SHADER_STAGES]; + /* track if geom shader is active for IVB GT2 workaround */ + bool gs_enabled; /** Do vertex shader uses shader draw parameters ? */ bool vs_uses_draw_params; bool vs_uses_derived_draw_params; diff --git a/src/gallium/drivers/crocus/crocus_state.c b/src/gallium/drivers/crocus/crocus_state.c index 1df647d81c4..9dbe0a49e2d 100644 --- a/src/gallium/drivers/crocus/crocus_state.c +++ b/src/gallium/drivers/crocus/crocus_state.c @@ -6789,6 +6789,22 @@ crocus_upload_dirty_render_state(struct crocus_context *ice, emit_push_constant_packets(ice, batch, MESA_SHADER_GEOMETRY, &push_bos); #endif +#if GFX_VERx10 == 70 + /** + * From Graphics BSpec: 3D-Media-GPGPU Engine > 3D Pipeline Stages > + * Geometry > Geometry Shader > State: + * + * "Note: Because of corruption in IVB:GT2, software needs to flush the + * whole fixed function pipeline when the GS enable changes value in + * the 3DSTATE_GS." + * + * The hardware architects have clarified that in this context "flush the + * whole fixed function pipeline" means to emit a PIPE_CONTROL with the "CS + * Stall" bit set. + */ + if (batch->screen->devinfo.gt == 2 && ice->state.gs_enabled != active) + gen7_emit_cs_stall_flush(batch); +#endif #if GFX_VER >= 6 crocus_emit_cmd(batch, GENX(3DSTATE_GS), gs) #else @@ -6934,6 +6950,7 @@ crocus_upload_dirty_render_state(struct crocus_context *ice, gs.MaximumVPIndex = ice->state.num_viewports - 1; #endif } + ice->state.gs_enabled = active; } #if GFX_VER >= 7 -- cgit v1.2.3