Commit graph

7430 commits

Author SHA1 Message Date
Chris Wilson
0f8af05484 [fallback] Avoid tessellating empty polygons
I added an assert inside the tessellator to ensure that empty polygon were
not being propagated that far...
2009-08-29 08:08:31 +01:00
Chris Wilson
09377a7163 [freelist] Lazy initialisation of pools 2009-08-29 08:08:30 +01:00
Chris Wilson
6f0340e2e5 [clip] Use the rectilinear tessellator
We can ensure that we always produce a clip region when possible by using
the rectilinear tessellator to convert complex, device-aligned polygons to
regions. Prior to using the tessellator, we relied on pixman's region code
which could only handle a union of rectangles.
2009-08-29 08:08:30 +01:00
Chris Wilson
e3820bef20 [fill] Short-circuit extents on an empty path.
If the path is empty, avoid redundant polygonisation and tessellation by
simply returning the empty extents.
2009-08-29 08:08:30 +01:00
Chris Wilson
4051ed328b [tessellator] Special case rectilinear tessellation
For the frequent cases where we know in advance that we are dealing with a
rectilinear path, but can not use the simple region code, implement a
variant of the Bentley-Ottmann tessellator. The advantages here are that
edge comparison is very simple (we only have vertical edges) and there are
no intersection, though possible overlaps. The idea is the same, maintain
a y-x sorted queue of start/stop events that demarcate traps and sweep
through the active edges at each event, looking for completed traps.

The motivation for this was noticing a performance regression in
box-fill-outline with the self-intersection work:

  1.9.2 to HEAD^: 3.66x slowdown
  HEAD^ to HEAD:  5.38x speedup
  1.9.2 to HEAD:  1.57x speedup

The cause of which was choosing to use spans instead of the region handling
code, as the complex polygon was no longer being tessellated.
2009-08-29 08:08:29 +01:00
Chris Wilson
82ccb4c70c [clip] Use special-purpose fill_to_region()
Avoid the creation of temporary traps when generating a region, by calling
the to_region() directly.
2009-08-29 08:08:29 +01:00
Chris Wilson
41adeac988 [fallback] Avoid going through traps for trivial regions. 2009-08-29 08:08:29 +01:00
Chris Wilson
55bd590561 [tessellator] Use a priority queue for the events
The skip list was suffering from severe overhead, so though the search was
quick, the extra copies during insertion and deletion were slow.
2009-08-29 08:08:29 +01:00
Chris Wilson
ebfcc2ce8f [tessellator] Remove the skiplist for the active edges
The active edge list is typically short, and the skiplist adds significant
overhead that far outweigh the benefit of the O(n lg n) sort. Instead we
track the position of the last insertion edge, knowing that the start
events are lexicographically sorted, and begin a linear search from there.
2009-08-29 08:08:29 +01:00
Chris Wilson
36480fe531 [traps] Increase exponential expansion factor.
Grow the traps more rapidly, as the allocations are very short-lived so
the over-allocation is less of an issue.
2009-08-29 08:08:28 +01:00
Chris Wilson
9d51c03bad [traps] Compute extents on demand. 2009-08-29 08:08:28 +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
Chris Wilson
7c499db8af [test] Minor tweak of ft-text-vertical-layout
Tidily destroy the font immediately after use.
2009-08-29 08:08:26 +01:00
Chris Wilson
bdd3c5ba69 [perf] Match directory names
In order to handle 'cairo-perf-trace benchmark', we need to perform the
can_run? test on the directory name as opposed to the individual trace
names. Make it so.
2009-08-29 08:08:26 +01:00
Chris Wilson
77c1109616 [perf] Reset global caches after every trace
I'd disabled this to look at cairo-qt performance, then forgot about it.
Be clean, cleanup globals -- this should fix the huge performance loss
when running in series multiple backends that need separate font caches.
2009-08-29 08:08:25 +01:00
Chris Wilson
9c8e60f771 [perf] Remove cpuset warning for cairo-perf-trace
These traces run for much longer than the original synthetic benchmarks
and seek to replicate 'real-world' applications, so the warning that the
xserver and cairo-perf are not bound to any cpu is false.
2009-08-29 08:08:25 +01:00
Chris Wilson
d07ed5d990 [perf] Add charting utility
cairo-perf-chart takes multiple runs (currently it is limited to
prefiltered data sets) and pretty-prints a chart showing performace
improvements/regressions (in either ASCII or HTML) along with a
cairo-perf-chart.png
2009-08-29 08:08:00 +01:00
Chris Wilson
015eccadcb [perf] Fix unaligned-clip
We failed to reset the scale after each loop, eventually generating a vast
clip-mask that exceeded memory capacity.
2009-08-26 23:51:43 +01:00
Chris Wilson
6f8fae21e6 [perf] Add a box mode to spiral
Add a very similar 'spiral' path (really just concentric boxes) that hit
the rectangular optimisations so that we can compare how effective they
are.
2009-08-26 23:51:43 +01:00
Chris Wilson
e79a9a87c3 [perf] Support objdir!=srcdir in cairo-perf-diff
Crude support to detect when we have cairo-perf-diff-files in the local
directory which is not srcdir.
2009-08-26 23:51:43 +01:00
Chris Wilson
6bfb77a33c [perf] Add spiral strokes
Use cairo_stroke() to perform the equivalent of
spiral-rect-(pix|non)align-evenodd-fill. A useful comparison of stroking
versus filling, as we can assume the composition costs are similar.
2009-08-26 23:51:42 +01:00
Chris Wilson
54b2935c38 [perf] Reset the path after each spiral
Oops we were accumulating paths during each spiral iteration and so the
tests were getting slower and slower and slower...

