Commit graph

64 commits

Author SHA1 Message Date
Jesse Barnes
356c4ed9cc Expose 30bpp/10bpc support: CAIRO_FORMAT_RGB30
This is a common format used by framebuffers to drive 10bpc displays
and is often hardware accelerated by XRender with underlying support
from pixman's x2r10g10b10 format (which provides coercion paths for
fallbacks).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-01 09:00:14 +01:00
Andrea Canciani
5f039f0f89 mesh: Rename cairo_pattern_mesh_* functions to cairo_mesh_pattern_*
This is consistent with the naming of most cairo types/functions
(example: cairo_foo_surface_*).

The substitution in the code has been performed using:

  sed -i 's/cairo_pattern_mesh_/cairo_mesh_pattern_/' <files>
2011-02-07 20:28:09 +01:00
Andrea Canciani
96426fdf01 script: Add support for mesh patterns
Extend CairoScript with operators based on the mesh pattern API.
2011-01-01 13:05:13 +01:00
Chris Wilson
cbe8fd0794 script: Avoid the expensive of the redundant memset.
As we are about to immediately fill the entire image, allocate the
memory ourselves to avoid the redundant memset performed by pixman.
2010-05-12 20:54:49 +01:00
Chris Wilson
b9f7a4b526 script: Don't hash the entire image.
The reuse hit rate is very small, and most images are quickly
distinguished in the first few bytes... Though perhaps not for video as
in the swfdec-youtube case...
2010-05-12 20:54:49 +01:00
Chris Wilson
3940b0e91c subsurface: s/region/rectangle/
After a renewed discussion, it was pointed out that the API in Cairo was
not restrictive and by using doubles we would be consisted with the rest
of the API. Thus prompting the name change to

  cairo_surface_create_for_rectangle()

similar to cairo_rectangle().

And document the public API.
2010-04-30 10:16:06 +01:00
Chris Wilson
0f0d349a40 trace: Wrap cairo_surface_create_for_region() 2010-04-28 09:54:37 +01:00
Andrea Canciani
b8a7f8621a Update FSF address
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
2010-04-27 11:13:38 +02:00
Chris Wilson
3814855a64 script: Flush prior to modifying the image data. 2010-04-14 20:22:14 +01:00
Chris Wilson
7ab350378e Silence enumeration warnings following addition of RGB16_565 2010-03-30 18:31:34 +01:00
Chris Wilson
4b4de940ee script: Remove the version check.
When compiling we can depend on whatever version of cairo we need, but
we should be wary of checking for runtime compatibility when building
standalone.
2010-03-21 20:41:18 +00:00
M Joonas Pihlaja
5b7f4bb241 api: Introduce CAIRO_FORMAT_INVALID formally in the API.
We were exposing the actual value of CAIRO_FORMAT_INVALID
through API functions already, so it makes sense to just
go ahead and put it in the cairo_format_t enum.
2010-03-01 01:21:31 +02:00
Chris Wilson
5d34902c0c script: Compile without mmap
Should fix:
  Bug 26509 - Cairo fails to compile without mmap
  http://bugs.freedesktop.org/show_bug.cgi?id=26509

As reported by Hib Eris, Cairo files to compile under a mingw32
cross-compiler as we use a structure only defined if HAVE_MMAP
unconditionally.
2010-02-10 12:10:16 +00:00
Chris Wilson
bf7fb4e0e0 script: Handle cache allocation failure more gracefully
Instead of bailing out if we cannot store the glyph cache on the font,
simply do not store the glyph cache on the font...
2010-01-22 23:01:49 +00:00
Chris Wilson
2b312806f1 script: Free the correct pattern after failure.
The error path attempted to free the resolved pattern which it had just
discovered was NULL and not the locally allocated pattern...
2010-01-22 23:01:49 +00:00
Chris Wilson
bc2d0ad114 script: Permit surface operations on the context
By implicitly reference the target of the context instead, i.e.
this reduces the use of:

  /target get (example.png) write-to-png pop

as a common idiom where the context is kept on the stack and the surface
forgotten.
2010-01-22 23:01:49 +00:00
Chris Wilson
411c09eed7 perf: Enable a surface cache for perf-trace
Real applications that control their Drawable externally to Cairo are
'disadvantaged' by cairo-perf-trace when it creates a similar surface
for each new instance of the same Drawable. The difficulty in
maintaining one perf surface for every application surface is that the
traces do not track lifetimes for the application surfaces, so we would
just accumulate stale surfaces. The surface cache takes a different
approach and returns the same surface for each active Drawable, and
maintains a hold-over of the MRU 16 surfaces. This achieves 60-80% hit
rate with firefox, which is probably as good as can be expected.
Obviously for double-buffered applications we only every draw to freshly
created surfaces (and Gtk+ bypasses cairo to do the final copy -- the
ideal application would just use a push-group for double buffering, in
which case we would capture and replay the entire expose event).

