iris: Update fast clear colors on Gen9 with direct immediate writes.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 19 Aug 2019 20:57:46 +0000 (13:57 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 23 Aug 2019 01:31:14 +0000 (18:31 -0700)
commit1cd13ccee7bc2733e7a56284dc02bdb1b1c40081
treed8295de783ece0955a3e8456dcad6248ed959b70
parent117a0368b0cc741aec88d2538ffdebd26618a6fb
iris: Update fast clear colors on Gen9 with direct immediate writes.

Gen11 stores the fast clear color in an "indirect clear buffer", as
a packed pixel value.  Gen9 hardware stores it as a float or integer
value, which is interpreted via the format.  We were trying to store
that in a buffer, for similarity with Icelake, and MI_COPY_MEM_MEM
it from there to the actual SURFACE_STATE bytes where it's stored.

This unfortunately doesn't work for blorp_copy(), which does bit-for-bit
copies, and overrides the format to a CCS-compatible UINT format.  This
causes the clear color to be interpreted in the overridden format.

Normally, we provide the clear color on the CPU, and blorp_blit.c:2611
converts it to a packed pixel value in the original format, then unpacks
it in the overridden format, so the clear color we use expands to the
bits we originally desired.

However, BLORP doesn't support this pack/unpack with an indirect clear
buffer, as it would need to do the math on the GPU.  On Gen11+, it isn't
necessary, as the hardware does the right thing.

This patch changes Gen9 to stop using an indirect clear buffer and
simply do PIPE_CONTROLs with post-sync write immediate operations
to store the new color over the surface states for regular drawing.
BLORP continues streaming out surface states, and handles fast clear
colors on the CPU.

Fixes: 53c484ba8ac ("iris: blorp using resolve hooks")
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_state.c