Commit graph

8614 commits

Author SHA1 Message Date
Andrea Canciani
baaf312e04 pattern: remove content field from solid patterns
The content field in solid patterns had ill-defined semantic (or no
semantic at all), thus it can be removed.
2010-06-10 16:07:41 +02:00
Andrea Canciani
7461947eb1 surface: remove content argument from is_similar
The content argument was basically unuses.

Xlib change extracted from ickle's wip/compositor branch.
2010-06-10 16:07:41 +02:00
Chris Wilson
ef5f9b5c61 test: Update partial coverage.
Gah, no wonder the output looked wrong for the triangles, they only
covered half the pixel. So separate triangles into two cases.
2010-06-10 14:18:11 +01:00
Chris Wilson
8d67186cb2 gstate: Track whether the combination of ctm * device is identity.
In the fairly common condition that both the ctm and the device
transforms are identity, the function overhead of calling the matrix
multiplication on the point overwhelmingly dominates.
2010-06-10 13:13:12 +01:00
Chris Wilson
1349728d1e test: Add partial coverage.
Another experiment in measuring consistency of rasterisation stratagems
across the backends.
2010-06-10 13:13:12 +01:00
Chris Wilson
486118361a test: Fix half-coverage colouration.
Hmm, red over red makes the test pointless. The test still remains of
highly dubious quality, as it primarily serves as a rendercheck more
than a test of Cairo. The best hope for this test is that it inspires a
better one.

And incorporate the notes made by Joonas.
2010-06-10 12:05:41 +01:00
Dmitri Vorobiev
5cb764850f scaled-font: optimize cairo_scaled_font_text_to_glyphs()
This patch serves two purposes. First, it factors out the heavy part
of the cairo_scaled_font_text_to_glyphs() routine thus allowing GCC
to better optimize the cache cleanup loop. Keeping the look-up table
indices in a separate array speeds up array initialization even further.

Second, this patch introduces a shortcut for the case when the string
to be rendered consists of a single character. In this case, caching is
not necessary at all.

We have a benchmark that uses Cairo to render a large amount of random
strings of consisting of printable ASCII characters. Below are Oprofile
results collected while running this benchmark. It is easy to see that
the heavy part becomes noticeably lighter.

Before:

Profiling through timer interrupt
samples  %        app name                 symbol name
198755   13.5580  libcairo.so.2.10907.0    cairo_scaled_font_text_to_glyphs
88580     6.0424  libcairo.so.2.10907.0    _cairo_scaled_glyph_lookup
81127     5.5340  libcairo.so.2.10907.0    _cairo_hash_table_lookup
68186     4.6513  libcairo.so.2.10907.0    cairo_scaled_font_glyph_extents
47145     3.2160  libcairo.so.2.10907.0    _composite_glyphs_via_mask
46327     3.1602  libcairo.so.2.10907.0    _cairo_scaled_font_glyph_device_extents
44817     3.0572  libcairo.so.2.10907.0    _composite_glyphs
40431     2.7580  libcairo.so.2.10907.0    .plt

After (note that cairo_scaled_font_text_to_glyphs_internal_single() was inlined):

Profiling through timer interrupt
samples  %        app name                 symbol name
107264    7.6406  libcairo.so.2.10907.0    cairo_scaled_font_text_to_glyphs_internal_multiple
87888     6.2604  libcairo.so.2.10907.0    _cairo_scaled_glyph_lookup
79011     5.6281  libcairo.so.2.10907.0    _cairo_hash_table_lookup
71723     5.1090  libcairo.so.2.10907.0    cairo_scaled_font_glyph_extents
48084     3.4251  libcairo.so.2.10907.0    _composite_glyphs_via_mask
46636     3.3220  libcairo.so.2.10907.0    _cairo_scaled_font_glyph_device_extents
44740     3.1869  libcairo.so.2.10907.0    _composite_glyphs
42472     3.0254  libc-2.8.so              _int_malloc
39194     2.7919  libcairo.so.2.10907.0    _cairo_gstate_transform_glyphs_to_backend
38614     2.7506  libcairo.so.2.10907.0    .plt
37063     2.6401  libcairo.so.2.10907.0    _cairo_ft_ucs4_to_index
36856     2.6253  libc-2.8.so              random
36376     2.5911  libcairo.so.2.10907.0    _cairo_scaled_glyphs_equal
34545     2.4607  libcairo.so.2.10907.0    cairo_matrix_transform_point
31690     2.2573  libc-2.8.so              malloc
29395     2.0939  libcairo.so.2.10907.0    _cairo_matrix_is_identity
26142     1.8621  libcairo.so.2.10907.0    _cairo_utf8_to_ucs4
24406     1.7385  libc-2.8.so              free
24059     1.7138  libcairo.so.2.10907.0    cairo_scaled_font_text_to_glyphs

