Commit graph

425 commits

Author SHA1 Message Date
M Joonas Pihlaja
cd94bf8bf3 [trace] Look harder for the cairo-trace.so library.
On OpenBSD the convention is to not use symlinks from
unversioned library names to versioned library names.
This breaks cairo-trace because it looks for cairo-trace.so
explicitly, but on OpenBSD only cairo-trace.so.0.0 is
installed.

The right thing to do is probably to source the cairo-trace.la
file and look for a file name there somehow.  Instead this commit
just looks for a likely looking file or symlink in the install
directory.
2009-09-14 13:32:19 +03:00
M Joonas Pihlaja
a343c8c42d [trace] Don't use pthread_key_delete.
On OpenBSD libc doesn't provide pthread stubs like glibc on Linux
or newer libcs from FreeBSD.  However libX11 does provide a stubs
for a subset of the pthread functions (formerly in libXThrStub,
now moved into libX11 proper), but pthread_key_delete() is not
one of the stubbed ones.  So, on OpenBSD cairo's non-linking of
libpthread accidentally works as long as the xlib-surface is enabled,
which is nearly always the case.

This patch makes trace.c stand at the same precipice as cairo itself
by reverting to only a subset of the pthreads functions stubbed by
libX11.
2009-09-14 13:32:18 +03:00
M Joonas Pihlaja
cf0fed2191 [build] Check for dlsym in both libdl and libc.
The BSDs have dlsym() in libc rather than libdl.
2009-09-14 13:32:18 +03:00
M Joonas Pihlaja
1c7ac6c47a [build] Work around autoconf void* -> VOID__ name conversion bug.
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.
2009-09-14 13:32:18 +03:00
Chris Wilson
9c2790ccc4 [build] Add a default message for when GLEW isn't built
And it appears I touched the build system again and autoregenerated the
feature headers.
2009-09-14 10:10:45 +01:00
Chris Wilson
6d4f3c40ef Add a private copy of GLEW
This appears to be the simplest mechanism to build libglew at the moment -
should a system copy be unavailable.  Fortunately libglew is now distributed
under a permissive licence.

If you want to pass 'make -C src check' you have to use the system copy,
or spend quite a bit of time cairo-fying libglew.
2009-09-14 09:26:02 +01:00
M Joonas Pihlaja
ba21f21356 [trace] Don't trace internal cairo calls on Solaris.
On various configurations of Solaris cairo-trace likes to trace
internal calls to the API from within cairo and cairo-trace itself. On
Linux the slim_hidden_proto stuff avoids this by name mangling and
symbol alias magic, but on Solaris that doesn't work so we're left
with either no hidden symbols at all or using normal ELF hidden symbol
attributes, but neither of those prevent internal calls to cairo from
being traced of course.

This commit provides a per-thread entry/exit trace counter for use
when we can't use name mangling to hide internal API calls.  As a
side-effect it may hide actual client API calls from callback
functions called by cairo, but such use cases ought to be rare.
2009-09-13 20:33:33 +03:00
M Joonas Pihlaja
2fb59a69f4 [trace] Don't rely on the constructor attribute to initialise the tracer.
Use pthread_once() at cairo API entry points to initialise the library
if required.  This side steps the issues with the __constructor__
attribute vs _init()/_fini() on Solaris and different tracer/tracee
runtimes which result in the constructors not being run in
cairo-trace.so.
2009-09-13 20:30:04 +03:00
M Joonas Pihlaja
18a441984b [trace] Don't try and propagate a void result.
The pattern

	return <function returning void>( ... );

