mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-10 11:40:20 +01:00
[xlib] Fast-path the likely case of retrieving a known xrender_format
If we know the CPU can read pointers atomically, then we can simply peek into the cached_xrender_formats to see if we already have a match, before taking the mutex. (Acquiring the mutex here is a minor nuisance that appears on the callgrind profiles.)
This commit is contained in:
parent
efb3445ee1
commit
09a2b2ed31
1 changed files with 6 additions and 0 deletions
|
|
@ -514,6 +514,12 @@ _cairo_xlib_display_get_xrender_format (cairo_xlib_display_t *display,
|
|||
{
|
||||
XRenderPictFormat *xrender_format;
|
||||
|
||||
#if ! ATOMIC_OP_NEEDS_MEMORY_BARRIER
|
||||
xrender_format = display->cached_xrender_formats[format];
|
||||
if (likely (xrender_format != NULL))
|
||||
return xrender_format;
|
||||
#endif
|
||||
|
||||
CAIRO_MUTEX_LOCK (display->mutex);
|
||||
xrender_format = display->cached_xrender_formats[format];
|
||||
if (xrender_format == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue