util/u_queue: Ensure num_cpu_mask_bits is valid

I noticed that we were hitting this before st_create_context() called
util_cpu_detect() and so num_cpu_mask_bits was zero.  But there is no
harm in calling util_cpu_detect(), so lets just call it here to be safe.

Fixes: d877451b48 ("util/u_queue: add UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9266>
This commit is contained in:
Rob Clark 2021-02-24 13:59:15 -08:00 committed by Marge Bot
parent 4ded99f99d
commit 9fb9019beb

View file

@ -262,6 +262,10 @@ util_queue_thread_func(void *input)
uint32_t mask[UTIL_MAX_CPUS / 32];
memset(mask, 0xff, sizeof(mask));
/* Ensure util_cpu_caps.num_cpu_mask_bits is initialized: */
util_cpu_detect();
util_set_current_thread_affinity(mask, NULL,
util_cpu_caps.num_cpu_mask_bits);
}