Skip to content
  • Kenneth Graunke's avatar
    iris: Update fast clear colors on Gen9 with direct immediate writes. · 1be5f26c
    Kenneth Graunke authored and Dylan Baker's avatar Dylan Baker committed
    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: 53c484ba
    
     ("iris: blorp using resolve hooks")
    Reviewed-by: default avatarRafael Antognolli <rafael.antognolli@intel.com>
    (cherry picked from commit 1cd13cce)
    1be5f26c