Commit graph

163 commits

Author SHA1 Message Date
Uli Schlachter
1981fb6dfb meson: Use more dependency objects
For example, to depend on cairo-script, inccairoscript was added to
"include_directories:" and libcairoscript was added to "link_with:".
This commit instead uses the libcairoscript_dep dependency everywhere.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-22 07:59:52 +02:00
Emmanuele Bassi
bd13841257 Drop the conditional inclusion of config.h
We *always* generate this file, and we depend on its existence.

The idea behind HAVE_CONFIG_H was being able to include random files
from different projects, back in a time where "libraries" were literally
just random files instead of actual shared objects.

Since we're not in the '80s any more, and our build system(s) define
HAVE_CONFIG_H *and* generate the config.h header file, we don't need a
conditional guard around its inclusion.
2021-05-01 17:05:29 +01:00
Emmanuele Bassi
8336309794 meson: Define HAVE_CONFIG_H as a project flag
Precisely what Autotools does, instead of adding it as per-target C
argument.

Once we remove HAVE_CONFIG_H checks in every source file, we'll be able
to drop it.
2021-05-01 16:55:38 +01:00
Xavier Claessens
ebbaebdec1 meson: Generate cairo-script-interpreter.pc needed by GTK+ 2020-12-22 13:16:05 -05:00
Tim-Philipp Müller
e9ccb1d8d0 meson: fix library versioning
Fixes #442
2020-12-15 00:22:37 +00:00
George Matsumura
ed98414686 build: Fix various compiler warnings
This fixes a few compiler warnings that were encountered with gcc 9.3.0.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-11-07 06:45:01 -07:00
Tim-Philipp Müller
7cb362d586 meson: fix cairo-script-interpreter library name
Fixes #418
2020-08-07 00:18:17 +01:00
Mathieu Duponchelle
596a82f2d1 Add meson build definitions
Co-Authored by:
Nirbheek Chauhan <nirbheek@centricular.com>
lb90 <luca.bacci982@gmail.com>
Tim-Philipp Müller <tim@centricular.com>
2020-07-31 12:21:50 +01:00
luz.paz
6d93bddbd6 Misc. typos
Found via `codespell -i 3 -w -I ../cairo-word-whitelist.txt -L tim,ned,uint`
Follow up of 12cb59be7d

Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
2019-01-31 17:37:15 -08:00
Maarten Lankhorst
a34cb719cd Add support for RGBA128F and RGB96F formats.
IGT wants to add support for planes with a bit depth >10, which
requires a higher precision format than we have currently.

I'm using RGBA as format, because of its existence in OpenGL.
With the new formats we can directly convert our bytes to half float,
or multiply a colro vector with a matrix to go to the Y'CbCr colorspace.

This requires pixman 0.36.0, so bump the version requirement.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
2019-01-07 19:10:44 -08:00
suzuki toshiya
33a348d698 csi-trace does not show help
csi-trace does not show help string correctly, due to a bug in its
command line argument parsing.  strcmp returns 0 when there is an exact
match, which means it requires an inverted test.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2018-04-02 11:55:19 -07:00
Adrian Johnson
9ffbf63d37 fix warning: inlining failed in call to '_csi_stack_push' 2017-10-21 13:08:39 +10:30
Guillermo Rodriguez
5ac7b3652d script: Fix misleading indentation warning.
Spotted by David Kastrup <dak@gnu.org>.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-08-21 16:05:16 -07:00
Adrian Johnson
747cab741c Add CAIRO_STATUS_WIN32_GDI_ERROR for GDI errors 2016-03-26 22:18:05 +10:30
Adrian Johnson
cdd5c92ced Add CAIRO_STATUS_FREETYPE_ERROR for errors returned by libfreetype 2016-03-26 21:45:59 +10:30
Adrian Johnson
8f6790123e Adding missing error status to utils 2016-03-26 19:06:03 +10:30
Bryce Harrington
b4a922f62d cairo-script: Rename struct member to avoid name collision on AIX
On AIX, the token jmpbuf is a pre-processor macro.
cairo-script-scanner.c includes a private struct with a member named
jmpbuf which gets renamed to __jmpbuf when AIX's sys/context.h has been
included.

