Commit graph

7347 commits

Author SHA1 Message Date
Chris Wilson
786d1f962a [xlib] Use server-side gradients.
We can offload creation of gradients to server that support RENDER 0.10
and later. This greatly reduces the amount of traffic we need to send over
our display connection as the gradient patterns are much smaller than the
full image. Even if the server fallbacks to using pixman, performance
should be improved by the reduced transport overhead. Furthermore this is a
requisite to enable hardware accelerated gradients with the xlib backend.

Running cairo-perf-trace on tiny, Celeron/i915:

  before: firefox-20090601 211.585
   after: firefox-20090601 270.939

and on tiger, CoreDuo/nvidia:

  before: firefox-20090601 70.143
   after: firefox-20090601 87.326

where linear gradients are used extensively throughout the GTK+ theme.
Not quite the result I was expecting!

In particular, looking at tiny:

 xlib-rgba paint-with-alpha_linear-rgba_over-512   47.11 (47.16 0.05%) -> 123.42 (123.72 0.13%):  2.62x slowdown
█▋
 xlib-rgba paint-with-alpha_linear3-rgba_over-512   47.27 (47.32 0.04%) -> 123.78 (124.04 0.13%):  2.62x slowdown
█▋
 xlib-rgba paint-with-alpha_linear-rgb_over-512   47.19 (47.21 0.02%) -> 123.37 (123.70 0.13%):  2.61x slowdown
█▋
 xlib-rgba paint-with-alpha_linear3-rgb_over-512   47.30 (47.31 0.04%) -> 123.52 (123.62 0.09%):  2.61x slowdown
█▋
 xlib-rgba     paint_linear3-rgb_over-512   47.29 (47.32 0.05%) -> 118.95 (119.60 0.29%):  2.52x slowdown
█▌
 xlib-rgba     paint_linear-rgba_over-512   47.14 (47.17 0.06%) -> 116.76 (117.06 0.16%):  2.48x slowdown
█▌
 xlib-rgba    paint_linear3-rgba_over-512   47.32 (47.34 0.04%) -> 116.85 (116.98 0.05%):  2.47x slowdown
█▌
 xlib-rgba      paint_linear-rgb_over-512   47.15 (47.19 0.03%) -> 114.08 (114.55 0.20%):  2.42x slowdown
█▍
 xlib-rgba paint-with-alpha_radial-rgb_over-512  117.25 (119.43 1.21%) -> 194.36 (194.73 0.09%):  1.66x slowdown
▋
 xlib-rgba paint-with-alpha_radial-rgba_over-512  117.22 (117.26 0.02%) -> 193.81 (194.17 0.11%):  1.65x slowdown
▋
 xlib-rgba     paint_radial-rgba_over-512  117.23 (117.26 0.02%) -> 186.35 (186.41 0.03%):  1.59x slowdown
▋
 xlib-rgba      paint_radial-rgb_over-512  117.23 (117.27 0.02%) -> 184.14 (184.62 1.51%):  1.57x slowdown
▋

Before 1.10, we may choose to disable server-side gradients for the
current crop of Xorg servers, similar to the extended repeat modes.

[Updated by Chris Wilson. All bugs are his.]
2009-07-31 14:33:01 +01:00
Chris Wilson
53cbbad8fb [xlib] Disable extended repeat modes if RENDER < 0.10
The extended repeat modes were only introduced in RENDER 0.10, so disable
them if the server reports an earlier version. This is in addition to
disabling the repeat modes if we know (guess!) the server to have a buggy
implementation.
2009-07-31 13:17:23 +01:00
Chris Wilson
e283e53563 [perf] Print min_ticks in report
As the change and ranking is based on the min_ticks, and as this can
sometimes deviate wildly from median_ticks, include min_ticks in the
output.

In particular it helps to explain cases like:

xlib-rgba rectangles_similar-rgba-mag_source-512    10.13 88.41% ->   5.77 0.19%:  1.50x slowdown

which becomes

xlib-rgba rectangles_similar-rgba-mag_source-512    3.83 (10.13 88.41%) ->   5.75 (5.77 0.19%):  1.50x slowdown

(Considering the poor standard deviation on the initial measurement, this
is more likely a sampling error than a true regression.)
2009-07-31 10:51:30 +01:00
Chris Wilson
ce8a8424aa [perf] Change the order of slowdowns.
More the large slowdowns to the end. This has two pleasing effects:

  1. There is symmetry between large speedups at the top, and large
     slowdowns at the bottom, with long bars -> short bars -> long bars.

  2. After a cairo-perf-diff run the largest slowdowns are immediately
     visible on the console. What better way to flag performance
     regressions?
