Closed Bug 760228 Opened 12 years ago Closed 9 years ago

Prepare for multi-threaded Xlib

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
e10s later ---

People

(Reporter: cjones, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch patch (obsolete) — Splinter Review
Several folks are using omtc for desktop dev on X11, and the current setup for XInitThreads() is annoying to work with.

If we're ever to enable omtc for x11, we also need to quantify the hit from multithreaded xlib.
Attached patch Always use XInitThreads() (obsolete) — Splinter Review
Assignee: nobody → jones.chris.g
Attachment #629034 - Flags: review?(karlt)
Attachment #628840 - Attachment is obsolete: true
When working on another patch, I noticed some code that would have been obsoleted by the v1 patch.  Removed here in v2.  Nothing else changed.

The differences in this patch wouldn't have affected the talos numbers.
Attachment #629034 - Attachment is obsolete: true
Attachment #629034 - Flags: review?(karlt)
Attachment #630486 - Flags: review?(karlt)
Comment on attachment 630486 [details] [diff] [review]
Always use XInitThreads(), v2

If we do this, then we should revert the visibility of the pref (changed in
bug 722012).  So the r- here is easy to decide based on that.

However, I doubt this benefit of a less annoying workflow for developers is
worth the extra risks.

Perhaps the main thing I don't understand here is how an environment variable
can be more annoying to work with than a pref.  Sure, the fact that
environment variables replicate into every process is unfortunate, but that
doesn't really make it annoying to use.

We know the effect on performance is negative, but we don't know whether it is
a significant cost.  Regarding the talos results:

  I'm aware that it is much harder to statistically demonstrate the lack of a
  functionally significant difference than to detect a significant difference,
  but if anything the data seems to suggest there is a difference.

  Although each result is within the margin of error, having a set of results
  that all move in the same direction may well demonstrate that there is a
  statistical difference.

Beyond that risk, there is the risk of using Xlib in a way that is not well
tested.

  One bug that I know exists is that our X11 error handler will lock up in
  XSynchronize when XInitThreads is used with default configurations of libX11
  versions 1.4.0 and 1.4.1 as well as --with-xcb configurations of version
  1.3.4.

  http://lists.x.org/archives/xorg-devel/2011-March/020409.html
  http://cgit.freedesktop.org/xorg/lib/libX11/commit/src/XlibInt.c?id=83e1ba59c48c79f8b0a7e7aa0b9c9cfd84fa403d

I think we need to find a workaround for the old(ish) libX11 bug (perhaps just
disabling something for those versions) before XInitThreads is enabled.

Beyond that, the risks seem justifiable if there is the benefit of being able
to switch on OMTC.  If there is no benefit to users then the decision is less
clear.

If OMTC is the definite future, then there is some testing value in switching
on XInitThreads.  This more than developer annoyance seems a better reason to
make the call, but we'd disable the call in release (and beta?) builds.  I
feel a bit weary of using our testers as guinea pigs with no immediate
benefit, but perhaps that's justifiable.

I wonder how well OMTC is working right now?
If it is close, then perhaps it is time to start switching things on.
I suspect it is not that close, one reason being that currently OMTC needs
OpenGL layers which AFAIK are not close on X11.
Attachment #630486 - Flags: review?(karlt) → review-
Thanks for the very thorough review and summary, Karl.  We need to work out these issues for bug 722012.

omtc works pretty well.  It's shipping in android-fennec.  It doesn't require GL layers per se, although the patch to remove that requirement was just backed out.
Blocks: 722012
Summary: Try always using multi-threaded Xlib → Prepare for multi-threaded Xlib
(In reply to Karl Tomlinson (:karlt) from comment #6)
> I wonder how well OMTC is working right now?

I meant on X11, with it possibly having some unique challenges.

> one reason being that currently OMTC needs OpenGL layers

And here too I meant with X11, but I'm pleased if the GL requirement is easily avoided.

X11 may have some unique issues to solve for OMTC, such as making ScopedXErrorHandler work across threads, but perhaps that is not necessary on the compositing thread.
omtc works well for me on X11, although I've only tested with GL compositing force-enabled.
(In reply to Karl Tomlinson (:karlt) from comment #6)
> Perhaps the main thing I don't understand here is how an environment variable
> can be more annoying to work with than a pref.

One disadvantage of environment variables may be that they don't show up in about support.
(Not working on this currently.)
Assignee: jones.chris.g → nobody
(In reply to Karl Tomlinson (:karlt) from comment #6)
>   One bug that I know exists is that our X11 error handler will lock up in
>   XSynchronize when XInitThreads is used with default configurations of
> libX11
>   versions 1.4.0 and 1.4.1 as well as --with-xcb configurations of version
>   1.3.4.

Debian squeeze (currently oldstable) has libx11-6 based on 1.3.3 and 
wheezy (stable) based on 1.5.0.

Ubuntu 12.04 LTS precise has libx11-6 based on 1.4.99.1, so the major long term support distributions have avoided this issue, and so I don't think we need to worry about this now.
Mass tracking-e10s flag change. Filter bugmail on "2be0fcce-e36a-4e2c-aa80-0e3d33eb5406".
tracking-e10s: --- → +
(In reply to AnAkkk from comment #14)
> I think this was solved by
> https://bugzilla.mozilla.org/show_bug.cgi?id=994541

Indeed.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: