Skip to content
  • Kenneth Graunke's avatar
    iris: Fix broken aux.possible/sampler_usages bitmask handling · 14588c07
    Kenneth Graunke authored and Dylan Baker's avatar Dylan Baker committed
    For renderable surfaces, we allocate SURFACE_STATEs for each bit in
    res->aux.possible_usages.  Sampler views use res->aux.sampler_usages.
    
    When pinning buffers, we call surf_state_offset_for_aux() to calculate
    the offset to the desired surface state.  surf_state_offset_for_aux()
    took an aux_modes parameter, which should be one of those two fields.
    However...it was not using that parameter.  It always used the broader
    res->aux.possible_usages field directly.
    
    One of the callers, update_clear_value(), was passing incorrect masks
    for this parameter.  It iterated through the bits in order, using
    u_bit_scan(), which destructively modifies the mask.  So each time we
    called it, the count of bits before our selected mode was 0, which would
    cause us to always update the SURFACE_STATE for ISL_AUX_USAGE_NONE,
    rather than updating each in turn.  This was hidden by the earlier bug
    where surf_state_offset_for_aux() ignored the parameter.
    
    Fixes: 7339660e
    
     ("iris: Add aux.sampler_usages.")
    Reviewed-by: default avatarRafael Antognolli <rafael.antognolli@intel.com>
    (cherry picked from commit 117a0368)
    14588c07