diff options
author | Kenneth Graunke <[email protected]> | 2019-08-19 22:36:36 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-08-22 18:31:14 -0700 |
commit | 117a0368b0cc741aec88d2538ffdebd26618a6fb (patch) | |
tree | 2a196003f83b960247d16d19eb6f35b9d2b1c81e /src/gallium/drivers | |
parent | f6c44549ee2dd0f218deea1feba3965523609406 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index f22d5df144f..baa67bcb770 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3999,7 +3999,7 @@ surf_state_offset_for_aux(struct iris_resource *res, enum isl_aux_usage aux_usage) { return SURFACE_STATE_ALIGNMENT * - util_bitcount(res->aux.possible_usages & ((1 << aux_usage) - 1)); + util_bitcount(aux_modes & ((1 << aux_usage) - 1)); } static void @@ -4029,10 +4029,11 @@ update_clear_value(struct iris_context *ice, struct iris_batch *batch, struct iris_resource *res, struct iris_state_ref *state, - unsigned aux_modes, + unsigned all_aux_modes, struct isl_view *view) { UNUSED struct isl_device *isl_dev = &batch->screen->isl_dev; + UNUSED unsigned aux_modes = all_aux_modes; /* We only need to update the clear color in the surface state for gen8 and * gen9. Newer gens can read it directly from the clear color state buffer. @@ -4044,14 +4045,14 @@ update_clear_value(struct iris_context *ice, while (aux_modes) { enum isl_aux_usage aux_usage = u_bit_scan(&aux_modes); - surf_state_update_clear_value(batch, res, state, aux_modes, aux_usage); + surf_state_update_clear_value(batch, res, state, all_aux_modes, + aux_usage); } #elif GEN_GEN == 8 pipe_resource_reference(&state->res, NULL); void *map = alloc_surface_states(ice->state.surface_uploader, - state, res->aux.possible_usages); - + state, all_aux_modes); while (aux_modes) { enum isl_aux_usage aux_usage = u_bit_scan(&aux_modes); fill_surface_state(isl_dev, map, res, &res->surf, view, aux_usage, 0, 0); |