Commit graph

7328 commits

Author SHA1 Message Date
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
Chris Wilson
1ec1d6148e [perf] Compare performance against most recent tag. 2009-07-24 10:44:02 +01:00
Chris Wilson
9d7fd626c3 [script] Decompress font sources
Need to decompress patterns and embedded bytecode before passing to
fontconfig/FreeType.
2009-07-23 17:05:28 +01:00
Chris Wilson
5d8f366581 [test] clip representation is no longer surface dependent
So we can test the api just once in the preamble and not per-target.
2009-07-23 16:36:02 +01:00
Chris Wilson
c3f2db4f73 [drm] Add an accelerated image surface.
Use the DRM interface to h/w accelerate composition on image surfaces.
The purpose of the backend is simply to explore what such a hardware
interface might look like and what benefits we might expect.  The
use case that might justify writing such custom backends are embedded
devices running a drm compositor like wayland - which would, for example,
allow one to write applications that seamlessly integrated accelerated,
dynamic, high quality 2D graphics using Cairo with advanced interaction
(e.g. smooth animations in the UI) driven by a clutter framework...

In this first step we introduce the fundamental wrapping of GEM for intel
and radeon chipsets, and, for comparison, gallium. No acceleration, all
we do is use buffer objects (that is use the kernel memory manager) to
allocate images and simply use the fallback mechanism. This provides a
suitable base to start writing chip specific drivers.
2009-07-23 16:18:42 +01:00
Chris Wilson
bed2701e1c Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)

In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.

Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:

ppc:
Speedups
========
image-rgba         evolution-20090607-0    1026085.22 0.18% -> 672972.07 0.77%:  1.52x speedup
▌
image-rgba         evolution-20090618-0    680579.98 0.12% -> 573237.66  0.16%:  1.19x speedup
▎
image-rgba      swfdec-fill-rate-4xaa-0    460296.92 0.36% -> 407464.63  0.42%:  1.13x speedup
▏
image-rgba      swfdec-fill-rate-2xaa-0    128431.95 0.47% -> 115051.86  0.42%:  1.12x speedup
▏
Slowdowns
=========
image-rgba     firefox-periodic-table-0    56837.61 0.78% -> 66055.17    3.20%:  1.09x slowdown
▏
2009-07-23 15:32:14 +01:00
Chris Wilson
f5a1cdf283 [gl] Simplify the common CLEAR of a surface
Almost every surface is at sometime cleared, so catch the operation in
paint(), and emit a simple glClear() instead.
2009-07-23 15:32:12 +01:00
Chris Wilson
eed17527f6 [gl] Do not use unchecked GL v1.5 features
The span renderer uses ARB_vertex_buffer_object which was included into
the core as part of OpenGL 1.5. We failed to check for the required version
during initialisation, and to my surprise the i915 can only support OpenGL
1.4 as it lacks ARB_occlusion_query. So just use the ARB extension instead
which is present on i915.
2009-07-23 15:32:12 +01:00
Chris Wilson
6c28c7a1e2 [perf] Add a simple report printer.
After a run, it can be useful to reprint the results, so add
cairo-perf-print to perform that task.

For the future, I'd like to move the performance suite over to the
git/perf style of single, multi-function binary.

The sequence of operations that I typically do are:

./cairo-perf-trace -r -v -i 6 > `git describe`.`hostname`.perf
./cairo-perf-diff-files REVA REVB
./cairo-perf-print REVA
./cairo-perf-compare-backends REVA

which misses the caching available with cairo-perf-diff. 'make html' is
almost what I want, but still too prescriptive. However, that does need to
be addressed for continuous performance monitoring.

Along the perf lines, those sequence of operations become:
  ./cairo-perf record -i 6
  ./cairo-perf report
  ./cairo-perf report REVA REVB
  ./cairo-perf report --backends="image,xlib,gl" REVA REVB
  ./cairo-perf report --html REVA REVB

Also we want to think about installing the cairo-perf binary. So we want
to differentiate when run inside a git checkout.
2009-07-23 15:32:12 +01:00
Chris Wilson
92ba74d760 [vg] Compile fixes for EGL boilerplate 2009-07-23 15:32:12 +01:00
Chris Wilson
bfbe875ded [gl] Enable GL backend for cairo-perf-trace 2009-07-22 07:52:30 +01:00
Chris Wilson
fed0006203 [NEWS] Add stub for OpenGL. 2009-07-22 07:49:05 +01:00
Chris Wilson
bff0b11634 [gl] Update reference images 2009-07-22 07:45:21 +01:00
Chris Wilson
653351cd2e [gl] Copy font options from image backend.
Enable hint metrics similar to the default image backend. However,
consider using the display stored in the GLX context to query the screen
default.
2009-07-22 07:38:24 +01:00
Chris Wilson
a2ac67274d [gl] Add warning about missing hook for XCloseDisplay(). 2009-07-22 00:05:07 +01:00
Chris Wilson
f2f42ec70a [gl] Apply pixel sample bias for spans 2009-07-22 00:01:22 +01:00
Chris Wilson
9e420f5d06 [gl] Another whitespace pass. 2009-07-21 23:46:40 +01:00
Chris Wilson
222fd8b49b Merge commit 'anholt/gl-span-renderer' 2009-07-21 23:42:34 +01:00
Chris Wilson
5471603b52 [gl] Use QUADS for drawing fill_rectangles() not TRIFAN
As each rectangle is independent, we need to draw the array using QUADS.
2009-07-21 23:38:05 +01:00
Chris Wilson
c3ef0c8d20 [gl] Whitespace
Ensure we leave a space between a function call and its parameters.
2009-07-21 23:31:30 +01:00