gallium/u_threaded: fix 32-bit breakage due to incorrect pointer arithmetic

Fixes: 1233c90ab4 - gallium/u_threaded: rewrite slot layout to reduce wasted space
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4755
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4758
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10746>
This commit is contained in:
Marek Olšák
2021-05-11 06:46:26 -04:00
committed by Marge Bot
parent 989e9867a6
commit 5818380f86

View File

@@ -105,6 +105,7 @@ tc_clear_driver_thread(struct threaded_context *tc)
#define call_size(type) size_to_slots(sizeof(struct type))
#define call_size_with_slots(type, num_slots) size_to_slots( \
sizeof(struct type) + sizeof(((struct type*)NULL)->slot[0]) * (num_slots))
#define get_next_call(ptr, type) ((struct type*)((uint64_t*)ptr + call_size(type)))
/* Assign src to dst while dst is uninitialized. */
static inline void
@@ -245,10 +246,10 @@ tc_batch_execute(void *job, UNUSED int thread_index)
tc_drop_resource_reference(next->info.index.resource);
/* Find how many other draws can be merged. */
next++;
next = get_next_call(next, tc_draw_single);
for (; (uint64_t*)next != last &&
is_next_call_a_mergeable_draw(first, next);
next++, num_draws++) {
next = get_next_call(next, tc_draw_single), num_draws++) {
/* u_threaded_context stores start/count in min/max_index for single draws. */
multi[num_draws].start = next->info.min_index;
multi[num_draws].count = next->info.max_index;