2009-07-31 09:43:12 +01:00
Chris Wilson
877ed645f9 [perf] Add a more complex fill, a set of rings
In investigating performance regressions with the wip/tessellator, I'm
keen to inspect how the tessellator scales with polygon complexity.
2009-07-31 09:43:12 +01:00
Chris Wilson
3dbc4170f0 [perf] Add a single shot long-lines
Compare the performance of self-intersection removal by comparing the cost
of individually stroking each line versus stroking them all en-mass.
2009-07-31 09:43:12 +01:00
Chris Wilson
2f033af5ab [perf] Fix the asymmetry in long lines
We missed the final long diagonal to the bottom-right.
2009-07-31 09:43:12 +01:00
Chris Wilson
944206e55b [perf] Correct typo in long-lines.c
Computed may_y using height not width, fortunately the test cases have
always been square.
2009-07-31 09:43:12 +01:00
Chris Wilson
229887e980 [perf] Check output
Add a CAIRO_PERF_OUTPUT environment variable to cause cairo-perf to first
generate an output image in order to manually check that the test is
functioning correctly. This needs to be automated, so that we have
absolute confidence that the performance tests are not broken - but isn't
that the role of the test suite? If we were ever to publish cairo-perf
results, I would want some means of verification that the test-suite had
first been passed.
2009-07-31 09:39:38 +01:00
Chris Wilson
8c6ecfe648 [perf] Remove the warning about failing to open a directory
The warning is repeated in the error message if we fail to find any
traces, and now that we search a path it is likely that some elements do
not exist. Thus we annoy the user with irrelevant, non-fatal warnings.

Still looking for suggestions for the most appropriate home for the system
wide cairo-traces dir...
2009-07-29 16:19:21 +01:00
Chris Wilson
8c1aed17ca [perf] Add another stroking micro-benchmark
The original stroke only contains a single subpath. Self-intersection
removal particularly affects strokes with multiple curved segments, so add
a path that encompasses both straight edges and rounded corners.
2009-07-29 16:17:12 +01:00
Chris Wilson
71f5649846 [path] Fix iter to handle circular list of buffers
When switching the path over to use the circularly linked list, 73f801,
I missed updating the path iterator.
2009-07-29 16:17:12 +01:00
Chris Wilson
acfcf4a31b [path] Remove the broken rel-curve-to as line-to
As pointed out by Andrea, and now tested by test/degenerate-rel-curve-to,
this attempt at removing degenerate curve-to was broken.
2009-07-29 16:17:11 +01:00
Chris Wilson
81d3e15e6c [test] Yet another bug in curve-to as line-to.
Andrea Canciani (ranma42) found another instance of my broken 'degenerate'
curve-to as line-to optimisation. All I can say is when I do something
wrong, at least I'm consistent!

This test case highlights the bug in the rel-curve-to path.
2009-07-29 16:17:11 +01:00
Adrian Johnson
922b1fe8e3 Ensure Type 3 fonts do not use the name .notdef in the PS encoding 2009-07-28 22:34:42 +09:30
Adrian Johnson
5440055fc0 Ensure Type 3 fonts do not add a .notdef glyph 2009-07-28 21:34:28 +09:30
Adrian Johnson
1ae5a41951 PDF: Only Type 3 fonts should include glyph 0 in /ToUnicode
4c498098 made all 8-bit fonts include glyph 0 which incorrectly
included Type 1 fallback fonts.
2009-07-28 21:34:28 +09:30
Chris Wilson
c11f369057 [perf] Avoid NULL derefs on broken result files.
Instead of testing for a NULL return we checked that the pointer didn't
point to NIL. Oops.
2009-07-28 13:02:10 +01:00
Chris Wilson
19f4498234 [test] Wrap yet another call to get_image_surface() inside a timeout.
I missed this call to get_image_surface() that is now being hit having
restored the reference image for dash-infinite-loop.
2009-07-28 12:58:07 +01:00
Chris Wilson
e2f912dc5b [script] Add cvi, cvr, mod
Add implementations of convert-to-integer, convert-to-real and modulus
supplied by Zack Weinberg <zweinberg@mozilla.com>.
2009-07-28 09:32:36 +01:00
Chris Wilson
24b5ac6377 [test] Add timeouts around finishing and converting surfaces to images.
In order to catch infinite loops whilst replaying and converting vector
surfaces to images (via external renderers) we need to also install
alarms around the calls to finish() and get_image().
2009-07-28 08:41:50 +01:00
M Joonas Pihlaja
dacc380dd9 [test] Test extremely small dash lengths.
The stroker code is liable to wedge when passed
dash patterns which don't advance the dash offset
due to limited precision arithmetic.  This test
attempts to hit all the places in the stroker where
that can happen.

