Bug 15994 - Xft does not have any locking around global data
Summary: Xft does not have any locking around global data
Status: RESOLVED INVALID
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xft (show other bugs)
Version: unspecified
Hardware: All All
: medium major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard: 2011BRB_Reviewed
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-17 12:53 UTC by Damian Dixon
Modified: 2018-06-12 19:10 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Damian Dixon 2008-05-17 12:53:56 UTC
The global cache does not have any thread locking.

Not sure if the lower level libraries also have similar problems.
Comment 1 Damian Dixon 2008-09-03 13:22:20 UTC
I am looking at doing a patch for this. However I am not too sure what would be acceptable.

I am proposing to use the macro's contained in the X11 headers and the X11 global mutex, so that the library will end up using the X11 thread support.

I'm not particularly happy with this as this could cause a bottle-neck elsewhere in the X11 libraries.

I would prefer that each and every library have their own mutex for the library data access however I can't see anyway of configuring a mutex via the X11 initialisation of threads. Any suggestions?

The reason I am interested in this is that I want TTF support but my applications are very heavily threaded (15 plus threads all using X11 via different Display connections). As many tool kits use Xft I have no way of coordinating 3rd party use of Xft in a thread safe way. As such my only choice is to push the thread problems into Xft.

Thanks
Damian
Comment 2 Jeremy Huddleston Sequoia 2011-10-03 00:43:50 UTC
Did you ever get around to a patch Damian?
Comment 3 Damian Dixon 2011-10-03 23:08:53 UTC
I never got around to doing a patch.

The libraries below Xft such as freetype are not thread safe when used in the way that Xft uses them. You need to open the freetype library for each thread. So it all started to get a bit too complex.

It was therefore simpler to take a mutex when I needed to use Xft.

It's not the optimal approach. Ideally I would prefer to store the thread data on the Display connection and avoid locking. I just don't know how to do this.

This is also not the correct approach as all users of Xft in a process need to lock/unlock the same mutex. This means that interactions between my SDK and say Motif/Qt become a problem for a developer as there is no defined way of ensuring thread safety with Xft text drawing.
Comment 4 Adam Jackson 2018-06-12 19:10:20 UTC
Mass closure: This bug has been untouched for more than six years, and is not
obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current releases.


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.