From: Eric Anholt Date: Wed, 1 May 2013 23:08:12 +0000 (-0700) Subject: i965: Fix SNB GPU hangs when a blorp batch is the first thing to execute. X-Git-Tag: mesa-9.2.1~1377 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F6401%2F1;p=platform%2Fupstream%2Fmesa.git i965: Fix SNB GPU hangs when a blorp batch is the first thing to execute. The GPU apparently goes looking for constants even though there are no shader stages enabled, and gets stuck because we haven't told it there are no constants to collect. If any other user of the 3D pipeline had run (even the Render accel of the X server!) since power on, then the in-GPU constant buffers would have been set up with some contents we didn't use, and we would succeed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56416 Reviewed-by: Kenneth Graunke Tested-by: Dave Airlie NOTE: This is a candidate for the stable branches. --- diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp index 3e7467e..0ed5bee 100644 --- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp +++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp @@ -595,6 +595,15 @@ gen6_blorp_emit_vs_disable(struct brw_context *brw, intel_emit_post_sync_nonzero_flush(intel); } + /* Disable the push constant buffers. */ + BEGIN_BATCH(5); + OUT_BATCH(_3DSTATE_CONSTANT_VS << 16 | (5 - 2)); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + BEGIN_BATCH(6); OUT_BATCH(_3DSTATE_VS << 16 | (6 - 2)); OUT_BATCH(0); @@ -616,6 +625,15 @@ gen6_blorp_emit_gs_disable(struct brw_context *brw, { struct intel_context *intel = &brw->intel; + /* Disable all the constant buffers. */ + BEGIN_BATCH(5); + OUT_BATCH(_3DSTATE_CONSTANT_GS << 16 | (5 - 2)); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + BEGIN_BATCH(7); OUT_BATCH(_3DSTATE_GS << 16 | (7 - 2)); OUT_BATCH(0); @@ -798,6 +816,21 @@ gen6_blorp_emit_constant_ps(struct brw_context *brw, ADVANCE_BATCH(); } +static void +gen6_blorp_emit_constant_ps_disable(struct brw_context *brw, + const brw_blorp_params *params) +{ + struct intel_context *intel = &brw->intel; + + /* Disable the push constant buffers. */ + BEGIN_BATCH(5); + OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 | (5 - 2)); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); +} /** * 3DSTATE_BINDING_TABLE_POINTERS @@ -1084,6 +1117,8 @@ gen6_blorp_exec(struct intel_context *intel, gen6_blorp_emit_sf_config(brw, params); if (params->use_wm_prog) gen6_blorp_emit_constant_ps(brw, params, wm_push_const_offset); + else + gen6_blorp_emit_constant_ps_disable(brw, params); gen6_blorp_emit_wm_config(brw, params, prog_offset, prog_data); if (params->use_wm_prog) gen6_blorp_emit_binding_table_pointers(brw, params, wm_bind_bo_offset);