While judicious ordering of includes might kludge around this problem
(by causing all references to .jmpbuf to become .__jmpbuf), it's better
to simply select a new name for the struct member that won't suffer the
collision.

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

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-18 12:38:59 -07:00
Bryce Harrington
714a77e3f1 cairo-script: Prefer cairo from local tree
Use quoted includes rather than bracketed, to prefer linking to the
in-tree cairo in preference to the system cairo.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-18 12:38:55 -07:00
Bryce Harrington
3ed581149f cairo-script: Cleanup boilerplate header for consistency
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-18 12:38:51 -07:00
Bryce Harrington
d31e2418d6 cairo-script: Add missing copyright and boilerplate
Chris wrote all of the cairo script stuff.  I'm making a guess about the
copyright date.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-18 12:38:47 -07:00
Bryce Harrington
a3b6afabf6 cairo-script: Always include config.h first thing
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-18 12:38:43 -07:00
Bryce Harrington
b9ada81995 cairo-script: Improve buffer length check
Quells the following warning:

cairo-script-scanner.c: In function ‘_translate_string’:
cairo-script-scanner.c:1623:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
      if (buf_len <= 8 + 2*string->len) {
                  ^
2015-06-04 14:24:31 -07:00
Bryce Harrington
c0458b4560 csi-trace: Add --version and --help args to utility 2015-03-06 23:35:34 -08:00
Behdad Esfahbod
f4dbba26d4 [cairo-trace] Work around fontconfig :charset= parse format change
As dicussed on the mailing list.
2014-07-14 15:55:12 -04:00
Sylvestre Ledru
da9ef97372 Remove some useless declarations found by scan-build, the LLVM/clang static analyzer
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-05-06 10:14:53 -07:00
Bryce Harrington
39b7d5138e cairo-script: Compare status with CSI enums
CSI_STATUS_SUCCESS is defined as equivalent to CAIRO_STATUS_SUCCESS.
We should prefer the former when comparing against csi_status_t
variables, else we'll get a warning:

cairo-script-interpreter.c:637:23: warning: comparison between
‘csi_status_t’ and ‘enum _cairo_status’ [-Wenum-compare]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:26:02 -08:00
Bryce Harrington
18d66c88a2 cairo-script: Error if asked to decompress with missing compression lib
This quells the following warning:

warning: enumeration value ‘LZO’ not handled in switch [-Wswitch-enum]

The LZO enum value is defined and used elsewhere, even if lzo support
isn't available.

This situation might arise if cairo scripts were generated on one system
with lzo, and then replayed on a system without it.  For now simply
error out if this occurs.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:57 -08:00
Chris Wilson
0266cb821f script: Add support for replaying device-scale
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-05 16:13:56 +01:00
Chris Wilson
768b81b78e script: Set decompression length prior to calling decompressors
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59224
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-14 03:27:11 +00:00
Chris Wilson
e1307da861 script: Simply exchange source/dest images for _set_source_image
But note we can only do the exchange if they do indeed match and
there are no other references (the objects are only on the stack).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 15:01:37 +00:00
Chris Wilson
146da77d85 script: Attempt to decompress images in place
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 15:01:37 +00:00
Chris Wilson
45a4b42a36 script: Recompress strings using LZO whilst binding traces
Try using the lighter-weight LZO decompressor in an effort to speed up
replays (at the cost of making the bound traces slightly larger).
Presuming that with the slight increase in file size (from -1% to +10%),
the file data remains in the readahead buffer cache, replays see a
performance improvement of between 5-10%.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-05 21:10:35 +00:00
Chris Wilson
153b11612f script: Fix map-to-image/unmap stack manipulations
The idiom (and expectation) for surface operators is that it leaves the
surface on the stack for the next operation. Also we need to hold onto a
surface reference for objects put onto the stack, yet for the
map-to-image return we did not own one.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-28 09:57:29 +00:00
Chris Wilson
30d09cd33a cairo-script: Attempt to fallback for unresolved patterns
If we fail to resolve a particular pattern, try removing a few features
from the pattern and see if we can resolve that fallback and continue on
with the trace with a close approximation.

This is then behaves very similar as if the pattern requested a specific
font that was not available on the system and so was substituted.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-20 17:20:08 +01:00
Chris Wilson
f5f303f10d script: Prefer polymorphorism for mesh path construction
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:48:50 +00:00
Andrea Canciani
90b2fd34fb cairo-script: Don't ask for inlining of a cold-path function
Silences a lot of warnings:

inlining failed in call to 'scan_read.part.9': call is unlikely and
code size would grow
2011-11-09 14:17:10 +01:00
Chris Wilson
538fa0d6fb fill: Fix unantialiased rectilinear-fill-to-boxes
We were calling the antialias close function from the unantialiased
paths - a function that operates on a completely different structure to
the one passed in.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-30 15:58:14 +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
70cd3b473d api: Extend cairo_antialias_t to include performace/quality hints
The existing API only described the method to be used for performing
rasterisation and unlike other API provided no opportunity for the user
to give a hint as to how to trade off performance against speed. So in
order to no be overly prescriptive, we extend the NONE/GRAY/SUBPIXEL
methods with FAST/GOOD/BEST hints and leave the backend to decide how
best to achieve those goals.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 15:17:38 +01:00
Chris Wilson
2c885a2753 script: Missed break for creating unbounded recording surfaces.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 12:37:57 +01:00
Chris Wilson
9dc9f24884 script: leave the tail of the RGB24 data unmolested
We clear past the end of the row so that we don't trigger valgrind
warning leaving harmless uninitialised bits inside the input image.
However, for RGB24 the input rowlen is 3*width, whereas we write 4*width
of data, so we need to take account of that and ensure we clear beyond
the end of the written data, not the read data.

Fixes reading of RGB24 input.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 12:37:57 +01:00
Chris Wilson
b13266ba0f script: Include an operator to replay a recording surface to a file
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-10 14:06:15 +01:00
Andrea Canciani
89cb071d14 script: Initialize recording extents
The 2-arguments recording operator was passing a garbage pointer to
the surface creation function.

Spotted by the clang static analyzer.
2011-07-29 10:42:06 +02:00
Chris Wilson
a69335a84e API: map-to-image and create-similar-image
A common requirement is the fast upload of pixel data. In order to
allocate the most appropriate image buffer, we need knowledge of the
destination. The most obvious example is that we could use a
shared-memory region for the image to avoid the transfer cost of
uploading the pixels to the X server. Similarly, gl, win32, quartz...

The other side of the equation is that for manual modification of a
remote surface, it would be more efficient if we can create a similar
image to reduce the transfer costs. This strategy is already followed
for the destination fallbacks and this merely exposes the same
capability for the application fallbacks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 14:55:58 +01:00
Chris Wilson
7f77e2f36a trace: Create a new opcode for recording surface
During replay we want to handle recording surfaces specially, and not
redirect the creation of those to the target surface. This is similar to
the need to keep image surfaces as images during replay.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 22:50:25 +01:00
Andrea Canciani
5291f7ccad script-interpreter: Build on win32
Restructure the Makefiles in .sources, .am and .win32 to enable
building cairo-script-interpreter on Win32.

Some minor changes are needed to compile on MSVC:
 - include stdint.h to define INT_MAX-like macros
 - redefine "inline"
 - avoid deprecated functions (snprintf, replaced by _snprintf)
 - define _USE_MATH_DEFINES so that math.h defines M_PI, M_SQRT2 and
   M_LN2
2011-06-24 14:13:09 +02:00
Jesse Barnes
356c4ed9cc Expose 30bpp/10bpc support: CAIRO_FORMAT_RGB30
This is a common format used by framebuffers to drive 10bpc displays
and is often hardware accelerated by XRender with underlying support
from pixman's x2r10g10b10 format (which provides coercion paths for
fallbacks).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-01 09:00:14 +01:00
Andrea Canciani
5f039f0f89 mesh: Rename cairo_pattern_mesh_* functions to cairo_mesh_pattern_*
This is consistent with the naming of most cairo types/functions
(example: cairo_foo_surface_*).

The substitution in the code has been performed using:

  sed -i 's/cairo_pattern_mesh_/cairo_mesh_pattern_/' <files>
2011-02-07 20:28:09 +01:00
Andrea Canciani
96426fdf01 script: Add support for mesh patterns
Extend CairoScript with operators based on the mesh pattern API.
2011-01-01 13:05:13 +01:00
Chris Wilson
2dc42af942 script: Update csi-exec to match new interface. 2010-05-27 17:53:30 +01:00