iris: Update fast clear colors on Gen9 with direct immediate writes

Graphics / Mesa 3D Graphics Library / Mesa - Kenneth Graunke [] - 23 August 2019 01:31 EDT

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")

1cd13ccee7b iris: Update fast clear colors on Gen9 with direct immediate writes.
src/gallium/drivers/iris/iris_resource.c | 4 +---
src/gallium/drivers/iris/iris_state.c | 31 +++++++++++++++++++++++++------
2 files changed, 26 insertions(+), 9 deletions(-)


  • Share