i965: Implement proper workaround for Gen4 GPU CONSTANT_BUFFER hangs.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 13 Apr 2015 01:39:07 +0000 (18:39 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 14 Apr 2015 08:49:00 +0000 (01:49 -0700)
commitf55ded764ce60f87463e33bfa3a32e2c44715581
tree2a2063dfcace5968192d493f3241ab7d3a268e8c
parent21d29124a719bdaf5794859a4a7441cc6be33df7
i965: Implement proper workaround for Gen4 GPU CONSTANT_BUFFER hangs.

I finally managed to dig up some information on our mysterious GPU hangs.
A wiki page from the Crestline validation team mentions that they found
a GPU hang in "Serious Sam 2" (on Windows) with remarkably similar
conditions to the ones we've seen in Google Chrome and glmark2.

Apparently, if WM_STATE has "PS Use Source Depth" enabled, CC_STATE has
most depth state disabled, and you issue a CONSTANT_BUFFER command and
immediately draw, the depth interpolator makes a small mistake that
leads to hangs.

Most of the traces I looked at contained a CONSTANT_BUFFER packet
immediately followed by 3DPRIMITIVE, or at least very few packets.
It appears they also have "PS Use Source Depth" enabled - either at the
hang, or a little before it.  So I think this is our bug.

The workaround is to emit a non-pipelined state packet after issuing a
CONSTANT_BUFFER packet.  This is really similar to the workaround I
developed in commit c4fd0c9052dd391d6f2e9bb8e6da209dfc7ef35b.

v2: Fix word-wrapping issues.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_curbe.c