Commit graph

7853 commits

Author SHA1 Message Date
Andrea Canciani
c8a61a3267 Fix compilation on MacOS X
Some functions declared in MacOS X headers use the always_inline
attribute, thus defining it to be a different expression breaks the
build.
2010-01-23 18:25:11 +01:00
Andrea Canciani
90ba1242b6 Fix image backend compilation
When HAS_ATOMIC_OPS is not defined, cairo-image-surface.c does not
compile because _pixman_white_image calls _pixman_image_for_solid
which gets defined only later in the code.
2010-01-23 18:13:35 +01:00
Chris Wilson
2a466ba070 script: Encode octal values correctly.
Oops, we were emitting the octal numerals in reverse order.
2010-01-22 23:01:53 +00:00
Chris Wilson
87529198aa scaled-font: Mark an error site with _cairo_error() 2010-01-22 23:01:53 +00:00
Chris Wilson
6544f3b25d ps: Wean off the low-level image composite interface
The low-level surface composite interface will disappear in the near
future and results in much more ugly code than calling the high level
interface - so use it when flattening images into the page background.
2010-01-22 23:01:53 +00:00
Chris Wilson
f57cb45fa9 ps: Arguments to fill_extents() were reversed. 2010-01-22 23:01:53 +00:00
Chris Wilson
58540405d9 pdf: Arguments to fill_extents() were reversed. 2010-01-22 23:01:53 +00:00
Chris Wilson
34dd80632e glew: Silence compiler. 2010-01-22 23:01:53 +00:00
Chris Wilson
cf9ea9f2f0 gl: Acquire the context whilst creating surfaces. 2010-01-22 23:01:53 +00:00
Chris Wilson
a7e05bd602 glew: Do not assume that UNIX == GLX 2010-01-22 23:01:53 +00:00
Chris Wilson
c0008242b0 misc: Only use custom lround() under DISABLE_SOME_FLOATING_POINT
On my Core2, the library version of lround() is faster than our
hand-rolled non-floating point implementation. So only enable our code
if we are trying to minimise the number of floating point operations --
even then, it would worth investigating the library performance first.

[Just a reminder that optimisation choices will change over time as our
hardware and software evolves.]
2010-01-22 23:01:52 +00:00
Chris Wilson
1236c41072 xcb: Refresh.
Still an experimental backend, it's now a little too late to stabilise
for 1.10, but this should represent a major step forward in its feature
set and an attempt to catch up with all the bug fixes that have been
performed on xlib. Notably not tested yet (and expected to be broken)
are mixed-endian connections and low bitdepth servers (the dithering
support has not been copied over for instance). However, it seems robust
enough for daily use...

Of particular note in this update is that the xcb surface is now capable
of subverting the xlib surface through the ./configure --enable-xlib-xcb
option. This replaces the xlib surface with a proxy that forwards all
operations to an equivalent xcb surface whilst preserving the cairo-xlib
API that is required for compatibility with the existing applications,
for instance GTK+ and Mozilla. Also you can experiment with enabling a
DRM bypass, though you need to be extremely foolhardy to do so.
2010-01-22 23:01:52 +00:00
Chris Wilson
77afe8491e drm: Add backends for i915 and i965.
As proof-of-principle add the nearly working demonstrations of using DRM
to render directly with the GPU bypassing both RENDER and GL for
performance whilst preserving high quality rendering.

The basis behind developing these chip specific backends is that this is
the idealised interface that we desire for this chips, and so a target
for cairo-gl as we continue to develop both it and our GL stack.

Note that this backends do not yet fully pass the test suite, so only
use if you are brave and willing to help develop them further.
2010-01-22 23:01:52 +00:00
Chris Wilson
b9407af6a4 image: Implement high level interface.
Write a dedicated compositor for pixman so that we avoid the
middle-layer syndrome of surface-fallback. The major upshot of this
rewrite is that the image surface is now several times quicker for glyph
compositing, which dramatically improves performance for text rendering
by firefox and friends. It also uses a couple of the new scan
convertors, such as the rectangular scan converter for rectilinear
paths.

