Commit graph

391 commits

Author SHA1 Message Date
Bryce Harrington
2c5af590dd Refactor ARRAY_LENGTH macro definitions in test code 2014-11-20 12:22:06 -08:00
Ravi Nanjundappa
c61aeddc44 test: improve selective execution of Cairo tests based on FORMAT option
This patch improves the patch "test: Selective execution of Cairo tests based on FORMAT option"
by extending the usage of FORMAT option even in the case of user not
providing TARGETS= option

For ex:
(1). CAIRO_TESTS="zero-alpha" make test FORMAT=rgba
This command runs the zero-alpha test for all the backends with
argb32 content format and so on.
(2). CAIRO_TESTS="zero-alpha" make test FORMAT=rgba,rgb
This command runs the zero-alpha test for all the backends with
argb32 and rgb24 content formats.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-14 16:10:09 -07:00
Ravi Nanjundappa
f8e0ecb5af test: Selective execution of Cairo tests based on FORMAT option
Added a new command line option FORMAT which can take rgb and/or rgba
values which enables the execution of tests only for the given FORMAT
For ex:
(1). CAIRO_TESTS="zero-alpha" make test TARGETS=ps2,image FORMAT=rgba,rgb
This command runs the zero-alpha test for both ps2 and image backends
with argb32 and rgb24 content formats.
(2). CAIRO_TESTS="zero-alpha" make test TARGETS=ps2,image FORMAT=rgba
This command runs the zero-alpha test for both ps2 and image backends
with argb32 content format and so on.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-14 16:09:20 -07:00
Behdad Esfahbod
9e6ceb23b4 More binary mode for Windows
Based on:
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-cairo/0012-more-binary-mode.mingw.patch
2014-07-23 12:12:04 -04:00
Ravi Nanjundappa
ead5c7909f vg: Use EGL_NONE and GLX_NONE in place of None
Use EGL_NONE in EGL section and GLX_NONE in GLX section
instead of None in cairo-boilerplate-vg.c

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55805
2014-05-19 17:37:38 -07:00
Ravi Nanjundappa
69e10bc8b5 glx: Use GLX_NONE in place of None
Use "GLX_NONE" in rgb and rgba attributes instead of
"None" in cairo-boilerplate-glx.c

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-05-16 11:54:43 -07:00
Ravi Nanjundappa
55608e4fd6 boilerplate: Maintain consistency in the usage of switch cases
Some of the switch cases used in boilerplate are not consistent
across other source files in the same module. This patch fixes the
consistency issues of switch case usage in the boilerplate module.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-05-06 10:22:43 -07:00
Martin Robinson
f6efecdfef boilerplate/gl: Disable thread awareness
This dramatically speeds up testing on NVidia and actually makes it
possible to run traces within a reasonable amount of time.

cairo-perf-trace results for:
NVIDIA Corporation GeForce GTS 250/PCIe/SSE2 3.3.0 NVIDIA 310.14

Before:
test              min(s)  median(s) stddev. count
gvim              30.924  31.251    0.72%   5/6
firefox-fishbowl  168.751 201.017   12.46%  8/8
(exited early)

After:
test              min(s)  median(s) stddev. count
gvim              1.294   1.325     1.79%   6/6
firefox-fishbowl  18.540  19.104    1.54%   6/6
2013-04-04 12:04:50 -07:00
Martin Robinson
b00b9e82ab boilerplate: Add a mode for running threaded perf tests
This is useful because the GL backend runs much faster on some drivers
when thread awareness is disabled.
2013-04-04 12:04:50 -07:00
Uli Schlachter
b7c06fff1f boilerplate: rename xcb-render-0.0 to xcb-render-0_0
The test suite uses dots to separate the backend name from the content type.
Thus, the backend name must not contain any dots.

The xlib backend already calls its RENDER 0.0 target xlib-render-0_0 for this
reason. This commit makes the xcb backend match this.

Reported-by: Darxus <darxus@chaosreigns.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-22 14:04:44 +01:00
Uli Schlachter
caf50c07e2 test: Fix handling of dots in CAIRO_TEST_TARGET
Before this, the following happened:

  $ CAIRO_TEST_TARGET=image,xcb-render-0.0 make test
  Cannot find target 'image'.
  Known targets: image, [...]

The reason for this is that _cairo_boilerplate_target_matches_name() doesn't get
a null-terminated string, but instead has a pointer to the end of the string.
However, strpbrk() expects a null-terminated argument and thus could return a
result which points past the end of the input.

This commit fixes exactly this.

Reported-by: Darxus <darxus@chaosreigns.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-22 14:02:09 +01:00
Martin Robinson
9bff450844 boilerplate/glx: Add a target with multisampling and stencil support
Add a gl-window target that supports multisampling. This is useful for
testing the MSAA backend on the default framebuffer.
2013-01-04 16:29:51 -08:00
Uli Schlachter
000a137a65 boilerplate-xcb: Ignore MappingNotify events
The boilerplate code makes sure that our tests didn't cause any X11 errors or
X11 events, because those might confuse API users.