[And fix a couple of other instances of path accumulation.]
2009-08-26 23:51:42 +01:00
Chris Wilson
fddfe4973f [perf] Add clipped modes to dragon
Investigate the performance hit for unclipped/aligned/unaligned/masked
modes with a reasonably complex geometry.
2009-08-26 23:51:42 +01:00
Chris Wilson
8b3be26c7b [test] Remove misleading code/comments from a1-image-sample 2009-08-26 23:51:42 +01:00
Chris Wilson
e702df59b0 [test] Attempt to automatically detect running under gdb
A common mistake is to forget to pass the foreground mode to
cairo-test-suite when launching it under the debugger, resulting in the
debugger not attaching to the children and missing the error you were
trying to capture. Under linux, we can inspect the path to our parent's
executable and if that looks like gdb, we assume it is and disable forking
of traces.
2009-08-26 23:51:42 +01:00
Chris Wilson
bf4977b645 [test] Exit on first failure '-x'
Add a command line option to the test suite to cause it to exit after the
first failure. The purpose of this is for integration into 'git bisect run',
where the failing test is unknown and we are looking for any failure. For
example, for use in a regression script to find commits in the midst of as
series that need a refresh of a reference image (or fixing!).
2009-08-26 23:51:42 +01:00
Benjamin Otte
40aefac5d7 [xlib] DO_XCOPYAREA and DO_XTILE optimizations break with Window source
Cairo should include the contents of subwindows when using a Window as a
source but will clip to subwindows when using a Window as a destination.
This can be set using the GC's subwindow_mode.

XCopyArea and XFillRectangle can however only use one GC for both source
and destination. Cairo's mode is set to (the default) ClipByChildren.
This means that copying from a Window is broken, so we only allow the
optimization when we know that the source is a Pixmap.

The performance impact of this change has not been tested. It should be
small, as the code will use XRender otherwise.

If it turns out to be a bigger impact, the optimizations could be
improved by doing a two-step copy process:
1) Copy to an intermediate Pixmap with IncludeInferiors
2) Copy to the destination with ClipByChildren
(potentially omitting one one of the steps if source or destination are
known to be Pixmaps).

references:
commit 0c5d28a4e5
https://bugs.freedesktop.org/show_bug.cgi?id=12996
2009-08-26 21:22:52 +02:00
Behdad Esfahbod
90536ef2dd [build] Remove bogus warning that we require at least one native font backend
That limitation was lifted long ago after twin face was introduced.
2009-08-25 00:28:08 -04:00
Behdad Esfahbod
20e227fc39 [build] Fix typo 2009-08-24 23:57:21 -04:00
Søren Sandmann Pedersen
87fb9a9ded [test] Update reference image for the extended-blend-mode test.
A recent pixman change caused one-bit differences in some pixels.
2009-08-17 00:59:46 -04:00
Chris Wilson
d1b8e260d4 [qt] Fix compilation
Enabling 'FAST CLIP' appears to trigger an infinite loop so disable.

