Bug 95128 - [Gallium] uninitialized once_flag causes unregistered targets
Summary: [Gallium] uninitialized once_flag causes unregistered targets
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 11.2
Hardware: Other All
: medium major
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Reported: 2016-04-25 10:00 UTC by Frederic Devernay
Modified: 2016-05-30 14:14 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

patch for Mesa 11.2.0 (438 bytes, patch)
2016-04-25 10:36 UTC, Frederic Devernay
Details | Splinter Review
patch for Mesa 11.2.0 (also works for Mesa 11.1.2) (437 bytes, patch)
2016-04-25 15:38 UTC, Frederic Devernay
Details | Splinter Review

Description Frederic Devernay 2016-04-25 10:00:31 UTC
From this commit:

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.