Commit graph

113 commits

Author SHA1 Message Date
Chris Wilson
4713562eda trace: Remove the warning about the unstable format
We're stuck with the PostScript style for this generation now.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:50:21 +00:00
Chris Wilson
8844d50308 Convert cairo_mime_surface_t to cairo_raster_source_pattern_t
As discussed, overloading the cairo_surface_t semantics to include
sources (i.e. read-only surfaces) was duplicating the definition of
cairo_pattern_t. So rather than introduce a new surface type with
pattern semantics, start along the thorny road of extensible pattern
types.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:35:42 +00:00
Chris Wilson
add9a4092b trace: Emit an stack operation to create a pattern from an undefined surface
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-27 14:56:55 +01:00
Chris Wilson
af9fbd176b Introduce a new compositor architecture
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. :)
2011-09-12 08:29:48 +01:00
Chris Wilson
70cd3b473d api: Extend cairo_antialias_t to include performace/quality hints
The existing API only described the method to be used for performing
rasterisation and unlike other API provided no opportunity for the user
to give a hint as to how to trade off performance against speed. So in
order to no be overly prescriptive, we extend the NONE/GRAY/SUBPIXEL
methods with FAST/GOOD/BEST hints and leave the backend to decide how
best to achieve those goals.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 15:17:38 +01:00
Chris Wilson
2220693a40 Introduce cairo_mime_surface_t
The mime surface is a user-callback surface designed for interfacing
cairo with an opaque data source. For instance, in a web browser, the
incoming page may be laid out and rendered to a recording surface before
all the image data has finished being downloaded. In this circumstance
we need to pass a place holder to cairo and to supply the image data
later upon demand.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-15 00:16:09 +01:00
Chris Wilson
40fa6c867c trace: Pop the surface after write-to-png
It is convenient if the user can simply enable the use of the commented
write-to-png operation just by removing the preceding '%'. However, to
do so we need to make sure that the line is stack-neutral and so need to
pop the surface that we place onto the stack after writing the png.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 14:06:15 +01:00
Chris Wilson
b2ee7d9a21 trace: Emit the content type for image surfaces
Currently we only emit the format, but if you want to later convert
the images to a normal surface for replay it is handy to have the
content.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-29 17:14:42 +01:00
Chris Wilson
a69335a84e API: map-to-image and create-similar-image
A common requirement is the fast upload of pixel data. In order to
allocate the most appropriate image buffer, we need knowledge of the
destination. The most obvious example is that we could use a
shared-memory region for the image to avoid the transfer cost of
uploading the pixels to the X server. Similarly, gl, win32, quartz...

The other side of the equation is that for manual modification of a
remote surface, it would be more efficient if we can create a similar
image to reduce the transfer costs. This strategy is already followed
for the destination fallbacks and this merely exposes the same
capability for the application fallbacks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 14:55:58 +01:00
Chris Wilson
7f77e2f36a trace: Create a new opcode for recording surface
During replay we want to handle recording surfaces specially, and not
redirect the creation of those to the target surface. This is similar to
the need to keep image surfaces as images during replay.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 22:50:25 +01:00
Uli Schlachter
0dc63f5bb4 cairo-trace: Fix mark-dirty with xcb backend
cairo-xcb's acquire_source_image implementation will attach the image it returns
as a snapshot to the xcb surface. cairo_surface_mark_dirty_rectangle asserts
that the surface doesn't have any snapshots attached. cairo-trace will emit the
surface to the trace when it was marked dirty by drawing it to an image surface.

The combination of these three things caused a failed assertion when cairo-trace
was used on something which uses xcb/Xlib and which uses mark_dirty.
I found this with firefox and xlib-xcb.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-17 17:53:23 +02:00
Uli Schlachter
cc3e4c6ec9 Handle CAIRO_STATUS_DEVICE_FINISHED in switches
Fixes all warnings that looked like this:

warning: enumeration value 'CAIRO_STATUS_DEVICE_FINISHED' not handled in switch

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-09 11:19:49 +02:00
Chris Wilson
61fd10376f cairo-trace: Fix use of buf outside of scope
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37746
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 15:05:51 +01:00
Chris Wilson
e21b373c94 cairo-trace: Fix an obscure bug recording the fishtank
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-26 16:31:40 +01:00
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
ad458d816a trace: Always emit a function name for write-to-png-stream
By emitting an empty function name when it it impossible to perform
the lookup, we can get rid of the warning:

trace.c:3714: warning: unused variable ‘symbol’

Additionally, this makes the syntax (or, rather, the parameter count)
for write-to-png-stream the same on every configuration.
2011-03-18 17:54:54 +01:00
Chris Wilson
df1dd83880 trace: Fix hint_style/hint_metrics typo
Compiler warning saves the day!

trace.c: In function ‘_emit_font_options’:
trace.c:2973:20: warning: comparison between ‘cairo_hint_style_t’ and
‘enum _cairo_hint_metrics’

A genuine bug, thanks gcc!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-18 13:23:26 +00:00
Adrian Johnson
ed24deaa2e mesh: Add mesh pattern type and enum values
Add the mesh pattern type and an error status to be used to report an
incorrect construction of the pattern.

Update the backends to make them ready to handle the new pattern type,
even if it cannot be created yet.
2011-01-01 13:05:12 +01:00
M Joonas Pihlaja
1e7485f8e5 trace: Avoid stdbool.h C99ism.
There is no <stdbool.h> on old Solaris without invoking
c99 mode explicitly.
2010-07-12 00:50:13 +03:00
Chris Wilson
9b9952ab4f Convert mime data length to use unsigned long
What we want to use is size_t, but we don't want the implied POSIX
dependency. However, POSIX does say that size_t is an unsigned integer
that is no longer than a long, so it would appear safe to use an
unsigned long as a replacement. Safer at least than unsigned int.
2010-07-10 11:16:19 +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
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
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
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
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
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
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
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
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
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
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
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
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