Commit graph

314 commits

Author SHA1 Message Date
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
1bda2334b3 trace: And for the bonus round... Make it compile. 2010-05-11 13:51:38 +01:00
Chris Wilson
b23f3bd204 trace: Try wrapping FT_Open_Face()
We have to be careful to disambuigate an internal call by FreeType from
the application.
2010-05-11 13:46:44 +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
36e0a3d3a0 trace: Remove unused functions
trace.c:1154: warning: ‘_has_font_face_id’ defined but not used
trace.c:1196: warning: ‘_get_pattern_id’ defined but not used
trace.c:1870: warning: ‘_emit_font_face’ defined but not used
trace.c:1882: warning: ‘_emit_scaled_font’ defined but not used
2010-04-26 18:18:49 +01:00
Chris Wilson
3a2d9ffe03 trace: Check return value to suppress compiler warning
trace.c: In function ‘get_prog_name’:
trace.c:741: warning: ignoring return value of ‘fgets’, declared with
attribute warn_unused_result
2010-04-26 18:18:49 +01:00
Chris Wilson
37be183412 trace: Trivial compiler warning fix
trace.c:1665: warning: initialization from incompatible pointer type
2010-04-26 18:18:49 +01:00
Chris Wilson
3814855a64 script: Flush prior to modifying the image data. 2010-04-14 20:22:14 +01:00
Chris Wilson
00101fa716 configure: check -lrt for shm_open()
OS/X includes shm_open() in libc, and fails to link if -lrt is
specified. So perform the appropriate configure time magic.
2010-03-31 16:20:13 +01:00
Andrea Canciani
55ce0b7748 script: Fix script scanner endianness
The script interpreter was reading the length of compressed data as
an host-endian uint32_t, thus making cairo-script able to correctly
read traces that were produced on the same endianness as the one they
ran upon, but unsuitable for portabile cairo-scripts.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-03-31 16:13:05 +02:00
Andrea Canciani
4f617eaf77 trace: Fix trace endianness
Trace files were using host-endian to represent the length of
compressed data, making the trace format not portable.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-03-31 13:13:36 +02:00
Chris Wilson
7ab350378e Silence enumeration warnings following addition of RGB16_565 2010-03-30 18:31:34 +01:00
Chris Wilson
c8a8e57d6a script: Use a stack to push/pop recursed line numbers.
Still not entirely helpful in the event of recursive parsing without a
reference to the file as well as the line number in the event of an
exception.
2010-03-21 20:42:34 +00: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
ab3dc7bb31 csi-replay: compile fix 2010-02-02 16:31:36 +00:00
Benjamin Otte
58980b4ad6 build: Remove glitz surface
glitz is unmaintained and the GL surface is far superior anyway.
2010-01-27 09:56:14 +01:00
Chris Wilson
3acd520c9d xml: Port to cairo_device_t 2010-01-22 23:01:50 +00:00
Chris Wilson
49ab86772a script: Port cairo_script_context_t to cairo_device_t
Use the unifying cairo_device_t for cairo_script_context_t and replace.
2010-01-22 23:01:50 +00:00
Chris Wilson
f617d5fc98 Add cairo_device_t
The device is a generic method for accessing the underlying interface
with the native graphics subsystem, typically the X connection or
perhaps the GL context. By exposing a cairo_device_t on a surface and
its various methods we enable finer control over interoperability with
external interactions of the device by applications. The use case in
mind is, for example, a multi-threaded gstreamer which needs to serialise
its own direct access to the device along with Cairo's across many
threads.

Secondly, the cairo_device_t is a unifying API for the mismash of
backend specific methods for controlling creation of surfaces with
explicit devices and a convenient hook for debugging and introspection.

The principal components of the API are the memory management of:

  cairo_device_reference(),
  cairo_device_finish() and
  cairo_device_destroy();

along with a pair of routines for serialising interaction:

  cairo_device_acquire() and
  cairo_device_release()

and a method to flush any outstanding accesses:

  cairo_device_flush().

The device for a particular surface may be retrieved using:

  cairo_surface_get_device().

The device returned is owned by the surface.
2010-01-22 23:01:50 +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
Chris Wilson
8f69481722 gitignore: refresh
Add forgotten local targets to .gitignore
2010-01-22 22:30:43 +00:00
Chris Wilson
41a24d822a trace: Correctly encode octal values.
How embarrassing.
2010-01-07 11:58:01 +00:00
Andrea Canciani
21560b3ec6 [trace] Fix compilation when FreeType is disabled
cairo-trace needs some headers which are missing if freetype is
not enabled. Adding them explicitly fixes compilation.
2009-12-30 14:08:38 +01: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
Andrea Canciani
1ce096657b Fix compilation on MacOS X
Enable "ld_preload" (DYLD_INSERT_LIBRARIES + DYLD_FORCE_FLAT_NAMESPACE)
and build cairo-trace as a library instead of a module to make it
work also on MacOS X.
2009-11-09 16:59:31 +00:00
Benjamin Otte
3eecf2f60c sphinx: Add required pthread libs
Try again, this time for real hopefully.
2009-11-02 13:20:25 +01:00
Chris Wilson
837eb577b4 sphinx: Add required pthread libs
Switching to pthread-stubs broke the build for sphinx on unbroken
platforms [those that do not unnecessarily link against -lpthreads].
2009-11-02 12:01:45 +00:00
M Joonas Pihlaja
43a775f60d [meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.
The new name is more descriptive than the rather opaque meta surface.
Discussed with vigour on the mailing list and #cairo:

http://lists.cairographics.org/archives/cairo/2009-July/017571.html
2009-10-22 02:29:47 +03:00
Chris Wilson
dac73d260a [build] Link against pthread-stubs
Avoid pulling in the real pthread library if the application is single
threaded and not using pthreads, by linking against pthread-stubs
instead.
2009-10-15 13:05:47 +01:00
Benjamin Otte
6809e12161 [API] Make _cairo_meta_surface_replay() private again
Replaying a meta surface can be achieved by using it as a source for a
cairo_paint() so exporting a separate API is unnecesary and confusing.
So after consulting Chris and Carl, we decided to remove the function
again.
2009-09-30 08:58:19 +02:00
M Joonas Pihlaja
4152cd90e2 [autoconf] Comment on the SIZEOF_VOID__ -> SIZEOF_VOID_P workaround.
Explain where the weird SIZEOF_VOID__ comes from.
2009-09-14 14:29:01 +03:00
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