However, when the keyboard layout changes, every connection gets a MappingNotify
event. This means that the test and performance test suites failed when the
keyboard layout was changed while they are running.

Fix this by ignoring MappingNotifies.

Reported by Arthur Huillet on IRC.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-12-17 17:12:59 +01:00
Chris Wilson
64d65f72e5 boilerplate/gl: Round fractional window sizes up
A few test cases purposely create fractional surface sizes which can not
be natively supported by the raster backends such as GL. For these
backends we need to consistent in creating a surface that is large
enough to contain the test, so we need to use ceil() rather than
implicit truncation to integers.

A consequence of the misalignment between the Window size and the
surface size (where one was using ceil and the other not) is that the
first row of the cairo surface would not be visible on the output.

Based on a patch by Chuanbo Wen to fix 5 test cases, such as
group-unaligned.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-29 10:33:08 +01:00
Chris Wilson
93d42e82a4 Revert accidental push of ps debugging API.
This reverts commits
   6ad8c96fd8,
   a3f97d1d2e,
   25abe58298

I should know better by now than to push without checking for outstanding
changes.
2012-04-14 14:54:07 +01:00
Chris Wilson
25abe58298 pdf (debug API): Export the ability to force fallbacks
We need to occasionally force fallbacks whilst testing the PDF
output, so export a debug interface to do so in order to avoid poking
around inside cairo internals.

References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-04-12 12:22:17 +01:00
Chris Wilson
a3f97d1d2e ps (debug API): Export the ability to force fallbacks
We need to occasionally force fallbacks whilst testing the PostScript
output, so export a debug interface to do so in order to avoid poking
around inside cairo internals.

References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-04-12 12:22:15 +01:00
Chris Wilson
6ad8c96fd8 ps (API): Export the ability to set the creation date of the surface
A PostScript surface embeds a CreationDate comment into its document
description pre-amble. Normally this is set to the time the surface is
written out, except we set this to a constant value in the boilerplate
for the purposes of mimicking a reference file. It may also be useful
for external applications, so make it a public export.

References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-04-12 12:21:22 +01:00
Maarten Bosmans
b74e8ebd50 Add _cairo_win32_print_gdi_error to boilerplate code
This function is not exported in libcairo, so can't be used from the
library.
2012-04-10 12:09:02 +01:00
Henry (Yu) Song
1e4f385dec boilerplate/gl: set width and height to be at least 1 2012-03-19 11:01:47 +00:00
Adrian Johnson
589216c1e3 win32: fix compilation on cygwin 2012-02-25 09:52:10 +10:30
Andrea Canciani
d95cf87c03 boilerplate: Use any2ppm from ANY2PPM env variable
If the environment variable ANY2PPM is set, use it as the path to the
any2ppm program. Otherwise, default to "./any2ppm" as before.

This makes it possible to set the ANY2PPM variable in the
Makefile.win32 build system, which makes it possible to use the "test"
target on the script backend.
2012-02-23 00:16:44 +01:00
Chris Wilson
6ab1deb5c6 boilerplate/xlib: Exercise the mask based compositor for xrender version 0.0
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-22 11:24:14 +00:00
Chris Wilson
3d499ea901 xlib: Replace obsolete disable-xrender with shiny new device debug interface
As prototyped with xcb.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-22 10:41:37 +00:00
Chris Wilson
b2132eed79 boilerplate/xlib: The xlib-fallback should be visually identical to image 2012-02-22 10:18:56 +00:00
Oleg Romashin
4f81940749 qt: Fix compilation, also minor fix for building against Qt5
Update to latest surface backend structure, removed obsolete functions
and fixed functions API in order to be compatible with backend definition.

Fixed compilation with Qt5
2012-02-12 09:57:00 +00:00
Andrea Canciani
abced5b882 boilerplate: Fix svg extension
The svg backend produces .svg files. Using the appropriate extension
allows the test suite to check the vector output in addition to the
PNG images.
2011-11-12 20:49:08 +01:00
Andrea Canciani
549b1f8d4b boilerplate: Remove unused thread id parameter
The thread id is not used anymore (it is always == 0), so it can be
removed.
2011-11-12 20:49:08 +01:00
Andrea Canciani
0e18cc6d27 boilerplate: Provide close callback after opening any2ppm output
cairo_boilerplate_open_any2ppm() returns a FILE* obtined from popen()
or fdopen(). It should hence be closed using pclose() or fclose()
respectively.