Speedups
========
image-rgba          firefox-talos-gfx-0    342050.17 (342155.88 0.02%) -> 69412.44 (69702.90 0.21%):  4.93x speedup
███▉
image-rgba                        vim-0    97518.13 (97696.23 1.21%) -> 30712.63 (31238.65 0.85%):  3.18x speedup
██▏
image-rgba                  evolution-0    69927.77 (110261.08 19.84%) -> 24430.05 (25368.85 1.89%):  2.86x speedup
█▉
image-rgba                    poppler-0    41452.61 (41547.03 2.51%) -> 21195.52 (21656.85 1.08%):  1.96x speedup
█
image-rgba       firefox-planet-gnome-0    217512.61 (217636.80 0.06%) -> 123341.02 (123641.94 0.12%):  1.76x speedup
▊
image-rgba             swfdec-youtube-0    41302.71 (41373.60 0.11%) -> 31343.93 (31488.87 0.23%):  1.32x speedup
▍
image-rgba         swfdec-giant-steps-0    20699.54 (20739.52 0.10%) -> 17360.19 (17375.51 0.04%):  1.19x speedup
▎
image-rgba                       gvim-0    167837.47 (168027.68 0.51%) -> 151105.94 (151635.85 0.18%):  1.11x speedup
▏
image-rgba          firefox-talos-svg-0    375273.43 (388250.94 1.60%) -> 356846.09 (370370.08 1.86%):  1.05x speedup
2010-01-22 23:01:52 +00:00
Chris Wilson
ec7cc9dea1 ft: Tidy computation of transformed bitmap, and mark if CA
Discard a redundant clear as the image surface is guaranteed to return
a cleared surface that meets pixman/xlib requirements for alignment, and
more importantly add the ComponentAlpha flag on the pixman image
generated as appropriate.
2010-01-22 23:01:52 +00:00
Chris Wilson
b713510f21 surface-fallback: Convert to composite rectangles 2010-01-22 23:01:52 +00:00
Chris Wilson
498c10032e clip: Implement clipping using only the high-level operators.
Revamp clipping in preparation for the removal of the low-level interface
and promote backend to use the higher levels. The principle here is that
the higher level interface gives the backend more scope for choosing
better performing primitives.
2010-01-22 23:01:52 +00:00
Chris Wilson
05bb43a007 types: Move cairo_scaled_glyph_t to cairo-types-private.h
Another step in bringing some sanity to our headers.
2010-01-22 23:01:52 +00:00
Chris Wilson
9c98656fb1 color: Add enum value for the largest stock color.
Useful if we wish to keep a cache of patterns for the very common stock
colors...
2010-01-22 23:01:52 +00:00
Chris Wilson
b7b65b5315 stroke: Convert rectilinear paths to boxes.
A quick and efficient method for extracting the set of boxes that
represent the path when stroked.
2010-01-22 23:01:52 +00:00
Chris Wilson
fe6a7f4c9e fill: Convert rectilinear paths to boxes.
A quick and efficient method for extracting the set of boxes that
represent the path when filled.
2010-01-22 23:01:52 +00:00
Chris Wilson
6b77567b6e path: Compute coarse bounds upon construction.
Frequently we only need the coarse path bounds, so avoid walking over
the list of points once more as we can cheaply track the extents during
construction.
2010-01-22 23:01:52 +00:00
Chris Wilson
6bfcf3ea55 matrix: Do not need to iteratively refine conversion for unity matrices.
If the scale factors on the matrix are unity, then the conversion from a
cairo_matrix_t to a pixman_matrix_t is exact (within numerical
restrictions).
2010-01-22 23:01:52 +00:00
Chris Wilson
13c56800ca gstate: Reduce operators
Some operators may be equivalent to simpler operations, so make the
transformation in the gstate, before calling down into the surface
backends.
2010-01-22 23:01:52 +00:00
Chris Wilson
4d52be39bf gstate: Skip ops with a clear mask.
As pointed out by Benjamin Otte, these are expensive no-ops that we can
trivially detect, just so long as we remember the semantics of extend
modes.
2010-01-22 23:01:52 +00:00
Chris Wilson
c2ef45226d gstate: Check for an invalid matrix before cairo_transform()
Similar to the other checks that will generate an invalid matrix prior
to performing the operation.
2010-01-22 23:01:52 +00:00
Chris Wilson
22316a0c17 gstate: White space.
A couple of minor coding style violations.
2010-01-22 23:01:52 +00:00
Chris Wilson
29bedde904 pattern: Add convenience patterns for stock colours
By preallocating in our data segment a couple of solid patterns for the
stock colours, it becomes more convenient when using those in surface
operations, such as when clearing.
2010-01-22 23:01:51 +00:00
Chris Wilson
9eb98e1dc5 scaled-font: Use tight glyph bounds when determining overlap.
An issue that we currently have is that we have a pessimistic
false-positive rate when determining whether glyphs within a string
overlap. By using the tight bounds, the overlap detection is arguably
less accurate presuming pixel-aligned opacity masks but we make the
trade-off for performance.
2010-01-22 23:01:51 +00:00
Chris Wilson
005b0c4eb2 test: Add explicit device management to xlib-surface-source
Mostly pedagogical example.
2010-01-22 23:01:51 +00:00
Chris Wilson
ca02b51ef6 test: Add an xcb surface source test 2010-01-22 23:01:51 +00:00
Chris Wilson
f0678fb70c test: Tweak aligned of text-rotate
Reset the rotation for every quadrant so that the starting rectangles
are pixel-aligned.
2010-01-22 23:01:51 +00:00
Chris Wilson
2edd2adafc test: Exercise scan converters with large rounded rectangles.
Having added a specialised scan converter on the premise that it should
be better at handling rounded rectangles, ensure that they are indeed
rendered correctly.
2010-01-22 23:01:51 +00:00
Chris Wilson
5187501e99 test: Add --track-origins=yes to valgrind flags.
Enable origin tracking by default for make check-valgrind. This is
slower and consumes more memory than regular valgrind, but the
additional information provided about the source of the uninitialised
data is often invaluable.
2010-01-22 23:01:51 +00:00
Chris Wilson
3a5d71c431 pattern: An EXTEND_NONE surface is not opaque if we sample outside
Fixes test/clear-source as proposed by Benjamin Otte.
2010-01-22 23:01:51 +00:00
Chris Wilson
b07de014eb spans: Add a rectangular scan converter
This is a highly specialised scan converter for the relatively common
case of where the input geometry is known to be a series of rectangles.
Generally not device aligned (or else we would most likely have chosen
an even higher performance path that does not require a coverage mask),
this optimised converter can simply compute the analytical coverage by
utilising a special case Bentley-Ottmann intersection finder.
2010-01-22 23:01:51 +00:00
Chris Wilson
e49855497e spans: Add a Bentley-Ottmann variant on the Tor scan converter
This variant uses the Bentley-Ottmann algorithm to only maintain the
active edge list upon edge events and so can efficiently skip areas
where no change occurs. This means that it can be much quicker than the
Tor algorithm (which is still used to compute the coverages from the
active edges) for geometries consisting of long straight lines with few
intersections. However due to the computational overhead of the
Bentley-Ottmann event processing, for dense curvy paths, simply updating
the active edge list in sync with computing the coverages is a win. Due
to advantageous adaptive step size, the scan converter can be run at a
much higher subsampling with little extra overhead compared with Tor,
currently it uses a 256x256 subsampling grid to avoid any impedance
mismatch with path precision.

