Closed
Bug 882173
Opened 12 years ago
Closed 12 years ago
pixman isn't threadsafe
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: joe, Assigned: joe)
References
Details
Attachments
(3 files, 2 obsolete files)
3.24 KB,
patch
|
gps
:
review+
|
Details | Diff | Splinter Review |
1.68 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
3.71 KB,
text/plain
|
Details |
We compile pixman without TLS support, which means our pixman isn't threadsafe.
Updated•12 years ago
|
OS: Mac OS X → All
Hardware: x86 → All
![]() |
Assignee | |
Comment 1•12 years ago
|
||
Attachment #761551 -
Flags: review?(jmuizelaar)
Comment 2•12 years ago
|
||
Comment on attachment 761551 [details] [diff] [review]
support multiple threads for pixman
Review of attachment 761551 [details] [diff] [review]:
-----------------------------------------------------------------
::: configure.in
@@ +3274,5 @@
> fi
> ;;
> esac
> LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
> + AC_DEFINE(HAVE_PTHREADS)
agal won't like you changing configure. Maybe you should make the makefile do the right thing.
::: gfx/cairo/libpixman/src/pixman-compiler.h
@@ -114,1 @@
>
The pixman part needs to be upstreamable
Attachment #761551 -
Flags: review?(jmuizelaar) → review-
Comment 3•12 years ago
|
||
FWIW I don't like Makefile specific defines. It makes it much harder to get tools to work since we can't point it a mozilla-config.h or to the general -D list.
Comment 4•12 years ago
|
||
It's my understanding this has potential (negative) performance implications. Can we measure this?
![]() |
Assignee | |
Comment 5•12 years ago
|
||
Yep - I plan to do so via Talos.
![]() |
Assignee | |
Comment 6•12 years ago
|
||
Attachment #761551 -
Attachment is obsolete: true
Attachment #761625 -
Flags: review?(gps)
![]() |
Assignee | |
Comment 7•12 years ago
|
||
Attachment #761627 -
Flags: review?(jmuizelaar)
![]() |
Assignee | |
Updated•12 years ago
|
![]() |
Assignee | |
Comment 8•12 years ago
|
||
This is a test program I created to compare the performance of raw types, __declspec(thread) and TlsGetValue(). It shows that performance, as expected, goes roughly in that order, too.
Units are "whatever QueryPerformanceCounter returns".
tls: 3621
declspec: 1009
raw: 872
Comment 9•12 years ago
|
||
(In reply to Joe Drew (:JOEDREW! \o/) from comment #8)
> Created attachment 762042 [details]
> tls timing test
>
> This is a test program I created to compare the performance of raw types,
> __declspec(thread) and TlsGetValue(). It shows that performance, as
> expected, goes roughly in that order, too.
>
> Units are "whatever QueryPerformanceCounter returns".
>
> tls: 3621
> declspec: 1009
> raw: 872
An additional interesting thing to time would be calls to pixman_image_composite to get an idea of how much difference the 2800 units makes.
![]() |
Assignee | |
Comment 10•12 years ago
|
||
Doing a more meaningful test with -O2 shows
tls: 5085
declspec: 0
raw: 0
Attachment #762042 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 11•12 years ago
|
||
Composite and fill time tends to be from single digit all the way up to >= 3000, in whatever unit this is. Which is pretty good considering those 2800 unit difference are in 100,000 call increments, so the lowest composite time I saw (4 units) would mean that we're 0.7% slower.
Comment 12•12 years ago
|
||
Comment on attachment 761627 [details] [diff] [review]
turn on TLS for pixman
I'd use DLL instead of SOLIB, but otherwise this seems fine. Make sure you add a patch to the cairo dir.
Attachment #761627 -
Flags: review?(jmuizelaar) → review+
![]() |
||
Comment 13•12 years ago
|
||
Comment on attachment 761625 [details] [diff] [review]
define and subst MOZ_USE_PTHREADS when we want to use pthreads
Review of attachment 761625 [details] [diff] [review]:
-----------------------------------------------------------------
::: configure.in
@@ +3275,5 @@
> ;;
> esac
> LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
> + AC_DEFINE(MOZ_USE_PTHREADS)
> + AC_SUBST(MOZ_USE_PTHREADS)
Do you actually use the AC_DEFINE variable? AC_SUBST is what Makefile and moz.build use. Generally speaking, you should only define where usage is needed.
Attachment #761625 -
Flags: review?(gps) → review+
![]() |
Assignee | |
Comment 14•12 years ago
|
||
I don't use the AC_DEFINE variable! I'll remove it.
![]() |
Assignee | |
Comment 15•12 years ago
|
||
Comment 16•12 years ago
|
||
Just for the record : OpenBSD has pthreads, but has no pthread local storage support. That will break us badly, i'm afraid.
![]() |
Assignee | |
Comment 17•12 years ago
|
||
Landry also tells me that, not only does OpenBSD not have pthread TLS support, it has *no* TLS support, which is bad times. :(
![]() |
||
Comment 18•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/19671f660736
https://hg.mozilla.org/mozilla-central/rev/addf66960e85
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Comment 19•12 years ago
|
||
Ok, it seems it was a false alarm. Tree with that commit still builds on OpenBSD, because apparently pixman already has a fallback on OpenBSD, using pthread_setspecific instead of TLS, and we have pthread_setspecific() (dunno if that's part of what is called TLS support...)
That code was added in http://cgit.freedesktop.org/pixman/commit/pixman/pixman-compiler.h?id=7c9f121efe7ee6afafad8b294974f5498054559b - so as long as you dont try to use __thread directly, we should be fine.
You need to log in
before you can comment on or make changes to this bug.
Description
•