Fixes the crash on every script test on MacOS X.
2011-11-11 15:30:50 +01:00
Andrea Canciani
f96e78fa54 Silence some 'unused var' warnings 2011-11-09 13:56:50 +01:00
Robert Bragg
571a27b4fc backends: Adds a new Cogl based backend
This adds a new GPU accelerated backend for Cairo based on the Cogl 3D
graphics API.

This backend aims to support Cairo in a way that translates as naturally
as possible to using a GPU, it does not strive to compete with the
anti-aliasing quality of the image backend if it can't be done
efficiently using the GPU - raw performance isn't the only metric of
concern, so is power usage.

As an overview of how the backend works:
- fills are handled by tessellating paths into triangles
- the backend has an extra fill_rectangle drawing operation so we have
  a fast-path for drawing rectangles which are so common.
- strokes are also tessellated into triangles.
- stroke and fill tessellations are cached to avoid the cpu overhead
  of tessellation and cost of upload given that its common for apps to
  re-draw the same path multiple times. The tessellations can survive
  translations and rotations increasing the probability that they can be
  re-used.
- sources and masks are handled using multi-texturing.
- clipping is handled with a scissor and the stencil buffer which
  we're careful to only update when they really change.
- linear gradients are rendered to a 1d texture using a triangle
  strip + interpolating color attributes. All cairo extend modes
  are handled by corresponding texture sampler wrap modes without
  needing programmable fragment processing.
- antialiasing should be handled using Cogl's multisampling API

XXX: This is a work in progress!!
TODO:
- handle at least basic radial gradients (No need to handle full
  pdf semantics, since css, svg and canvas only allow radial gradients
  defined as one circle + a point that must lie within the first
  circle.) - currently we fall back to pixman for radial gradients.
- support glyph rendering with a decent glyph cache design. The
  current plan is a per scaled-font growable cache texture + a
  scratch cache for one-shot/short-lived glyphs.
- decide how to handle npot textures when lacking hardware support.
  Current plan is to add a transparent border to npot textures and use
  CLAMP_TO_EDGE for the default EXTEND_NONE semantics. For anything else
  we can allocate a shadow npot texture and scale the original to fit
  that so we can map extend modes to texture sampler modes.
2011-10-11 09:05:45 +01:00
Uli Schlachter
5f3fd8c09c xlib: Fix compilation with --disable-xlib-xrender
The boilerplate code tries to set PolyModePrecise on the xlib device. However,
because xrender is disabled, cairo-xlib-xrender.h wasn't included and didn't
include the needed xrender headers for this define.