Reported on the cairo mailing list by Hans Breuer:

http://lists.cairographics.org/archives/cairo/2009-June/017506.html
2009-07-28 08:41:49 +01:00
Chris Wilson
128d6fb2da [path] Remove the erroneous conversion of a 'zero-length' curve-to
As pointed out by Andrea, and now tested by test/degenerate-curve-to, a
curve-to that begins and ends on the same point may extend further due to
its control points. It can not be simply replaced with a degenerate
line-to. In order to do so we will need more extensive degeneracy
checking, ala _cairo_spline_init().
2009-07-28 08:37:54 +01:00
Chris Wilson
660c389d11 [test] Add degenerate-curve-to
Andrea Canciani (ranma42) pointed out a second bug in the curve-to as
line-to optimisation, that is a curve starting and finishing on the same
point is not necessarily degenerate. This test case exercises 5 different
curves that start and end on the same point.
2009-07-28 08:37:03 +01:00
Carl Worth
d31de83e01 Mark curve-to-as-line-to as XFAIL for PS backend.
Looks like ghostscript has a similar buggy optimization like we
just fixed in cairo. I'm just waiting on a new bugzilla account
from bugs.ghostscript.com after which I plan to report the bug
there.
2009-07-27 15:58:27 -07:00
Carl Worth
45919a4f0c Revert "[path] Convert straight curve-to to line-to"
This reverts commit c72ca2f229.

This commit was broken as verified by the curve-to-as-line-to test
case.
2009-07-27 15:45:55 -07:00
Carl Worth
5bed405b27 Revert "[spline] Treat a straight spline as degenerate."
This reverts commit f3d265559a.

This commit was broken as verified by the curve-to-as-line-to test
case.
2009-07-27 15:45:15 -07:00
Carl Worth
01acad1659 Merge branch 'master' of git.cairographics.org:/git/cairo 2009-07-27 15:26:19 -07:00
Carl Worth
3cc9a6050d Add new test: curve-to-as-line-to
This test anticipates a future optimization, (already pushed
upstream but not pulled yet), with a buggy implementation
of replacing curve_to with line_to.
2009-07-27 15:24:55 -07:00
Chris Wilson
cf15aed0c4 [xlib] Add a timely reminder to ensure that bugs are properly filed.
In a discussion on IRC, attention was drawn to a dubious comment in
_cairo_xlib_show_glyphs() - the precise details of which have passed
out of the collective memory.
2009-07-27 19:18:21 +01:00
Chris Wilson
2da01ed552 [rtree] Merge the common unpin_and_evict_unused() routine
Having written the same method to prune glyphs from the rtree three times,
I thought wise to add the common method to the core routines.
2009-07-27 18:23:11 +01:00
Chris Wilson
9f6a0f5668 [paginated] Propagate error return during finish.
In bed2701, I removed the explicit finish of the paginated's target
surface, since as a wrapper it did not explicitly own the surface and so
should not be calling finish(). However, we do need to propagate errors
from the backing surface, such as PDF, which will only be detected during
the implicit finish in the final destroy. So check to see it we hold the
last reference to the target (and so our destroy will trigger the implicit
finish) and call the finish explicitly and check the error status
afterwards.
2009-07-27 14:05:04 +01:00
Chris Wilson
6ca3720ba6 [test] Overlapping glyphs
Add a test case to explicitly check handling of overlapping glyphs.
2009-07-27 10:19:03 +01:00
Chris Wilson
09a2b2ed31 [xlib] Fast-path the likely case of retrieving a known xrender_format
If we know the CPU can read pointers atomically, then we can simply peek
into the cached_xrender_formats to see if we already have a match, before
taking the mutex. (Acquiring the mutex here is a minor nuisance that
appears on the callgrind profiles.)
2009-07-27 10:18:59 +01:00
Chris Wilson
efb3445ee1 Add a simple rectangle tree (rtree) implementation
In order to efficient store small images, we need to pack them into a
large texture. The rtree handles allocation of small rectangles out of a
much larger whole. As well as tracking free rectangles, it can also be
used to note which parts of the texture are 'pinned' -- that is have
operations currently pending and so can not be modified until that batch
of operations have been flushed. When the rtree is full, i.e. there is no
single free rectangle to accommodate the allocation request, it will
randomly evict an unpinned block large enough to fit the request. The
block may comprise just a single glyph, or a subtree of many glyphs. This
may not be the best strategy, but it is an effective start.
2009-07-27 10:18:26 +01:00
Chris Wilson
c72ca2f229 [path] Convert straight curve-to to line-to
Avoid the high cost associated with curves if we can convert the curve to
a straight line.
2009-07-27 10:18:25 +01:00
Chris Wilson
f3d265559a [spline] Treat a straight spline as degenerate.
The fallback for degenerate splines is to treat them as a line-to, so if
the spline is straight, we can just replace it with a simple line-to by
treating as degenerate.
2009-07-27 10:18:25 +01:00
Chris Wilson
25858d524d [script] Fix reference to font source after transferring to mmap
After diverting the pointers to accommodate lazy decompressing of the
source, the bytecode pointer was left pointing to the original location
that had already been freed - thus passing an invalid block to FreeType
and unsurprisingly then, blowing up.
2009-07-27 10:18:25 +01:00
Chris Wilson
ede0f7e7df [pdf] Eliminate redundant whole-page clip.
We do not to emit a clip if it covers the whole page.
2009-07-27 10:18:20 +01:00
Adrian Johnson
4c498098c0 PDF: Fix glyph 0 in toUnicode stream when using user fonts
_cairo_pdf_surface_emit_to_unicode_stream() was reserving glyph 0 for
the .notdef glyph (as required by TrueType/CFF/Type1 fallback
fonts). However Type 3 fonts do not reserve glyph 0 for .notdef and
need glyph 0 to be included in the toUnicode stream.