[ickle: slightly amended for stylistic consistency.]
2010-06-10 12:05:41 +01:00
Andrea Canciani
c43399fa68 gl: fix compilation on MacOS X
MacOS X uses different defines to avoid multiple inclusion of GL
header files. Adding them to glew.h fixes the compilation when GL is
enabled.
2010-06-09 17:53:09 +02:00
Chris Wilson
6eb5f859f1 bo: And disable DEBUG_TRAPS again.
Meh. I'm going back to bed. Thanks Joonas for catching this.
2010-06-09 10:40:32 +01:00
Chris Wilson
85af0ec374 test: Add half-coverage to exercise the rasteriser with subpixel geometry. 2010-06-09 10:34:06 +01:00
Chris Wilson
56c081bdc6 bo: Fix debugging for changes in internal traps api. 2010-06-09 10:33:01 +01:00
Benjamin Otte
a946d39555 gl: Add support for clip regions to the span renderer
Clip surface support is still missing, but i suppose that'd need a tiny
bit more code...
2010-06-08 22:23:12 +02:00
Benjamin Otte
f61b3f25af gl: Add an assertion that we always have a texture
When painting, the sources must be textures and not windows, and we did
that wrong previously. This assertion makes sure that never happens
again.
2010-06-08 22:23:12 +02:00
Benjamin Otte
c6c9a24a1d gl: Use CAIRO_COLOR_BLACK
... instead of creating black on our own - and wrong, too.
2010-06-08 22:23:12 +02:00
Benjamin Otte
19bc6793d1 gl: Only clone texture surfaces
Using non-texture surfaces as source or mask will fail, so we need to
fallback.
Caught by the subsurface-modify-child test.
2010-06-08 22:23:12 +02:00
Benjamin Otte
44483d843e gl: Fix argument order
oops...
2010-06-08 22:23:12 +02:00
Benjamin Otte
72bf1a5367 Update my copyright notices to preferred version
No more copyright headers containing my name.
2010-06-08 22:23:12 +02:00
Andrea Canciani
10d95c7020 test: add/update reference images
Add missing reference images and update one-stop references according
to current subset policy (outside the defined range, the gradient
is clear).
2010-06-08 20:53:31 +02:00
Andrea Canciani
dd0f887271 test: fix typo 2010-06-08 16:42:44 +02:00
Andrea Canciani
9b88b5dce5 test: add degenerate gradient and single stop tests
Add tests for degeneratate linear gradients (with start point equal
to the end point), degenerate radial gradients (start radius and end
radius equal to zero, same start and end circle) and gradients (both
linear and radial) with just a single stop.
2010-06-08 16:37:01 +02:00
Benjamin Otte
7d8359721b gl: Fix span renderer doing bad stuff for CLEAR and SOURCE
SOURCE will fallback now, CLEAR is identical to DEST_OUT with white.
2010-06-07 16:46:46 +02:00
Benjamin Otte
ef8fd1355e gl: Fix span renderer for unbounded spans
The span renderer used to not output rects for the top and bottom rows
when they didn't contain any spans.
2010-06-07 15:03:37 +02:00
Benjamin Otte
1d11af083f gl: Add a simple spans renderer for stroke/fill
It's very simple as clipped polygons or ANTIALIAS_NONE still return
UNSUPPORTED. Also, no optimizations are done, so even pixel-aligned
rectangles use the full span rendering.

Still, there are no performance regressions in the benchmark traces and
firefox-talos-svg and swfdec-giant-steps both got ~15% faster.
2010-06-07 13:37:49 +02:00
Benjamin Otte
550335efed Remove _cairo_surface_composite_trapezoids_as_polygon()
The function computed the composite rectangles wrong and was only used
in a gl fallback anyway. So instead of trying to fix it, just remove it
and make sure gl doesn't fallback.
2010-06-07 13:37:49 +02:00
Benjamin Otte
1e003fce8f gl: Fix vertex size changes not causing updates of the operands
Check vertex size stays identical when setting up vertices.
2010-06-07 13:37:49 +02:00
Benjamin Otte
39143400dd gl: Add a gradient texture cache
For firefox-planet-gnome, 19135 times a gradient gets rendered using
only 10 different gradients. So we get a 100% hit rate in the cache.
Unfortunately, texture upload is not the biggest problem of this test,
as the performance increase is only moderate - at least on i965:
34.3s => 33.5s
2010-06-07 13:37:49 +02:00
Benjamin Otte
932ab2641e device: flush before setting finished
Otherwise APIs critical for flushing - in particular acquiring the
device - do not work.
2010-06-07 13:37:49 +02:00
Benjamin Otte
35e219d08f gl: Make gradient textures a separate object
This is necessary so we can do proper refcounting and don't delete the
gradient texture prematurely.
2010-06-07 13:37:49 +02:00
Benjamin Otte
9c17a477d2 gl: Use the generic functions for filter/extend in gradients 2010-06-07 13:37:49 +02:00
Benjamin Otte
df93802765 gl: Create separate functions for setting extend and filter 2010-06-07 13:37:49 +02:00
Benjamin Otte
10e71806d2 gl: Switch to deferred rendering
1) call _cairo_gl_composite_flush() or cairo_surface_flush() where
   needed
