Commit graph

7002 commits

Author SHA1 Message Date
Chris Wilson
867c88ae90 [script] Add a finish method to the interpreter
When using fonts circular references are established between the holdover
font caches and the interpreter which need manual intervention via
cairo_script_interpreter_finish() to break.
2009-06-06 12:59:39 +01:00
Chris Wilson
098822d7ee [script] Fix erroneous error return when rendering type3 glyphs
Only return a USER_FONT_ERROR if an error occurs whilst rendering the
glyph!
2009-06-06 10:35:19 +01:00
Chris Wilson
24e51dd2ee [atomic] Hide compiler warnings
Add uint variants of _cairo_atomic_int_*() to hide the compiler warnings
about sign conversions.
2009-06-05 18:35:52 +01:00
Chris Wilson
4ae5e2d445 [atomic] Provide mutex-based ptr cmpxchg
To handle those CPUs where we do not have an atomic cmpxchg.
2009-06-05 18:29:40 +01:00
Thomas Jaeger
a1d0a06b62 xlib, xcb: Hand off EXTEND_PAD/EXTEND_REFLECT to Render
Most drivers and the X server used to have incorrect RepeatPad/RepeatReflect
implementations, forcing cairo to fall back to client-side software rendering,
which is painfully slow due to pixmaps being transfered over the wire.  These
issues are mostly fixed in the drivers (with the exception of radeonhd, whose
developers didn't respond) and the RepeatPad software fallback is implemented
correctly as of pixman-0.15.0, so this patch will hand off composite operations
with EXTEND_PAD/EXTEND_REFLECT source patterns to XRender.

There is no way to detect whether the X server or the drivers use a
broken Render implementation, we make a guess based on the server
version:  It's probably safe to assume that 1.7 X servers will use
fixed drivers and a recent enough version of pixman.
2009-06-05 17:26:09 +01:00
Chris Wilson
60aefd0d63 [configure] Bump pixman dependency.
Reflect was only fixed in the 0.15 series, so require at least that
version of pixman so we can that advantage of that and drop our
workaround.
2009-06-05 07:32:44 +01:00
Chris Wilson
9d7a7e76b8 [scaled-font] Close race from 16d128
Whilst waiting for the fontmap lock on destruction another thread may not
only have resurrected the font but also destroyed it acquired the lock
first and inserted into the holdovers before the first thread resumes. So
check that the font is not already in the holdovers array before
inserting.
2009-06-05 07:32:44 +01:00
Chris Wilson
f4d9a4482f [pattern] Generalise the freed pattern pool
Also cache recently freed surface and gradient patterns. With thanks to
Jonathan Morton for the inspiration and initial pointer pool code for
pixman.
2009-06-05 07:32:07 +01:00
Chris Wilson
132f44dce1 valgrindify init/fini routines
Annotate object init/fini routines to detect use-after-free for
on-stack/embedded objects.
2009-06-04 14:17:43 +01:00
Chris Wilson
e89828c533 [freelist] valgrindify freed blocks
Mark freed blocks as unaccessible upon free() and then as undefined
on alloc().
2009-06-04 12:50:39 +01:00
Chris Wilson
4e11d56f8e [perf] Update trace summary after each iteration
Running the macro-benchmarks takes so long, feedback is important.
2009-06-04 11:16:48 +01:00
Chris Wilson
5c2e73e74c [perf] Enable traces to be interrupted
Waiting for a long running benchmark can be very annoying, especially if
you just want a rough-and-ready result. So hook into SIGINT and stop the
current benchmark (after the end of the iteration) on the first ^C. A
second ^C within the same iteration will kill the program as before.
2009-06-04 10:03:45 +01:00
Chris Wilson
2eaced2447 [perf] Reconstruct interpreter for each run
Destroy the interpreter after each run of a trace so that we collect any
left-over garbage.
2009-06-03 21:49:17 +01:00
Chris Wilson
1b92ea250f [ft] Don't call FT_Done_Face() on a face we do not own
_font_map_release_face_lock_held() was being called unconditionally during
_cairo_ft_font_reset_static_data(). This presents two problems. The first
is that we call FT_Done_Face() on an object not owned by cairo, and the
second is that the bookkeeping is then incorrect which will trigger an
assert later.
2009-06-03 20:34:01 +01:00
Chris Wilson
8e5295979f [pattern] Typo in document
Remove extraneous markup from program-listing.

https://bugs.freedesktop.org/show_bug.cgi?id=20441
2009-06-03 20:17:59 +01:00
Chris Wilson
fa5d6c7afd [trace] Add a --profile mode
To save typing when creating macro-benchmarks --profile disables
mark-dirty and caller-info and compresses the trace using LZMA. Not for
computers short on memory!
2009-06-03 19:29:19 +01:00
Chris Wilson
9451f0b983 [perf] Drop ticks from trace benchmarks
Don't report the tick values for the macro-benchmarks as these are so
large as to be meaningless.
2009-06-03 13:26:52 +01:00
Chris Wilson
c988dc3719 [cairo] Doc typo.
Fix conflicting sentence as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20183
2009-06-03 10:51:23 +01:00
Chris Wilson
35d0dd00c9 [image] Doc typo.
Correct parameter reference as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20182
2009-06-03 10:49:16 +01:00
Chris Wilson
58459ac643 [font-options] Doc typo
Remove duplicate 'with' as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20180
2009-06-03 10:45:51 +01:00
Chris Wilson
8d39dee8e2 [cairo] Update documentation for bug 20154
Several typographical errors were pointed out in
https://bugs.freedesktop.org/show_bug.cgi?id=20154
2009-06-03 10:40:38 +01:00
Chris Wilson
73469e693c [cairo] Tweak error strings.
Rewrite a few error strings so that they more closer match the
documentation. Where they differ, I believe I have chosen the more
informative combination of the two texts.
2009-06-03 09:51:52 +01:00
Andrew Lavin
ab86662ab4 [test] Compile fix for invalid-matrix
Fixed test compile error on OS X that caused fenv.h not to be included.
2009-06-03 09:19:26 +01:00
Chris Wilson
eec5476484 [perf] s/git/anongit/
Third time lucky?
2009-06-03 08:57:15 +01:00
Chris Wilson
ce7e633942 [perf] Warn if no traces were found 2009-06-02 21:59:07 +01:00
Chris Wilson
f0366f0f32 [perf] Update to point to new toplevel cairo-traces repo 2009-06-02 21:48:26 +01:00
Chris Wilson
c9cd2f9ca1 [cairo] PLT symbols for cairo_set_source_rgb
Added a private use in user-font, but forgot to add a hidden symbol.
2009-06-02 18:47:07 +01:00
Chris Wilson
21550a7530 [user-font] Set the initial colour to white
An issue occured when using subpixel antialiasing with user-fonts and
XRender - the glyphs were transparent, as demonstrated by the font-view
example.

The problem lies in that enabling subpixel antialiasing triggers use of an
ARGB32 image surface for rendering the glyph, but the default colour is
black (so the only information is in the alpha-channel). Given an ARGB32
glyph XRender treats it as a per-channel mask, but since the R,G,B
channels were uniformly zero, the glyph is rendered as transparent.

Fix this by setting the initial colour to white before rendering the image
surface for a user-font glyph, which generates the appropiate gray-level
mask by default.
2009-06-02 18:16:52 +01:00
Chris Wilson
b5799e073e [xlib] Use bswap_32
Byteswap the ARGB32 glyphs using bswap_32 instead of open-coding.
2009-06-02 18:16:52 +01:00
Chris Wilson
56e9765f82 [util] Add font-view
A C variant of Behdad's python example font viewer.
2009-06-02 18:16:48 +01:00
Chris Wilson
d331dda480 [perf] Missing ')' in output 2009-06-02 15:41:19 +01:00
Adrian Johnson
c9ddaf8e7f PDF: Don't embed the same pattern more than once
The PDF surface now keeps track of all the patterns it is embedding in
a hash table keyed by the unique_id returned by the
_cairo_surface_get_unique_id().
2009-06-02 15:13:48 +01:00
Paolo Bonzini
f7613eeece Add more surface snapshots providers
This patch adds more implementation of the snapshot method.  For
surface types where acquire_source_image is already making a copy
of the bits, doing another one as is the case for the fallback
implementation is a waste.
2009-06-02 15:13:48 +01:00
Chris Wilson
cffb398f5a Add a generic cow-snapshotting framework
Provide a mechanism for backends to attach and remove snapshots. This can
be used by backends to provide a cache for _cairo_surface_clone_similar(),
or by the meta-surfaces to only emit a single pattern for each unique
snapshot.

In order to prevent stale data being returned upon a snapshot operation,
if the surface is modified (via the 5 high level operations, and on
notification of external modification) we break the association with any
current snapshot of the surface and thus preserve the current data for
their use.
2009-06-02 15:13:47 +01:00
Chris Wilson
7ed050fd43 [perf] Benchmark traces
Add a variant of cairo-perf that measures the time to replay traces.
2009-06-02 15:13:47 +01:00
Chris Wilson
403f780b29 [perf] Add a verbose flag for summary output with raw
Use 'cairo-perf -v -r' to have both the summary output along with the raw
values. This gives a progress report whilst benchmarking, very reassuring
with long running tests.
2009-06-02 15:13:47 +01:00
Chris Wilson
70fd2bbce3 [perf] Exclude similar testing by default
There are synchronisation issues with similar surfaces (as only the
original target surface is synced) which interferes with making
performance comparisons. (There still maybe some value should you be aware
of the limitations...)
2009-06-02 15:13:47 +01:00
Chris Wilson
bc49cb377c [perf] Benchmark mixing different masks and sources 2009-06-02 15:13:47 +01:00
Chris Wilson
4aca84ddb2 [perf] Add a pure glyphs performance metric
Use the new API Behdad exposed in 1.8 to precompute a glyph string using
Cairo and then benchmark cairo_show_glyphs(). This is then equivalent to
the text benchmark but without the extra step of converting to glyphs on
every call to cairo_show_text() i.e. it shows the underlying glyph
rendering performance.
2009-06-02 15:13:46 +01:00
Chris Wilson
55f4e0e4e8 [perf] Change seperators from '-' to '.'
This allows the perf tests to use '-' in the name which is easier to read
and differentiates with using '_' to separate source and operators.
2009-06-02 15:13:46 +01:00
Chris Wilson
b7c03d4e40 [ps] Trivial warning fix. 2009-06-02 15:13:46 +01:00
Chris Wilson
99482b17a5 [script] Improve caching of glyph advance
The glyph advance cache was only enabled for glyph indices < 256,
causing a large number of misses for non-ASCII text. Improve this by
simply applying the modulus of the index to select the cache slot - which
may cause some glyph advances to be overwritten and re-queried, but
improves the hit rate.
2009-06-02 15:13:46 +01:00
Chris Wilson
51193f1610 [pattern] Pass flags to _cairo_pattern_acquire_surface()
Allow the caller to choose whether or not various conversions take place.
The first flag is used to disable the expansion of reflected patterns into a
repeating surface.
2009-06-02 15:13:45 +01:00
Chris Wilson
4ec451a2fa [scaled-font] Cache repeated glyphs during probing device_extents
Maintain a local on-stack cache of recently queried glyphs to avoid
relatively expensive hash table queries.
2009-06-02 15:13:45 +01:00
Chris Wilson
ec22ae5b1d [scaled-font] Compare most recently used font directly
Avoid the relatively expensive _cairo_scaled_font_init_key() operation
when checking against the most recently used font.
2009-06-02 15:13:45 +01:00
Chris Wilson
16d128c15e [scaled-font] Lazily acquire the font_map_lock on font destruction.
We can defer taking the cairo_scaled_font_map_lock until we drop the
last reference to the scaled font so long as we double check the reference
count after waiting for the lock and not making assumptions about
unreferenced fonts during construction. This is significant as even
acquiring the uncontended cairo_scaled_font_map_lock during
cairo_scaled_font_destroy() was showing up as a couple of percent on text
heavy profiles (e.g. gnome-terminal).
2009-06-02 15:13:44 +01:00
Chris Wilson
dc083ab30a [cairo] Track the MRU scaled font
When observing applications two patterns emerge. The first is due to
Pango, which wraps each glyph run within a context save/restore. This
causes the scaled font to be evicted after every run and reloaded on the
next. This is caught by the MRU slot on the cairo_scaled_font_map and
prevents a relatively costly traversal of the hash table and holdovers.

The second pattern is by applications that directly manage the rendering
of their own glyphs. The prime example of this is gnome-terminal/vte. Here
the application frequently alternates between a few scaled fonts - which
requires a hash table retrieval every time.

By introducing a MRU slot on the gstate we are able to directly recover
the scaled font around 90% of the time.

Of 110,000 set-scaled-fonts:
  4,000 were setting the current font
 96,000 were setting to the previous font
  2,500 were recovered from the MRU on the cairo_scaled_font_map
  7,500 needed a hash retrieval
which compares to ~106,000 hash lookups without the additional MRU slot on
the gstate.

This translates to an elapsed time saving of ~5% when replaying a
gnome-terminal trace using the drm backend.
2009-06-02 15:13:44 +01:00
Chris Wilson
fda89c56ff Markup a few more functions as const/pure 2009-06-02 15:13:44 +01:00
Chris Wilson
e05097c604 [surface] Assign a unique id to the surface.
Allocate an ever-increasing, non-zero, unique identifier to each surface.
True for the first 4-billion...
2009-06-01 18:04:14 +01:00
Chris Wilson
45835f623f [cache] Expose init/fini methods so that caches can be embedded.
The structure is already exposed, so just expose the
constructors/destructors in order to enable caches to be embedded and
remove a superfluous malloc.
2009-06-01 18:04:14 +01:00