Commit graph

4395 commits

Author SHA1 Message Date
Chris Wilson
e19b2866ed [gl] Actually remove the glyph from the rtree on scaled_font_fini
Mark the node as available when the scaled_glyph is finished, and then
attempt to collapse the parent node.
2009-07-27 13:16:30 -07:00
Chris Wilson
e0b7979a30 [gl] Switch to using the common rtree implementation. 2009-07-27 13:16:23 -07:00
Eric Anholt
37bf06d66e [gl] Fix handling of clip for glyphs (clip-operator test). 2009-07-27 13:16:23 -07:00
Eric Anholt
74f3351319 [gl] Switch the glyph cache to using VBOs.
This is a major performance improvement for GL even on non-TNL hardware
(i915), as we get to emit one giant DrawArrays and make GL drivers love us.
Now we're actually faster than not having the glyph cache.

Before glyph cache (HP 945GM):
[  0]       gl             firefox-20090601  238.103  238.195   0.35%    5/6
After:
[  0]       gl             firefox-20090601   68.181   76.735   5.46%    6/6
2009-07-27 13:16:23 -07:00
Eric Anholt
ee4138e587 [gl] Start adding glyph cache support.
This is pretty much cut-and-paste from ickle's cairo-drm-i915-surface, and
uses fixed function and doesn't use VBOs.
2009-07-27 13:16:23 -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
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
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
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
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
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
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
Chris Wilson
b71c27bf4e [gl] Remove dead code.
The loop between texture_setup() and clone_similar() should be
impossible, since every compositing backend should know how to clone an
image surface. cairo-gl is no longer an exception and so this code can
safely be removed.
2009-07-21 23:26:15 +01:00
Chris Wilson
c8cc6a205a [gl] Avoid temporary allocation of pixman trapezoids
When creating the trapezoid mask, avoid having to allocate a temporary
array to hold the converted pixman trapezoids by instead rasterizing each
trapezoid separately into the mask.
2009-07-21 23:08:39 +01:00
Chris Wilson
5deb8fa213 [gl] Construct a dummy window for the initial context
In order to make the initial context current we need a Drawable that
matches the context. In general, the RootWindow may not match the desired
context so we need to query the context and construct an appropriate
Drawable.
2009-07-21 22:54:21 +01:00
Chris Wilson
911482e5ae [gl] Constrain image sources to max texture size 2009-07-21 22:30:14 +01:00
Chris Wilson
1ae5942a3a Merge commit 'anholt/gl'
Conflicts:
	boilerplate/Makefile.sources
	boilerplate/cairo-boilerplate.c
	build/configure.ac.features
	src/cairo.h
	util/cairo-script/Makefile.am
2009-07-21 22:28:44 +01:00
Chris Wilson
aac256b269 Compile fixes for mingw32.
Trivial typos found whilst using a cross-compiler.
2009-07-18 16:18:13 +01:00
Chris Wilson
52fa8760ae Add OpenVG backend.
Based on the work by Øyvind Kolås and Pierre Tardy -- many thanks to
Pierre for pushing this backend for inclusion as well as testing and
reviewing my initial patch. And many more thanks to pippin for writing the
backend in the first place!

Hacked and chopped by myself into a suitable basis for a backend. Quite a
few issues remain open, but would seem to be ready for testing on suitable
hardware.
2009-07-17 11:50:02 +01:00
Chris Wilson
34d5b862bc [xlib] Enable Render support for the extended PDF operators
With the latest 0.11 release of renderproto we now have the ability to
use the extended PDF operators via Render.
2009-07-16 14:18:13 +01:00
Tobias Hunger
01eec61f4f [qt] Remove use of unnecessary QBrush pointer
QBrush is a implicitly shared datastructure. There is on need to layer
"explicit pointer based sharing" atop of it.

Mozilla Bug #498871
2009-07-16 00:16:59 -04:00
Tobias Hunger
222c12cc4e [qt] Remove use of unnecessary QPen pointer
QPen is a implicitly shared class, so there is no need to do explicit sharing
via pointers.

Mozilla Bug #498873
2009-07-16 00:16:59 -04:00
Tobias Hunger
0797b2fcaa [qt] Cleanup some whitespace
Mozilla bug #498843
2009-07-16 00:16:59 -04:00
Tobias Hunger
d782ba04b7 [qt] Add method to flush qpainter
This is required for non-X11 rendering backends.

Mozilla bug #498910
2009-07-16 00:16:58 -04:00
Tobias Hunger
e713857b85 [qt] Move _opstr() inside the #if 0 to avoid warnings
Mozilla bug #498917
2009-07-16 00:16:58 -04:00
Tobias Hunger
4f9551e5e5 [qt] Reduce padding in cairo_qt_surface_t struct
Removes 4 bytes of padding (on a 32bit system) from the datastructure by
reordering the members.

Mozilla bug #498880
2009-07-16 00:16:57 -04:00
Chris Wilson
8c55ca9ebc [directfb] Silence compiler warnings.
Add extended blend mode to operator switch.
2009-07-14 16:54:51 +01:00
Chris Wilson
8ad3fca210 [glitz] Extended blend mode support
Ensure that we fallback given an extended operator.
2009-07-14 16:51:31 +01:00
Chris Wilson
333d37a60f [pdf] Silence copmiler.
Fill in missing case values to silence the compiler, and remind us should
we every add more operators in future.
2009-07-14 16:41:00 +01:00
Chris Wilson
710308c64e [script] Extended blend mode support. 2009-07-14 16:31:41 +01:00
Chris Wilson
100f0d94ee [cairo] Remove trailing spaces in comments.
vim highlights these errors making my screen go red and upsets me.
So they must die.
2009-07-14 16:30:36 +01:00
Emmanuel Pacaud
75736603d3 [SVG] Add extended blend modes. 2009-07-14 16:05:10 +02:00