i965: Call util_cpu_detect() early in screen creation
authorJordan Justen <jordan.l.justen@intel.com>
Sun, 28 Feb 2021 21:23:07 +0000 (13:23 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Mon, 1 Mar 2021 07:12:00 +0000 (23:12 -0800)
This helps to avoid this assertion in debug builds:

src/util/u_cpu_detect.h:116: util_get_cpu_caps: Assertion `util_cpu_caps.nr_cpus >= 1' failed.

Fixes: a9618e7c421 ("util: Add accessor for util_cpu_caps")
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9325>

src/mesa/drivers/dri/i965/intel_screen.c

index 5278a56..72e4f21 100644 (file)
@@ -45,6 +45,7 @@
 #include "utils.h"
 #include "util/disk_cache.h"
 #include "util/driconf.h"
+#include "util/u_cpu_detect.h"
 #include "util/u_memory.h"
 
 #include "common/gen_defines.h"
@@ -2566,6 +2567,8 @@ __DRIconfig **brw_init_screen(__DRIscreen *dri_screen)
 {
    struct brw_screen *screen;
 
+   util_cpu_detect();
+
    if (dri_screen->image.loader) {
    } else if (dri_screen->dri2.loader->base.version <= 2 ||
        dri_screen->dri2.loader->getBuffersWithFormat == NULL) {