http://lists.cairographics.org/archives/cairo/2009-July/017731.html
2009-07-24 21:39:23 +09:30
Chris Wilson
e577096dff [boilerplate] Fix compilation against old revisions (as old as 1.9.2!) 2009-07-24 10:57:26 +01:00
Chris Wilson
0466053099 [image] Discard redundant clears
On slow machines the call to pixman_fill_sse2() on similar surfaces that
we know are already zeroed takes a significant amount of time [12.77% of
the profile for a firefox trace, cf to just 3% of the profile is spent
inside memset].

Rather than solve why the pixman_fill_sse2() is so slow, simply skip the
redundant clears.
2009-07-24 10:44:04 +01:00
Chris Wilson
8b8e03503d [script] mark scan_read() inline
Small function that is critical to performance whilst scanning scripts.
2009-07-24 10:44:04 +01:00
Chris Wilson
f02ba09475 [xlib] Check workqueue before taking the display mutex
Optimistically check to see if there is any outstanding work before
checking under the mutex. We don't care if we occasionally do not run the
queue this time due to contention, since we will most likely check again
very shortly or clean up with the display.
2009-07-24 10:44:04 +01:00
Chris Wilson
4dc62bbedc [test] Extend radial gradients to check r2 < r1
Include additional gradients to cover the cases where r1 > r2, as a pixman
bug was exposed by:
   [Bug 22908] Invalid output of radial gradient
   http://bugs.freedesktop.org/show_bug.cgi?id=22908
2009-07-24 10:44:03 +01:00
Chris Wilson
e98e2690cb [test] Fix use of uninitialized widths.
user-font-rescale copied unitialized values from the widths array into
the desired array. Although these corresponded to unused glyphs and so
were never used during the rendering, the values may have been illegal
causing FPE as they were copied.
2009-07-24 10:44:03 +01:00
Chris Wilson
596dec9561 [test] Trap SIGFPE
Note the crash if we hit a floating-point exception.
2009-07-24 10:44:03 +01:00
Chris Wilson
0561539880 [scaled-font] cairo_scaled_font_glyph_extents() initialise extents
Ensure that the extents are zeroed on error.
2009-07-24 10:44:03 +01:00
Chris Wilson
5c843b5f8e [scaled-font] Skip empty glyphs
Skip the composition of empty glyphs - prevents redundant calls through
the stack.
2009-07-24 10:44:03 +01:00
Chris Wilson
0c4692a1d0 [perf] Specify html file on cmdline instead of redirecting all output
Redirecting all output was causing the build messages to be entangled with
the Performance Change html.
2009-07-24 10:44:03 +01:00