From: Mike Blumenkrantz Date: Wed, 12 Oct 2022 15:51:14 +0000 (-0400) Subject: zink: fix pool overflow handling on batch reset X-Git-Tag: upstream/22.3.5~1720 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=340cfa1001eabb81812ad4c311c75e7279d3feb3;p=platform%2Fupstream%2Fmesa.git zink: fix pool overflow handling on batch reset this mechanism worked off the previous iteration of descriptor updating, in which pools were stored in a set to the batch state and could be iterated normally now, however, they're stored as a sparse array, and so the dynarray util for getting the number of elements cannot be used instead, use the calculated size for the array like every other accessor for the pools to ensure correct indexing Part-of: --- diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index 5ac4df5..1d3aaa5 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -994,8 +994,7 @@ zink_batch_descriptor_reset(struct zink_screen *screen, struct zink_batch_state { for (unsigned i = 0; i < ZINK_DESCRIPTOR_TYPES; i++) { struct zink_descriptor_pool_multi **mpools = bs->dd.pools[i].data; - unsigned count = util_dynarray_num_elements(&bs->dd.pools[i], struct zink_descriptor_pool_multi *); - for (unsigned j = 0; j < count; j++) { + for (unsigned j = 0; j < bs->dd.pool_size[i]; j++) { struct zink_descriptor_pool_multi *mpool = mpools[j]; if (!mpool) continue;