To enable use of the surface cache whilst replaying use -c:

  ./cairo-perf-trace -c firefox-talos-gfx
2010-01-22 23:01:46 +00:00
M Joonas Pihlaja
e2d75203c5 [dirty] Add more missing surface dirtying notifications.
Now that the image surface actually cares about
cairo_surface_mark_dirty() we're hitting cases where
we've forgotten to mark surfaces dirty.
2009-11-29 15:56:26 +02:00
Chris Wilson
ff6bc1e132 [script] Always create a fallback font
In order to get a baseline for win32 performance testing, always create a
font so that the trace can be replayed. Not ideal, but I feel this the
pragmatic solution for judging the performance differentials before I can
work out a better solution for loading typ42 fonts.
2009-09-02 21:22:33 +01:00
Chris Wilson
fcbb288e7c [script] Attempt to select a font if ! CAIRO_HAS_FT_FONT
In order to enable replay of traces on machines that do not use FreeType
as the native font system, we need to convert a type42 font into something
similar. Currently the fallback is just to select a font with the same
name - this ignores weight and slant, and many other details.
2009-09-02 21:02:18 +01:00
Chris Wilson
c60280782d [script] Implement invert
Flesh out matrix inversion.
2009-08-29 17:10:05 +01:00
Damian Frank
17ef949b6a Rename cairo-script static func to avoid MinGW conflict
cairo-script-operators.c's _dup function was colliding with one
defined in io.h by MinGW (gcc 4.3.0 package).  I renamed it
to _duplicate.
2009-08-29 17:10:05 +01:00
Chris Wilson
958f7ab123 [script] Support running on cairo-1.8
Pre 1.9 the application had to pass a resolved font to cairo -- so do so
in the interpreter if the cairo version is less than 1.9
2009-08-29 17:07:36 +01:00
Chris Wilson
8d1bf830c0 Fix errors found by clang
Shadowed variables, unused writes and some dead code.
2009-08-29 08:08:39 +01:00
Chris Wilson
eba6b5126a [build] Add options for warning about bad casts
-Wbad-function-cast in particular. Triggers quite a few warnings where we
have explicitly cast to an integer.
2009-08-29 08:08:38 +01:00
Chris Wilson
bb919584c0 [script] Use a compact representation for horizontal offsets between glyphs
Kerning is quite frequent, that is to apply a horizontal but no vertical
offset to a glyph. For instance by discarding the vertical coordinate
where it remains the same and only encoding the horizontal offset we
reduce the file size by ~12.5% when tracing poppler.
2009-08-29 08:08:34 +01:00
Chris Wilson
86d6a48952 [script] Check for failure to store the glyph cache
If we fail to add the glyph cache (presumably because the font is in
error) do not leak the allocation. As this occurs for every single glyph
string, the leak can grow very quickly and mask the original bug.
2009-08-06 23:47:40 +01:00
Chris Wilson
e2f912dc5b [script] Add cvi, cvr, mod
Add implementations of convert-to-integer, convert-to-real and modulus
supplied by Zack Weinberg <zweinberg@mozilla.com>.
2009-07-28 09:32:36 +01:00
Chris Wilson
25858d524d [script] Fix reference to font source after transferring to mmap
After diverting the pointers to accommodate lazy decompressing of the
source, the bytecode pointer was left pointing to the original location
that had already been freed - thus passing an invalid block to FreeType
and unsurprisingly then, blowing up.
2009-07-27 10:18:25 +01:00
Chris Wilson
e577096dff [boilerplate] Fix compilation against old revisions (as old as 1.9.2!) 2009-07-24 10:57:26 +01:00
Chris Wilson
9d7fd626c3 [script] Decompress font sources
Need to decompress patterns and embedded bytecode before passing to
fontconfig/FreeType.
2009-07-23 17:05:28 +01:00
Chris Wilson
710308c64e [script] Extended blend mode support. 2009-07-14 16:31:41 +01:00
Chris Wilson
23648e2fdf [script] Prototypical binary translator
Hook into the scanner to write out binary version of the tokenized
objects -- note we bind executable names (i.e. check to see if is an
operator and substitute the name with an operator -- this breaks
overloading of operators by scripts).

