Commit graph

10905 commits

Author SHA1 Message Date
Uli Schlachter
3c4e0f0f1a push_group: Refuse working with unusable surface
Make cairo_push_group() fail when the context's target surface is finished.

This fixes the api-special-cases for the xcb backend:

   Detected error during xcb run: error=9, seqno=0x13c, major=53, minor=0

The problem was that the Pixmap for the cairo surface was already freed and
cairo still tried to use it again as the drawable in a CreatePixmap request.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-13 19:21:57 +02:00
Uli Schlachter
18633b0810 surface: Error out on finished surfaces
Finished surfaces and surfaces with an error status must not be usable anymore,
so refuse to work on them.

This improves the result for api-special-cases.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68014

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-13 19:21:02 +02:00
Uli Schlachter
b64c83e891 api-special-cases: Also test contexts
This adds code to the api-special-cases test which also tests the behavior of
cairo when the cairo context or the surface that is target is in an error state
or finished. These new tests call into all public entry points defined in
cairo.h which receive a cairo_t * as their first argument.

Currently this causes a new crash in the testsuite:

  cairo-surface.c:394:
  _cairo_surface_begin_modification: Assertion `!  surface->finished' failed.

Reported-by: christophe.troestler@umons.ac.be
References: https://bugs.freedesktop.org/show_bug.cgi?id=68014
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-13 19:17:56 +02:00
Bryce W. Harrington
e438071e9d perf: Move macro-benchmark documentation to cairo-traces
The macro benchmarks were moved to a separate repository some time ago,
but the perf README still refers to these tests as if they were still
present, which may lead to some confusion.  Instead, consolodate the
macro benchmark documentation with the macro benchmarks, and focus this
README on just the (still in tree) micro-benchmarks.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-11 16:37:02 +02:00
Bryce W. Harrington
4e133af60c HACKING: Make mention of the separate cairo-traces repo
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-11 16:33:43 +02:00
Behdad Esfahbod
46d9db96d4 [ft] Ensure alignment of bitmaps received from FreeType 2013-08-04 20:12:06 -04:00
Behdad Esfahbod
34a747e7bd [ft] Fix alignment 2013-08-04 20:11:51 -04:00
Behdad Esfahbod
3cd6c5966a Revert accidentally committed stuff 2013-07-29 22:47:26 -04:00
Behdad Esfahbod
0554d76402 [ft] Add missing include 2013-07-29 22:41:46 -04:00
Behdad Esfahbod
7d26341072 [ft] Fix math 2013-07-29 19:20:33 -04:00
Behdad Esfahbod
9444ef09cc Support 2bit and 4bit embedded bitmaps 2013-07-29 19:10:46 -04:00
Adrian Johnson
274863be08 type1-subset: Don't try to rename non winansi glyphs
When the latin subset contains glyphs that use the seac operator to
combine two glyphs, additional non winansi glyphs are added to the
subset.  These extra glyphs do not have a winansi name so they can't
be renamed.

Based on a patch by Salvador Ortiz.

Bug 67324
2013-07-28 09:30:05 +09:30
Henry Song
03c81d414d gl/msaa: Always use scissor when clipping
Even when using the stencil buffer for clipping, always scissor the clip
extents. This simplifies the code a bit.
2013-07-15 19:27:29 -07:00
Henry Song
8c710ed872 gl/msaa: Disable stencil and scissor during framebuffer blit
When blitting the framebuffer during transitions to and from
multi-sampling mode, we need to disable the stencil and scissor test so
that the entire surface is preserved. This fixes the bitmap-font test
for the MSAA compositor.
2013-07-15 19:27:24 -07:00
Henry Song
be2c09a1f5 gl/msaa: Properly destroy stencil buffer clip cache
When replacing the stencil buffer clip cache or destroying a surface,
destroy the cached clip. This prevents the clip from leaking.
2013-07-15 19:27:19 -07:00
Behdad Esfahbod
2cc353c3db Towards support loading color glyphs from FreeType
See comments.
2013-07-05 16:03:25 -06:00
Behdad Esfahbod
e738079302 [ft] Fix wrong assumptions
If subpixel rendering is enabled, but FT returns a 8bit gray bitmap
(perhaps because the font has 8bit embedded bitmaps) we were hitting
the assertions because the assumptions made were wrong.  Fix up.
2013-07-05 15:59:45 -06:00
Behdad Esfahbod
a0f556f37f [ft] Fix memory bug in copying bitmaps 2013-07-05 15:59:45 -06:00
Uli Schlachter
9f9796920f xcb: Fix some uninitialized variable warnings
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Uli Schlachter
2170bdbb12 image compositor: Always finish the span renderer
In some obscure conditions that I don't really understand, the image compositor
did not finish a span renderer that it created. This could then cause the last
row of the span to be ignored.

Fixes: clip-complex-bug61492

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61592
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Uli Schlachter
9058e9ae28 Add new test for bug 61592
This test exercises some clipping-related failure that Seongwon Cho reported.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61592
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Uli Schlachter
54bee5e0fc Fix caps-tails-curve reference images
Commit d7f5a1bec fixed a bug. This caused 12 new test failures for the
test-traps test target:

caps-tails-curve degenerate-arc degenerate-path joins subsurface
subsurface-scale twin twin-antialias-gray twin-antialias-mixed
twin-antialias-none twin-antialias-subpixel user-font

Most of these are indeed (new?) bugs. However, caps-tails-curve actually started
producing the expected result and the reference image just wrongly captures the
old state of things.

At the time of that commit, just taking the output from test-traps as the new
reference image works fine for all backends. However, with current git,
something introduced more antialiasing noise and now test-traps changed again
while cairo-xcb stayed with the old result. Thus, we also need a new reference
image to fix this test.

(The wrong reference images come from commit 8488ae02 which turned test-traps'
results into reference images)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Chris Wilson
8b55703d76 test: Amend check-refs.sh to support out-of-tree builds 2013-07-04 10:04:30 +01:00
Chris Wilson
8b4151a5e5 test: Remove conflicting .ref.png, .argb32.ref.png, .rgb24.ref.png
Where a content specific reference image exists, prefer to have both
content reference images (i.e. both argb32.ref and rgb24.ref) rather
than a mix of .ref and argb32/rgb24.
2013-07-04 10:02:46 +01:00
Chris Wilson
9eb1237e00 test: Add a few reference images found lurking on my machine 2013-07-04 09:40:37 +01:00
Chris Wilson
3255462a23 test: Remove all identical (cmp & pdiff) reference images
Courtesy of the improved check-ref-dups written by Bryce Harrington:

Running make check on the codebase (with default configuration) with the
redundant images removed produces essentially the same test results:

Before
------
Tests run:        13687
Passed:           9216
Failed:           3566
Expected Failed:  312
Error:            1
Crashed:          17
Untested:         575
Total:            13687

After
-----
Tests run:        13689
Passed:           9216
Failed:           3566
Expected Failed:  312
Error:            1
Crashed:          19
Untested:         575
Total:            13689

(with the exception being the pthread tests misbehaving between runs)
2013-07-04 09:27:56 +01:00
Bryce W. Harrington
33895904d5 test: Add special cases for create-from-png and fallback-resolution
These tests use reference images somewhat differently from other tests,
so treat them as special cases and avoid recommending deleting any of
their files.

Add TODO's to each test to rework them to be more consistent with other
tests.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 09:27:56 +01:00
Bryce W. Harrington
5577223489 pdiff: Drop unused variable
Fixes:
perceptualdiff.c:35:24: warning: unused variable ‘dim’
[-Wunused-variable]

Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 09:27:56 +01:00
Bryce W. Harrington
319b893582 pdiff: Quell warning about signed/unsigned comparisons
perceptualdiff.c:55:19: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
perceptualdiff.c:60:16: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 09:27:55 +01:00
Bryce W. Harrington
9e4cac50c2 test: Make check-ref-dups utilize perceptualdiff for comparisons
The current sha1sum-based file checker does a blanket comparison of all
files with each other, which is fast but not directly helpful since it
doesn't distinguish between sibling files (which are allowable to be
duplicates).  Also, it ignores files that may have byte differences
(such as PNG header differences) but are otherwise pixel-identical.

This patch replaces the sha1sum-based checker with one that accounts for
the default fallback path and uses perceptualdiff to compare files that
are bytewise different and verify whether they actually are different.

The intention is that the output of this command can be directly used to
remove redundant files, e.g.:

  cd test
  make check-ref-dups | cut -d' ' -f2 | \
      while read f; do git rm "reference/$f"; done

This should have no impact on make check's results (modulo any tests
that behave erratically), and will help trim down the size of the
tarball.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
[ickle: rebase and add the suggested command to the Makefile]
2013-07-04 09:27:55 +01:00
Bryce W. Harrington
8d3c518e9d test: Use cmp to catch byte-by-byte identical files
cmp runs faster than perceptualdiff, and catches files that are exact
copies of the reference image.  We still use perceptualdiff for catching
files that aren't bytewise identical, but are still identical at the
pixel level.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 09:04:17 +01:00
Bryce W. Harrington
b0be0d8d42 test: Add script to check for redundant reference images
This script requires the perceptualdiff program, which can be built as
follows:

  cd test/pdiff && make perceptualdiff

The script's output provides a list of target-specific or
format-specific images that are identical to their more generic
reference files, and thus are redundant and can be safely removed from
the archive without altering any test behaviors.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
[ickle: applied Behdad's suggestion of renaming the script check-refs.sh]
2013-07-04 09:04:05 +01:00
Bryce W. Harrington
7f1be42e85 test: Fix make check-ref-dups due to move of ref images to reference/
The check-ref-dups target in Makefile.am was not updated with the new
path when the reference images were moved from test/ to
test/reference/.  Now it produces output properly again.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-07-04 08:57:45 +01:00
Eric Anholt
7b8fc77bb9 gl: Move glGetUniformLocation to shader compile time.
The lookup of the string names has significant overhead, which is why GL
gives you glGetUniformLocation so that you reference uniforms by
constant integers in your high performance path.

Reduces cairo-perf-trace runtime of firefox-planet-gnome by 1.06767% +/-
0.289265% (n=72) on my IVB macbook air.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-28 11:53:04 +01:00
Chris Wilson
4d9439132d check: Fix check-def.sh for variations in GCC's linker
We now need to exclude bss and data sections from the symbol list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-21 20:18:40 +01:00
Chris Wilson
7b80613d6d test: Use the highest precision rendering for shapes for generating ref results
The test-traps and test-base surfaces are used for generating the
reference results, and so they should opt for using the best rendering
paths through the traps- and base-compositors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-21 17:30:47 +01:00
Chris Wilson
686ebd4a89 cairo-perf-print: Do not free the uninitialised histogram
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-21 16:59:25 +01:00
Chris Wilson
5589e80e2b xml: Handle clip-boxes in the updated cairo_clip_t
Edward Zimmerman pointed out that the xml surface had bitrotted slightly
and no longer understand the new clip layout - in particular that we can
have clips without a path, but just with boxes instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-21 12:01:32 +01:00
Chris Wilson
2bfb9e9001 svg: Unwrap recording surfaces
As a first step towards bring SVG uptodate with the various new
patterns, first we need to prevent SVG crashing when it mishandles an
unknown recording surface.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-20 20:47:18 +01:00
Chris Wilson
b7331f0c52 gstate: Speed up stroked path extents
We can skip the intermediate evaluation of the trapezoids for
determining the extents of a stroked path by using the relatively new
functions for computing the contours of the stroke. Then we can simply
use the bbox of the points within the contours to retrieve the path
extents - which is already provided by the polygon holding the contours
of the stroke. This provides a faster result with less numerical
inaccuracy due to fewer stages required in the computation

References: https://bugs.freedesktop.org/show_bug.cgi?id=62375
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-20 14:26:21 +01:00
Chris Wilson
9ea5993b03 test/get-path-extents: Check exact matches within tolerance
When we refine geometry, we do so to a tolerance as specified by the
user. This means that we can not expect tessellated results to have
exact results, but always they should match within the specified
tolerance.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-20 14:11:38 +01:00
Chris Wilson
e079e4e229 image: Mark the data as owned after stealing the snapshot's image
Victor Goya found that we ended up leaking memory after reading a PNG
into an image surface and drawing that onto a PDF surface. In
particular, he discovered that

commit 0bfd2acd35
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Aug 13 01:34:12 2012 +0100

	xlib: Implement SHM fallbacks and fast upload paths

introduced a path to steal the image data for a snapshot (and thereby
avoid a redundant copy), but that path then lead to the leak of the
"owned" data.

Reported-by: Victor Goya <victor.goya@af83.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-20 14:02:14 +01:00
Chris Wilson
f39eef8524 pdf: Fix compiler warning for use of unitialised variable along error path
cairo-pdf-surface.c: In function '_cairo_pdf_surface_add_source_surface.isra.20':
cairo-pdf-surface.c:1461:10: warning: 'unique_id' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-20 11:11:20 +01:00
Chris Wilson
80641f4adc pdf: Improve consistency in use of cairo_int_status_t
Suppress several compiler warning for mixing
cairo_status_t/cairo_int_status_t enums.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-20 11:09:53 +01:00
Bryce W. Harrington
d4545910e2 test: Note naming scheme for XFAIL images in README
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-06-20 11:00:59 +01:00
Bryce W. Harrington
982f288460 gl: Quell warning about incompatible pointer type
mask is a cairo_surface_t pointer, and is cast to a cairo_gl_surface_t
pointer in the _cairo_gl_surface_draw_image() call.
texture.owns_surface also expects mask to be a cairo_gl_surface_t
pointer, so apply the same cast here as well.

Fixes the following warning:

 cairo-gl-traps-compositor.c:370:35: warning: assignment from
  incompatible pointer type [enabled by default]

Ref.: 38bf7a65

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-06-20 11:00:37 +01:00
Bryce W. Harrington
aa764a3bbc pdf: Assure compiler that data, data_size will always be initialized
There are only three possible color states:  COLOR, GRAYSCALE, or
MONOCHROME thus data and data_size will always be set to some value,
so assert the default is never reached.

Fixes these warning:
  cairo-pdf-surface.c:2517:32: warning: ‘data_size’ may be used
   uninitialized in this function [-Wuninitialized]
  cairo-pdf-surface.c:2338:19: note: ‘data_size’ was declared here
  cairo-pdf-surface.c:2446:11: warning: ‘data’ may be used uninitialized
   in this function [-Wuninitialized]
  cairo-pdf-surface.c:2337:11: note: ‘data’ was declared here

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-06-20 11:00:23 +01:00
Bryce W. Harrington
27cb80b848 type1-subset: Fix typos in function comment
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-06-20 10:58:52 +01:00
Bryce W. Harrington
f893acd60d type1-subset: Quell warning about uninitialized array_start
Since we explicitly set font->subset_subrs to false, there's no way the
warned code will be executed, but perhaps the compiler is confused by
the goto jump.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-06-20 10:57:57 +01:00
Chris Wilson
519dff51db scaled-font: Prevent a recursive mutex lock for removing a failed glyph
If we fail to create a glyph, and it is the only one in the glyph page,
we then pluck that page out of the global glyph cache. The cache destroy
callback tries to take the scaled_font lock again, causing a lockup.
Rework the error path to avoid taking that lock in this case - still a
potential lock ordering issue remains.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-18 16:08:27 +01:00