Enabling 'FAST FILL' has limited effect on performance, so disable whilst
the basic QT surface is improved.
2009-08-10 21:31:10 +01:00
Chris Wilson
dff0a91742 [xlib] Rewrite UNSUPPORTED() avoiding gcc-ism
Behdad pointed out that fprintf() returns a value so that we could simply
use the comma operator to return the correct value instead of the
expression-block gcc-ism.
2009-08-10 18:01:14 +01:00
Behdad Esfahbod
e63d725ad4 [utils] Remove unused code 2009-08-10 12:47:37 -04:00
Andrea Canciani
d4d0fcb4a8 [quartz] Compile fix for show_glyphs
Correct the prototype for _cairo_quartz_surface_show_glyphs().
2009-08-10 17:44:31 +01:00
Chris Wilson
2a2a19457b [surface] Check for a NULL snapshot
The backend is permitted to return a NULL surface when snapshotting to
indicate that it cannot (or choses not to) implement the method.
2009-08-10 17:44:25 +01:00
Chris Wilson
2e8ce34454 [quartz] Use the implementation font-face not the associated
As the associated is now explicitly the font-face used to create the font
by the user, whereas what we require is the current implementation
(quartz) font.
2009-08-10 17:20:00 +01:00
Chris Wilson
a4dc372bab [scaled-font] Update API documentation
Now that the toy-font-face is exposed to the user, it is expected to be
returned when the user queries the font face associated with a scaled font.
2009-08-10 17:19:53 +01:00
Chris Wilson
c4828666b9 [script] Handle translation of compressed strings.
After introducing the new syntax to mark a deflated string, we also need
to add the equivalent binary tokens.
2009-08-10 17:19:34 +01:00
Andrea Canciani
3487049195 [quartz] Fix one more compile error 2009-08-09 21:47:40 +01:00
Chris Wilson
c2e75b9993 [quartz] Attempt to fix compile errors
ranma42 spotted that the quartz-backend no longer compiled after bed270,
so once again attempt to blindly fix those errors...
2009-08-09 21:12:36 +01:00
Chris Wilson
81c4594712 [script] Ensure strings are nul terminated
Infrequently, but, for example, handling glyph strings, we require the
string to be nul terminated. (Otherwise an error occurs, which was
previously compounded by a drastic leak.)
2009-08-06 23:47:44 +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
af392f7e45 [script] Extend csi-replay to show how to use a single surface
Currently the replay creates a fresh surface for every new surface. Whilst
using it to view replays (such as with --xlib) this is often not what is
desired so add a mode (compile-time only for now) to use similar surfaces
and blits to the front buffer instead.
2009-08-06 23:19:52 +01:00
Chris Wilson
b7639a5f79 [trace] Close the dictionary before font
font expects the dictionary to be constructed on the stack for its use, so
close it. (I missed the closing '>>' when switching between dictionary
constructors.)
2009-08-06 10:55:18 +01:00
Chris Wilson
19f54d872f [gl] Move hidden cairo_gl_surface_create() proto to header
Make check-plt.sh happy
2009-08-06 10:40:32 +01:00
Chris Wilson
ee69f8aa5e [trace] Whitespace
A few gratuitous whitespace and increase the buffer size used whilst
reading in data files.
2009-08-06 10:30:52 +01:00
Chris Wilson
6d30021d65 [trace] Only write the 4 byte length to the stream
We were attempting to write out the whole length of the block when we were
just trying to write out the length value.
2009-08-06 10:29:49 +01:00
Chris Wilson
a439bd99d0 [perf] Compare drawing random curves
Extend the intersection tests with straight lines, with random curves as
well.
2009-08-06 10:17:21 +01:00
Chris Wilson
1327df2cf2 [pattern] Invalid access beyond end of freed-pool
Oops, we were attempting to return a pointer from beyond the end of our
array.
2009-08-06 10:16:45 +01:00
Chris Wilson
920f59a755 [build] Configure switch to disable atomics
Workaround for my arm toolchain which succeeds in linking the configure
program, only to complain when linking a program (such as cairo-perf)
against libcairo.so. Annoying.
2009-08-06 10:16:33 +01:00