is a gccism not supported by Sun Studio.
2009-09-13 20:27:41 +03:00
M Joonas Pihlaja
fee5c58c6c [trace] Avoid warnings from assigning a void pointer to a function pointer.
The Sun Studio compiler complains a *lot* when assigning the result
of dlsym to a function pointer.  Cast the result to the proper
type first.:w
2009-09-13 20:27:41 +03:00
Chris Wilson
f8a8f297f2 [trace] Stray trailing ';' in bswap macros 2009-09-13 10:58:59 +01:00
Chris Wilson
f851009ec7 [trace] Compile without lookup-symbol
And check compilation with --disable-symbol-lookup
2009-09-13 10:57:42 +01:00
Chris Wilson
6cb3ff9c19 [configure] --enable-symbol-lookup
There you go Joonas, I don't always ignore your suggestions! This is
simple patch to allow the user to disable symbol loops in case the
auto-detection fails on some obscure (perhaps OpenBSD) platform. Or in
case the user really wants to trim a few bytes from a library only used
during tracing!
2009-09-13 10:52:14 +01:00
Chris Wilson
f34affaa1e [util] And reuse the same name repository name.
Completely confused by local caching of a broken cairo.modules by the
jhbuild client. ARGH!
2009-09-09 18:03:20 +01:00
Chris Wilson
e1774185d6 [util] And back to a unique repo name for cairo.modules
Gah, further experiments into the unknown and the unclear.
2009-09-09 17:52:10 +01:00
Chris Wilson
2905ebc99e [util] And restore the repository tag.
jbhuild requires a local definition.
2009-09-09 17:24:43 +01:00
Chris Wilson
4d7eb79d25 [util] Inherit the repository from xorg.modules
Experiment with inheriting the repository from xorg.module, in order to
avoid having two entries for the same server.
2009-09-09 17:12:14 +01:00
Chris Wilson
9389cb78a8 [build] Improve handling of missing test apparatus
Improve detection, reporting and disabling of test backends when we lack
the required libraries and utilities.
2009-09-08 17:51:33 +01:00
Chris Wilson
310cebf194 [configure] Add option to disable trace.
Some environments may be broken beyond our capabilities to detect, or
maybe the user is just insane and doesn't want to build my nice shiny
cairo-trace. Whatever, give them the option to choose:

  $ ./configure --disable-trace
2009-09-05 15:21:50 +01: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
M Joonas Pihlaja
b509b548b1 [trace] Check for __builtin_return_address explicitly.
Some other compilers such as clang and icc support the
__builtin_return_address() intrinsic as well, so we don't
need to check for __GNUC__ >= 3 only.
2009-09-02 04:50:21 +01:00
M Joonas Pihlaja
2b0e070f6a [trace] Replace an open coded test for matrix identity.
The code has a _matrix_is_identity() function we can use
instead of open coding the same test.
2009-09-02 04:50:21 +01:00
M Joonas Pihlaja
70ea9e3ce1 [trace] Don't crash on unknown enums values.
If the tracer encounters an unknown enum value it
ought not to crash. Theis patch replaces the idiom
of looking up a name for an enumerated value directly
from a table by a switch statement. As a bonus we get
warnings from the compiler when the enums are updated
in cairo.
2009-09-02 04:50:20 +01:00
M Joonas Pihlaja
174c2620c8 [trace] Check for object stack underflow.
If the tracer's object stack underflows we want to
know about is as soon as possible. This patch adds
checks against the stack overflowing and aborts the
program with an object stack dump if it does.
2009-09-02 04:50:20 +01:00
M Joonas Pihlaja
c64f6f8a15 [trace] Get the tracee program name from the environment.
Support non-Linux systems which don't have a /proc/self/cmdline
by transferring the application name given to cairo-trace via
an environment variable CAIRO_TRACE_PROG_NAME.
2009-09-02 04:42:07 +01:00
Chris Wilson
1bcc3a3fa0 [tee] Rename 'append' to 'add' and add symmetric 'remove' 2009-09-01 14:24:06 +01:00
M Joonas Pihlaja
9bb469c51c [trace] Use HAVE_FLOCKFILE/FUNLOCKFILE since configure test for them.
The trace source was using the flockfile() and funlockfile()
functions directly.
2009-08-31 16:06:50 +03: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
7447915381 [script] Conditionalise the build
Allow the interpreter to be disabled if we can not satisfy its dependencies.
2009-08-29 17:07:37 +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
425b0e35e2 Add xml surface
A very simple surface that produces a hierarchical DAG in a simple XML
format. It is intended to be used whilst debugging, for example with the
automatic regression finding tools of cairo-sphinx, and with test suites
that just want to verify that their code made a particular Cairo call.
2009-08-29 17:07:34 +01:00
Chris Wilson
6e0b3be903 Add cairo-sphinx utility for regression analysis
sphinx is an alternate version of the current cairo-test-trace. It's
purpose is to replay a live application (which may just be a replay of a
trace) against a backend and its reference. The improvement over the
original cairo-test-trace is that the reference backend may be from an
older version of cairo.
2009-08-29 17:07:34 +01:00
Chris Wilson
cd7b27ff5c Add 'flight-data-recorder' utility.
This is a simple variation on cairo-trace that wraps records the last 16
contexts by wrapping the target surface inside a tee surface, along with a
meta/recording surface. Then on receipt of a SIGUSR1, those last 16
contexts are played via a script-surface into /tmp/fdr.trace.

