Mesa (master): util/u_queue: Ensure num_cpu_mask_bits is valid

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 26 18:56:32 UTC 2021


Module: Mesa
Branch: master
Commit: 9fb9019bebe955ce0510799f02b0dddd6fe9efbe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fb9019bebe955ce0510799f02b0dddd6fe9efbe

Author: Rob Clark <robdclark at chromium.org>
Date:   Wed Feb 24 13:59:15 2021 -0800

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: d877451b48a ("util/u_queue: add UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY")
Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9266>

---

 src/util/u_queue.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/util/u_queue.c b/src/util/u_queue.c
index 0cf381b18aa..95642b36e36 100644
--- a/src/util/u_queue.c
+++ b/src/util/u_queue.c
@@ -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);
    }



More information about the mesa-commit mailing list