This define is copied from cairo-xlib-xrender-private.h

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-08 10:48:26 +02:00
Chris Wilson
4790bbf596 boilerplate: Skip testing of null surfaces
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-26 11:51:27 +01:00
Dave Yeo
a7b2c28adf On OS/2, WIFSIGNALED and WTERMSIG are prototyped in sys/wait.h
boilerplate/cairo-boilerplate-pdf.c |    4 ++++
 boilerplate/cairo-boilerplate-ps.c  |    4 ++++
 boilerplate/cairo-boilerplate-svg.c |    4 ++++
 build/configure.ac.system           |    2 +-
 4 files changed, 13 insertions(+), 1 deletions(-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-18 08:50:26 +01:00
Uli Schlachter
a1be14693b boilerplate-xcb: Print sequence numbers
The boilerplate code will now also print the low 16 bits of the sequence number
for errors and events. This should make it a lot easier to find errors in e.g.
a long xtrace output.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-16 17:45:27 +02:00
Uli Schlachter
7ba28ff563 cairo-xcb: Require libxcb 1.6
Since commit 968eb30bba, we use xcb_discard_reply(). This function was
added in libxcb 1.6.

"Fixes": https://bugs.freedesktop.org/show_bug.cgi?id=40925

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-16 17:45:27 +02:00
Chris Wilson
fcea0f8e08 test: Use the test-traps as the reference images for xlib/xcb
The test-traps provides a reference implementation of the
traps-compositor as used by xlib, so we can use it to generate the
reference images as well. (Of course checking that test-traps is itself
correct and only differs in the renderer! ;-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-16 11:09:22 +01:00
Chris Wilson
1e67fb4490 test: Complete set of baseline reference images
test-base basically implements rendering ala cairo-1.0 and so serves as
a useful baseline for comparing enhancements and to regression test the
core libraries.
2011-09-15 13:10:25 +01:00
Chris Wilson
af9fbd176b Introduce a new compositor architecture
Having spent the last dev cycle looking at how we could specialize the
compositors for various backends, we once again look for the
commonalities in order to reduce the duplication. In part this is
motivated by the idea that spans is a good interface for both the
existent GL backend and pixman, and so they deserve a dedicated
compositor. xcb/xlib target an identical rendering system and so they
should be using the same compositor, and it should be possible to run
that same compositor locally against pixman to generate reference tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

P.S. This brings massive upheaval (read breakage) I've tried delaying in
order to fix as many things as possible but now this one patch does far,
far, far too much. Apologies in advance for breaking your favourite
backend, but trust me in that the end result will be much better. :)
2011-09-12 08:29:48 +01:00
Chris Wilson
2220693a40 Introduce cairo_mime_surface_t
The mime surface is a user-callback surface designed for interfacing
cairo with an opaque data source. For instance, in a web browser, the
incoming page may be laid out and rendered to a recording surface before
all the image data has finished being downloaded. In this circumstance
we need to pass a place holder to cairo and to supply the image data
later upon demand.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-15 00:16:09 +01:00
Chris Wilson
62e48b01b4 script: enable by default
I'm willing to make this a supported backend as I find it to be an
invaluable debugging tool...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 21:01:29 +01:00
Chris Wilson
eee66899cd Introduce cairo_surface_observer_t for performance analysis
Another logging passthrough surface that records the style of operations
performed trying to categorise what is slow/fast/important.

In combination with perf/cairo-analyse-trace it is very useful for
understanding what a trace does. The next steps for this tool would be
to identify the slow operations that the trace does. Baby steps.

This should be generally useful in similar situations outside of perf/
and should be extensible to become an online performance probe.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 20:54:53 +01:00
Chris Wilson
7a17e4362e boilerplate: improve fidelity of surface extraction
Create an image surface of equivalent content to the original.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13 11:08:58 +01:00
Uli Schlachter
83df0ab2b6 XCB: Store the flags per-connection only
Every xcb surface had its own copy of the flags from the time that it was
created. This means that, if you want to make use of
cairo_xcb_device_debug_cap_xrender_version() and
cairo_xcb_device_debug_cap_xshm_version(), you first had to create a dummy xcb
surface, use that to get access to the cairo_device_t so that you can use these
functions and only then create your real surface, because the change only
affected new surfaces.

This commit changes everything to use the connection's flag and removes the
per-surface flags. This avoids the dummy surfaces completely.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 16:51:26 +02:00
Chris Wilson
d5d4a0f240 xcb: Take advantage of clip-boxes
A demonstration of step 2, improves performance for selected benchmarks
on selected GPUs by up to 30%.

firefox-fishbowl on snb {i5-2520m): 42s -> 29s.
firefox-talos-gfx on snb: 7.6 -> 5.2s.
firefox-fishbowl on pnv (n450): 380 -> 360s.

Whist this looks like it is getting close to as good as we can achieve,
we are constrained by both our API and Xrender and fishbowl is about 50%
slower than peak performance (on snb).

And it fixes the older performance regression in firefox-planet-gnome.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-20 13:19:38 +01:00
Chris Wilson
507b8abcf6 Excise xcb-drm
The experiment was at best a pyrrhic victory. Whilst it did show that
you could successfully subvert cairo_xcb_surface_t and provide the
rendering locally faster (than the xlib driver at that time), any
performance benefits were lost in the synchronisation overheads and
server-side buffer allocation.

Once cairo-gl is mature, we need to look at how we can overcome these to
improve client-side rendering

In the meantime, cairo-xcb is no longer my playground for
experimentation and is shaping up to become a stable backend...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-14 12:46:26 +01:00
Chris Wilson
5d9da3decf Excise DRM-Xr
I've since incorporated (nearly) all the features from cairo-drm into
xf86-video-intel, making this experiment defunct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-14 12:35:19 +01:00
Uli Schlachter
b6c972897b Xlib: Fix boilerplate to work with xlib-xcb
Xlib boilerplate includes cairo-xlib-surface-private.h, so that it can cast the
xlib cairo_surface_t to cairo_xlib_surface_t and then mess with some internals
of that struct.

However, xlib-xcb doesn't use that struct and thus this results in random memory
corruption. "Luckily", all the fields that this messes with don't corrupt any
fields in cairo_xlib_xcb_surface_t, but instead this writes past the end of the
buffer that was returned from malloc.

This commit just adds an #if to disable this code section since I have no idea
what a proper fix would be. This means that the xlib-fallback backend doesn't
actually test any fallbacks with xlib-xcb, however it never did so anyway.

If you have any idea how to fix xlib-fallback with xlib-xcb, please speak up.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-03 15:16:23 +02:00
Uli Schlachter
77b6563c21 xcb: Use defines instead of magic numbers
render.h gives us nice descriptive names for the precise/imprecise poly modes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-06-24 15:59:08 +02:00
Haithem Rahmani
8fb9a6727e boilerplate: Use correct flag type in DFBWindowDescription
The window description flag macros are prefixed with DWDESC_.

The issue was not noticed because DWDESC_CAPS and DSDESC_CAPS have the
same value.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=37049
2011-06-20 11:43:38 +02:00