By converting scripts to a binary form, they are more compact and
execute faster:

  firefox-world-map.trace 526850146 bytes
              bound.trace 275187755 bytes

[ # ]  backend                         test   min(s) median(s) stddev. count
[  0]     null                        bound   34.481   34.741   0.68%    3/3
[  1]     null            firefox-world-map   89.635   89.716   0.19%    3/3
[  0]      drm                        bound   79.304   79.350   0.61%    3/3
[  1]      drm            firefox-world-map  135.380  135.475   0.58%    3/3
[  0]    image                        bound   95.819   96.258   2.85%    3/3
[  1]    image            firefox-world-map  156.889  156.935   1.36%    3/3
[  0]     xlib                        bound  539.130  550.220   1.40%    3/3
[  1]     xlib            firefox-world-map  596.244  613.487   1.74%    3/3

This trace has a lot of complex paths and the use of binary floating point
reduces the file size by about 50%, with a commensurate reduction in scan
time and significant reduction in operator lookup overhead. Note that this
test is still IO/CPU bound on my i915 with its pitifully slow flash...
2009-07-04 15:29:07 +01:00
Chris Wilson
2ecafb025c [script] Reuse glyph advance cache over multiple invocations
Store the metric cache as user-data on the scaled-font so that we can
retrieve it on future calls to show-glyphs and friends.
2009-06-28 10:09:01 +01:00
M Joonas Pihlaja
2da906f476 [script] Include unistd.h if we're twiddling file descriptors.
Including sys/mman.h doesn't pull in unistd.h on Solaris 9 so
we have to include it explicitly.
2009-06-19 19:01:15 +03:00
Chris Wilson
1498c9c333 [script] Also mmap backing storage for the pattern descriptions
These can be reasonably large and persist for long times due to the
font holdover caches, so manually swap them out to save space on tiny
swapless machines.
2009-06-12 08:33:25 +01:00
Chris Wilson
3aaea453b0 [script] Store fonts inside mmaped files.
As an aide to tiny swapless systems write the rarely used bytes that
define type42 fonts into a deleted file and mmap them back into our
address space.
2009-06-11 22:38:09 +01:00
Chris Wilson
f7dbdf1fd1 [script] Hide pixman-ops when copying pixels
Seeing unexpected time inside pixman composite is quite disturbing when
trying to track down the apparent slowness in some benchmarks. Remove one
source of this artefact by simply memcpy'ing pixel data when trivial.
2009-06-11 15:19:59 +01:00
Chris Wilson
16eb160c77 [script] Enable compilation without fontconfig
Some insane people actually try compiling cairo with freetype and without
fontconfig...
2009-06-06 20:10:49 +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
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
e38f85c5de [script] Pedantic violations
Fixup a few trivial errors with -pedantic.
2009-05-08 08:53:43 +01:00
Chris Wilson
0c00556990 [script] Missing include for INT32_MAX
Avoid depending upon stdint.h, or rather cut'n'pasting Cairo's portable
defines, by using INT_MAX and limits.h instead.
2009-05-08 08:52:32 +01:00
Chris Wilson
8abd21bd3a [script] Call the context creation hook
Hook in the creation hook so applications can record or even modify the
contexts used in replay.
2009-01-02 09:53:25 +00:00
Chris Wilson
fd96cea4fe [script] Improve array construction.
Limit the memory allocation to the initial array size and perform a direct
copy from the operand stack to the array.
2009-01-02 09:53:24 +00:00
Chris Wilson
ecb8dce27c [script] Recreate surface content.
Use the content recorded in the trace, defaulting to COLOR_ALPHA, to
determine the replayed surface type.
2009-01-02 09:53:24 +00:00
Chris Wilson
449bf0bb7b [script] Silence incorrect compiler warnings
Bah, the compiler failed to do its IPA correctly and wrongly complained
about potential use of uninitialised out-params guarded by the return
value. Silence them!
2008-12-18 12:06:46 +00:00
Chris Wilson
0df43251d4 [replay] Take advantage of unresolved fonts
As Behdad has changed the underlying ft-font to accept unresolved patterns,
take advantage of that to simplify the replay code.
2008-12-18 12:06:35 +00:00
Chris Wilson
83f0e6cf62 [script] Inline the stack push
Frequently to push an object onto the stack all we need is to simply
perform the struct copy - so inline it and only call the out-of-line
function if we need to enlarge the stack.
2008-12-12 12:00:43 +00:00
Chris Wilson
565b3d6ad6 [script] Switch to hyphens.
Using hyphen in the operators is easier to read than underscores.
2008-12-12 12:00:43 +00:00