Given the current status of implementations, this scan converter [botor]
is likely to be advantage where detecting large regions of unchanged
span data will result in improved performance, for instance the drm
backends which convert the scan data into rectangles.
2010-01-22 23:01:51 +00:00
Chris Wilson
424dcf2963 boxes: Enable generation of boxes from rectilinear polygons.
Extend the special case rectilinear tessellator to also produce boxes.
2010-01-22 23:01:51 +00:00
Chris Wilson
b83f1c347d boxes: Enable tessellation
Extend the special case rectangular tessellator to handle generation of
cairo_boxes_t.
2010-01-22 23:01:51 +00:00
Chris Wilson
43beaa5873 boxes: Efficient storage for an array of cairo_box_t.
Currently we use cairo_traps_t to also pass around arrays of boxes. This
is woefully inefficient in terms of storage, but also means that we
repeatedly have to verify that the traps are a set of boxes. By
explicitly passing around a cairo_boxes_t we avoid the semantic loss.

This will be heavily used in pending commits.
2010-01-22 23:01:51 +00:00
Chris Wilson
ae25f1c360 Alter definition of cairo_composite_rectangles_t
This is a more useful definition that is able to individually track the
rectangles that compose the composite operation. This will be used by
the specialist compositors as a means to perform the common extents
determination for an operation.
2010-01-22 23:01:51 +00:00
Chris Wilson
9cd9137843 spans: Pass multiple rows of identical spans to the renders.
It is quite common amongst our geometry to have rows of repeated span
data, for example a rounded rectangle will have repeating data between
the top and bottom rounded corners. By passing the repeat length to the
renderers, they may be able to use that information more efficiently,
and the scan converters can avoid recomputing the same span data.
2010-01-22 23:01:51 +00:00
Chris Wilson
a04873c077 qt: Trivial compile fix for boilerplate. 2010-01-22 23:01:51 +00:00
Chris Wilson
0f09349dd8 gl: Exercise Window destinations with boilerplate
Add a gl-window boilerplate target to exercise using GL to render to a
visible Drawable -- for instance, a window has a different coordinate
system to a framebuffer...
2010-01-22 23:01:51 +00:00
Chris Wilson
ccea7fd7c1 gl: Port to cairo_device_t 2010-01-22 23:01:50 +00: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
82f8aa548d Recursive mutex.
Implement a recursive mutex which will be needed for cairo_device_t.
In particular only pthreads by default is a non-recursive mutex (to my
knowledge) - both win32 critical sections and mutexes on Quartz are
recursive.
2010-01-22 23:01:50 +00:00
Chris Wilson
d2f251f84b configure: Globally define AC_GNU_SOURCE
We were using _GNU_SOURCE throughout the codebase, so simply define it
once during configure. This is the easiest method to enable recursive
mutexes using pthreads, as required in a pending patch.
2010-01-22 23:01:50 +00:00