2) Destroy texture operands when necessary
3) get rid of _cairo_gl_composite_end()

With this patch, vertices are not flushed immediately anymore, but only
when needed or when a new set of vertices is emitted that requires an
incompatible setup. This improves performance a lot in particular for
text. (gnome-terminal-vim gets 10x faster)
2010-06-07 13:37:48 +02:00
Benjamin Otte
f2f79ca1b3 gl: Make using shaders an explicit argument
This is preparation for a followup patch
2010-06-07 13:37:48 +02:00
Benjamin Otte
19c1d8316e gl: Special case blend mode for CAIRO_CONTENT_COLOR
This ensures that alpha stays at 1 for RGB in all cases.
2010-06-07 13:37:48 +02:00
Benjamin Otte
1f249064cc gl: rework _cairo_gl_set_operator()
1) store the current operator. This will be useful later to check if the
   operator changed.
2) pass the context instead of the destination as first argument. The
   destination is known to be the current target.
2010-06-07 13:37:48 +02:00
Benjamin Otte
f66500d8b0 gl: Only resetup textures if we need to 2010-06-07 13:37:48 +02:00
Benjamin Otte
d9dcafd61a gl: Do not reset the current target on release
This now also requires a call to cairo_device_flush().
2010-06-07 13:37:48 +02:00
Benjamin Otte
ce36be5c67 glx: When acquiring device, use the correct drawable 2010-06-07 13:37:48 +02:00
Benjamin Otte
5819bb07eb gl: Store the vertex offset in the operand 2010-06-07 13:37:48 +02:00
Benjamin Otte
c75460c54d gl: Introduce a temporary texture unit
...and use it for image uploads. This makes sure that the texture units
used for SOURCE and MASK get not clobbered when images get uploaded to
textures.
2010-06-07 13:37:48 +02:00
Benjamin Otte
1ddff8aba3 gl: Only allocate a framebuffer if we need one
This way, we don't clobber the current target when creating textures for
image surfaces.
2010-06-07 13:37:48 +02:00
Benjamin Otte
1c15510c3d Call cairo_surface_flush() before setting finished
With the current code, the surface will never be flushed as the flush
function checks if the surface is finished, and if so, doesn't call the
vfunc. Ooops.
2010-06-07 13:37:48 +02:00
Benjamin Otte
467d5e7f90 gl: Flush properly in set_destination 2010-06-07 13:37:48 +02:00
Benjamin Otte
e15348d8d0 gl: Don't reset vertex size 2010-06-07 13:37:48 +02:00
Benjamin Otte
a8d6ac1efc gl: Remove check if we're between begin/end
This will be useless soon, because we will keep the current state alive as
long as possible.
2010-06-07 13:37:48 +02:00
Benjamin Otte
8f675fb801 gl: Stop disabling the vertex array and the array buffer 2010-06-07 13:37:48 +02:00
Benjamin Otte
bef0b54149 gl: Do not reset shaders on _end()
Instead, keep the shader around until cairo_device_flush() is called.
2010-06-07 13:37:48 +02:00
Benjamin Otte
534c147299 region: clarify docs of cairo_region_equal() 2010-06-07 13:37:48 +02:00
Benjamin Otte
0fc6f08981 gl: Make _shader_by_type() a getter
And refactor code to do the current_shader assigning itself.
2010-06-07 13:37:48 +02:00
Benjamin Otte
2971ca0498 gl: bind all shader variables at the same place
Avoids the need to bind the shader when creating it.
2010-06-07 13:37:48 +02:00
Benjamin Otte
e11d8370e0 gl: Set GL_BLEND and GL_SCISSOR_TEST globally
Note that we do set them unconditionally in _begin() because a flush
might have cleared them.
2010-06-07 13:37:48 +02:00