Mesa (main): radeonsi: Use util_cpu_caps to detect number of CPUs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 15 20:26:14 UTC 2021


Module: Mesa
Branch: main
Commit: 5971f29c8ffe677a2ba2eb70793378f8351dc783
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5971f29c8ffe677a2ba2eb70793378f8351dc783

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Jun  7 12:15:20 2021 -0700

radeonsi: Use util_cpu_caps to detect number of CPUs

The next patch will change the way the number of CPUs is detected, and
this change prevents some code duplication.

v2: Add missing #include.  Noticed by Pierre-Eric... not sure how I
missed it. :(

Reviewed-by: Adam Jackson <ajax at redhat.com> [v1]
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>

---

 src/gallium/drivers/radeonsi/si_pipe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index e4943add9ad..858f421e134 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -35,6 +35,7 @@
 #include "sid.h"
 #include "ac_shadowed_regs.h"
 #include "util/disk_cache.h"
+#include "util/u_cpu_detect.h"
 #include "util/u_log.h"
 #include "util/u_memory.h"
 #include "util/u_suballoc.h"
@@ -1099,7 +1100,8 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
    si_disk_cache_create(sscreen);
 
    /* Determine the number of shader compiler threads. */
-   hw_threads = sysconf(_SC_NPROCESSORS_ONLN);
+   const struct util_cpu_caps_t *caps = util_get_cpu_caps();
+   hw_threads = caps->nr_cpus;
 
    if (hw_threads >= 12) {
       num_comp_hi_threads = hw_threads * 3 / 4;



More information about the mesa-commit mailing list