Mostly proof-of-concept, it seems to be causing a number of rendering
glitches whilst testing with firefox -- otherwise, it seems to works.
2009-08-29 08:08:39 +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
7306305cc8 [script] Emit surface content
Include the desired content with the creation info.
2009-08-29 08:08:37 +01:00
Chris Wilson
fee647c985 [script] Read from a FILE stream
For ease of implementing the interpreter inside a pipeline, add a method
to execute a FILE *.
2009-08-29 08:08:37 +01:00
Chris Wilson
a9d997fecd [script] Introduce cairo_script_context_t
cairo_script_context_t is an encapsulation object for interfacing with the
output - multiple surfaces can share the same context, meaning that they
write to the same destination file/stream.
2009-08-29 08:08:36 +01:00
Chris Wilson
28887ac272 [trace] Fix emission of similar (track operands) 2009-08-29 08:08:36 +01:00
Chris Wilson
50c7d637f3 [trace] Emit an 'index' for an undefined surface
Larry Ewing hit a bug in cairo-trace whereby it tried to create a similar
surface referencing an undefined object. This fix checks whether the
object has yet to be defined, and if not issues an index in order to copy
the appropriate operand from the stack.
2009-08-29 08:08:36 +01:00
Chris Wilson
e2c31183e9 [script] Handle zero-length strings
Not sure where the zero length string is coming from, but we should
nevertheless handle it.
2009-08-29 08:08:35 +01:00
Chris Wilson
4c215162d2 [script] Off-by-one in allocation of string length.
We need pass in the real number of bytes in the string, excluding the NUL
terminator which is already accounted for.
2009-08-29 08:08:35 +01:00
Chris Wilson
55eddb7ef4 [script] A little utility to convert a trace into a trace
Replay the trace using the interpreter onto a script surface - useful for
checking idempotency.
2009-08-29 08:08:35 +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
cbee97f0e3 [script] Preserve '{}' whilst translating 2009-08-29 08:08:34 +01:00
Chris Wilson
dc886450ac [util] Show total edge length in show-edges 2009-08-29 08:08:31 +01:00
Chris Wilson
f8bb3617c3 Eliminate self-intersecting strokes.
We refactor the surface fallbacks to convert full strokes and fills to the
intermediate polygon representation (as opposed to before where we
returned the trapezoidal representation). This allow greater flexibility
to choose how then to rasterize the polygon. Where possible we use the
local spans rasteriser for its increased performance, but still have the
option to use the tessellator instead (for example, with the current
Render protocol which does not yet have a polygon image).

In order to accommodate this, the spans interface is tweaked to accept
whole polygons instead of a path and the tessellator is tweaked for speed.

Performance Impact
==================

...
Still measuring, expecting some severe regressions.
...
2009-08-29 08:08:28 +01:00
Behdad Esfahbod
e63d725ad4 [utils] Remove unused code 2009-08-10 12:47:37 -04:00