iris: Fix broken aux.possible/sampler_usages bitmask handling
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 20 Aug 2019 05:36:36 +0000 (22:36 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 23 Aug 2019 01:31:14 +0000 (18:31 -0700)
commit117a0368b0cc741aec88d2538ffdebd26618a6fb
tree2a196003f83b960247d16d19eb6f35b9d2b1c81e
parentf6c44549ee2dd0f218deea1feba3965523609406
iris: Fix broken aux.possible/sampler_usages bitmask handling

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: 7339660e803 ("iris: Add aux.sampler_usages.")
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
src/gallium/drivers/iris/iris_state.c