util: Change order of PIPE_OS_UNIX code in util_cpu_detect_once

This makes it easier to add preferred vs. fallback paths later.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
This commit is contained in:
Ian Romanick 2021-06-08 14:40:19 -07:00 committed by Marge Bot
parent a923e95b10
commit 1786e847d9

View file

@ -564,11 +564,12 @@ util_cpu_detect_once(void)
GetSystemInfo(&system_info);
util_cpu_caps.nr_cpus = MAX2(1, system_info.dwNumberOfProcessors);
}
#elif defined(PIPE_OS_UNIX) && defined(_SC_NPROCESSORS_ONLN)
#elif defined(PIPE_OS_UNIX)
# if defined(_SC_NPROCESSORS_ONLN)
util_cpu_caps.nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
if (util_cpu_caps.nr_cpus == ~0)
util_cpu_caps.nr_cpus = 1;
#elif defined(PIPE_OS_BSD)
# elif defined(PIPE_OS_BSD)
{
int mib[2], ncpu;
int len;
@ -580,9 +581,11 @@ util_cpu_detect_once(void)
sysctl(mib, 2, &ncpu, &len, NULL, 0);
util_cpu_caps.nr_cpus = ncpu;
}
#else
util_cpu_caps.nr_cpus = 1;
#endif
# endif
#endif /* defined(PIPE_OS_UNIX) */
if (util_cpu_caps.nr_cpus == 0)
util_cpu_caps.nr_cpus = 1;
util_cpu_caps.num_cpu_mask_bits = align(util_cpu_caps.nr_cpus, 32);