Bug 95128

Summary: [Gallium] uninitialized once_flag causes unregistered targets
Product: Mesa Reporter: Frederic Devernay <frederic.devernay>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: major    
Priority: medium CC: frederic.devernay, tstellar
Version: 11.2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch for Mesa 11.2.0
patch for Mesa 11.2.0 (also works for Mesa 11.1.2)

Description Frederic Devernay 2016-04-25 10:00:31 UTC
From this commit:
https://cgit.freedesktop.org/mesa/mesa/commit/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp?id=76cfd6f1da3748effb480e4f1151910af59fb88a

there is the line
static once_flag init_native_targets_once_flag;

where the once_flag is not initialized. This causes pthread_once() to never call the function on some OSs (I got the bug with OSX 10.6, but not with OSX 10.11).

once_flags should *always* be initialized, as in:
static once_flag init_native_targets_once_flag = ONCE_FLAG_INIT;


The consequence is that I get errors like
"Unable to find target for this triple (no targets are registered)"
when using llvmpipe

I checked other places in Mesa that use once_flag, they are all initialized correctly.
Comment 1 Frederic Devernay 2016-04-25 10:36:54 UTC
Created attachment 123238 [details] [review]
patch for Mesa 11.2.0
Comment 2 Frederic Devernay 2016-04-25 15:38:20 UTC
Created attachment 123245 [details] [review]
patch for Mesa 11.2.0 (also works for Mesa 11.1.2)
Comment 3 Marek Olšák 2016-05-30 14:14:31 UTC
Pushed to master as cee459d84de7533d0e0a74a37f7fc4c0f2b77bcf. Closing.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.