| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Fixes #776
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`_cairo_status_set_error` was using `_cairo_atomic_int_cmpxchg` to set
a `cairo_status_t` variable by casting a `cairo_status_t*` to
`cairo_atomic_int_t*`. `cairo_atomic_int` has a generic implementation
which is using a mutex. In the implementation, `cairo_atomic_int_t`
was typedef-ed to `cairo_atomic_intptr_t`. In a typical 64bit system,
cairo_atomic_intptr_t is 64bit and cairo_status_t is 32bit,
_cairo_status_set_error didn't work as expected.
Define `cairo_atomic_int_t` as an alias of `int`.
Added an assertion in `_cairo_status_set_error` to ensure
that `*err` has the same size with `cairo_atomic_int_t`.
Fixes cairo/cairo#606
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
We *always* generate this file, and we depend on its existence.
The idea behind HAVE_CONFIG_H was being able to include random files
from different projects, back in a time where "libraries" were literally
just random files instead of actual shared objects.
Since we're not in the '80s any more, and our build system(s) define
HAVE_CONFIG_H *and* generate the config.h header file, we don't need a
conditional guard around its inclusion.
|
|
|
|
| |
Windows provides atomic operation APIs so use it
|
|
|
|
| |
https://bugs.freedesktop.org/show_bug.cgi?id=103559
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes the race condition when one thread uses cairo_mask_compositor_t
pointer returned by _cairo_image_mask_compositor_get, while another one
started but has not finished it's initialisation yet
Usage:
static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT;
if (_cairo_atomic_init_once_enter(&once)) {
/* Initialization code */
_cairo_atomic_init_once_leave(&once);
}
https://bugs.freedesktop.org/show_bug.cgi?id=103037
|
|
|
|
|
|
|
|
|
|
|
| |
This adds _cairo_atomic_int_get_relaxed and _cairo_atomic_int_set_relaxed which
are meant to have a behaviour of relaxed read/writes in C11's memory model. This
patch also uses these new function to fix a data race with freed_pool_t's |top|
data member.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=90318
Signed-off-by: Wan-Teh Chang <wtc@google.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recent versions of GCC/clang feature a new set of compiler intrinsics
for performing atomic operations, motivated by the operations needed to
support the C++11 memory model. These intrinsics are more flexible than
the old __sync_* intrinstics and offer efficient support for atomic load
and store operations.
Having the load appear atomic to the compiler is particular important
for tools like ThreadSanitizer so they don't report false positives on
memory operations that we intend to be atomic.
Patch from Nathan Froyd <froydnj@mozilla.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Having spent the last dev cycle looking at how we could specialize the
compositors for various backends, we once again look for the
commonalities in order to reduce the duplication. In part this is
motivated by the idea that spans is a good interface for both the
existent GL backend and pixman, and so they deserve a dedicated
compositor. xcb/xlib target an identical rendering system and so they
should be using the same compositor, and it should be possible to run
that same compositor locally against pixman to generate reference tests.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
P.S. This brings massive upheaval (read breakage) I've tried delaying in
order to fix as many things as possible but now this one patch does far,
far, far too much. Apologies in advance for breaking your favourite
backend, but trust me in that the end result will be much better. :)
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Note Andrea's copyright for his contribution of platform agnostic
fallbacks and the implementation for MacOS/X.
|
|
|
|
| |
Missing definition of _cairo_atomic_ptr_get() used in the fallbacks.
|
|
|
|
|
|
|
| |
Enable atomic operation on MacOS X, using the functions provided by
libkern/OSAtomic.h
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some implementations only offer one version of compare-and-exchange,
thus we expose both through cairo-atomic, implementing what is missing
through appropriate fallbacks.
*_cmpxchg() now return a boolean (this unbreaks _cairo_atomic_uint_cmpxchg)
*_cmpxchg_return_old() return the old value
Code is updated everywhere to reflect this, by using *_cmpxchg()
wherever the returned value was only tested to check if the exchange
had really taken place.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
| |
_cairo_atomic_int_set() was only used in the definition of
CAIRO_REFERENCE_SET_VALUE, which was never used.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
|
|
|
|
| |
I updated the Free Software Foundation address using the following script.
for i in $(git grep Temple | cut -d: -f1 )
do
sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
|
| |
|
|
|
|
|
|
| |
AO_compare_and_swap_full() doesn't have the same semantic as
_cairo_atomic_int_cmpxchg(). The former returns a TRUE on success
FALSE otherwise while the later returns the atomic value.
|
|
|
|
|
| |
Use libatomic-ops-dev in preference to mutex-based atomics, if we do not
have the builtin atomic intrinsics available.
|
|
|
|
| |
Explain where the weird SIZEOF_VOID__ comes from.
|
|
|
|
|
|
| |
The autoconf shipping with OpenBSD 4.5 converts sizeof(void*)
to SIZEOF_VOID__ rather than SIZEOF_VOID_P. Work around that
by defining SIZEOF_VOID_P if required.
|
|
|
|
|
|
| |
Evaulate the integer sizes during configure to find one of the exact same
size as a void* to use in the conversion of the atomic ptr cmpxchg to an
atomic int cmpxchg.
|
|
|
|
|
|
|
|
|
|
|
| |
Fix an implicit pointer/integer cast in _cairo_atomic_ptr_cmpxchg()
when building with LLVM/clang.
The Intel synchronization primitives __sync_val_compare_and_swap()
are only defined by Intel for types int, long, long long and their
unsigned variants. This patch uses one of those for
_cairo_atomic_ptr_cmpxchg() instead of relying on a gcc extension of
__sync_val_compare_and_swap() to pointer types.
|
|
|
|
|
| |
Add uint variants of _cairo_atomic_int_*() to hide the compiler warnings
about sign conversions.
|
|
|
|
| |
To handle those CPUs where we do not have an atomic cmpxchg.
|
|
|
|
|
|
| |
Also cache recently freed surface and gradient patterns. With thanks to
Jonathan Morton for the inspiration and initial pointer pool code for
pixman.
|
|
|
|
|
| |
This is more robust to cases where people want to assign 0 to those variables.
(win32/alternate build systems, etc)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The macros CAIRO_BEGIN_DECLS and CAIRO_END_DECLS are declared in two
places: config.h and cairo.h. On Win32 build there is no config.h. So,
we can't rely on pulling CAIRO_BEGIN_DECLS from there. Hence, we now:
* Not add those declarations to config.h anymore,
* Test that every cairo private header includes some other cairo
header before any other includes.
These two are fairly enough to ensure that cairo.h is seen from all
private headers. There's still the case of headers not including
any header file at all. I'll fix that later.
|
| |
|
|
|
|
|
|
| |
Add a configure check to determine whether the host cpu can read/write
cairo_atomic_t without an explicit memory barrier, and update the macros
within cairo-atomic-private.h to reflect this knowledge.
|
|
|
|
|
|
|
| |
gcc treats cairo_status_t as an unsigned integer and so generates a
warning when passing it address as signed integer pointer to
_cairo_atomic_int_cmpxchg(). Use an ugly cast to hide the warning and
similarly to hide the warning about the unused result.
|
|
|
|
|
|
|
|
| |
Since the objects can be shared and may be in use simultaneously across
multiple threads, setting the status needs to be atomic. We use a
locked compare and exchange in order to avoid overwriting an existing
error - that is we use an atomic operation that only sets the new status
value if the current value is CAIRO_STATUS_SUCCESS.
|
|
Test for the availability of the Intel __sync_* atomic primitives and
use them to define a few operations useful for reference counting -
providing a generic interface that may be targeted at more architectures
in the future. If no atomic primitives are available, use a mutex based
variant. If the contention on that mutex is too high, we can consider
using an array of mutexes using the address of the atomic variable as
the hash.
|