| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Fixes #508
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is _cairo_recording_surface_replay_and_create_regions()
stores the cairo_recording_region_type_t in the same structure as the
recording commands. This does not work well when the recording surface
is used as source by multiple surfaces
Fix this by moving the cairo_recording_region_type_t into a separate
struct cairo_recording_regions_array_t. This struct is stored in a
list that allows multiple create regions results to be store in the
surface.
The new function _cairo_recording_surface_region_array_attach() is
used to create a new cairo_recording_regions_array_t, attach it to the
recording surface and return a unique region id.
The _cairo_recording_surface_replay_and_create_regions() and
_cairo_recording_surface_replay_region() functions use this region id
to identify the cairo_recording_regions_array_t.
To handle nested recording surfaces, when replaying a recording, the
region id is passed to the target as an extra parameter in the surface
pattern. The wrapper surface makes a temporary copy of the pattern to
ensure the snapshot pattern in the recording surface is not modified.
cairo_recording_regions_array_t has a reference count so the target
can hold on to the cairo_recording_regions_array_t after the paginated
surface has called _cairo_recording_surface_region_array_remove().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
_cairo_malloc(0) always returns NULL, but has not been used
consistently. This patch replaces many calls to malloc() with
_cairo_malloc().
Fixes: fdo# 101547
CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
| |
|
|
|
|
|
|
| |
On vector surfaces, use a minimum line width when calculating extents.
Bug 77298
|
|
|
|
|
|
|
|
| |
The analysis to deterimine if the GOOD filter can be replaced with
the BILINEAR filter is moved to this function so it can be used
by backends other than the image backend.
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This version removes testing code and has some changes to match my current
pixman version. My proposed pixman patch (not finished yet) will produce
exactly the same results as this cairo patch.
This code contains an all-new filter generator to replace the one that is
in pixman. Results in 222 pass/298 failed image tests, which is much better
than the previous versions of this patch.
Filter generator (which should probably be in pixman):
- Single filter, no "reconstruction" and "sample" filter
- Filters for derivative < 1 work
- Fixed IMPULSE and BOX
- Added TENT, CATMULL_ROM, NOTCH. Remove LANZCOS2.
- Renamed CUBIC to MITCHELL
Cairo's filter settings:
- CAIRO_FILTER_GOOD: uses BOX filter for scales less than .75 in either
direction. Uses PIXMAN_FILTER_GOOD (ie BILINEAR) otherwise.
- CAIRO_FILTER_BEST: uses CATMULL filter always. Upscaling more than 2x will
produce anti-aliased square pixels, similar to OS/X.
- CAIRO_FILTER_GAUSSIAN: this obsolete value is used to test other filters.
The program must declare and poke the filter into the static varialbe
ikernel. This should be removed for production code.
NYI: This version uses the fallback for xlib always. The xlib and xcb backends
must be rewritten to use the fallback version if filtering is needed. Or the
filtering code must be moved to XRender.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
downscaling"
This reverts commit fb57ea13e04d82866cbc8e86c83261148bb3e231.
When running cairo-test-suite with the parameter "-a", it also runs each test
with a non-zero device-offset and device-scaling. The above commit influenced
the device-scaling results badly. E.g. some test results ended up with a black
border at the top-most and left-most row that looked like there was an offset of
"0.5" in drawing the image and thus pixels outside of the image were sampled.
This can be seen by the influence that this revert has on the results from
running CAIRO_TEST_TARGET=image ./cairo-test-suite -a:
Before: 31 Passed, 489 Failed [1 crashed, 8 expected], 31 Skipped
After: 225 Passed, 295 Failed [1 crashed, 8 expected], 31 Skipped
Most of the failures that disappeared are from the device-scaling tests.
With such disastrous results on the test suite, this cannot really be usable for
real-world applications.
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I had a look at how complex would it be to add correct downscaling to
Cairo now that Pixman supports convolution filters. It turns out it
this is rather easy. Here is an initial, minimal attempt. It uses
convolution filters only if the image is being downscaled by more than
half a pixel in at least one dimension.
Some discussion:
1. The sampling and reconstruction kernels are picked in a way that
gives comparable quality when upscaling and downscaling. I paired box
sampling with bilinear reconstruction and impulse (point) sampling
with box reconstruction. This gives the expected result for NEAREST
filter. BEST filter uses Lanczos3 for both kernels.
> Do we need to use a reconstruction filter for NEAREST at all? Or maybe
> differentiate between NEAREST and FAST in that case?
If impulse (point) sampling is used, there must be some reconstruction
filter, otherwise no image is produced. That's because the sampling
grid does not match the data grid, and since there is no
reconstruction filter, values between data points are undefined. The
alternative is to use box sampling + no reconstruction.
2. Subsampling bits are always set to 1, since this doesn't seem to
affect quality at all.
3. I am not sure whether this code works correctly for matrices with a
skew component. It should be OK for any combination of scale, rotation
and translation.
4. This patch causes new failures in the test suite:
- recording-surface*: possibly an effect of improved quality.
- surface-pattern-scale-down*, surface-pattern-big-scale-down: the
reference images should be updated.
- pthread-same-source: I have no idea why this is failing, since this
test shouldn't even trigger the new code.
- large-source-roi: this test attempts to downscale an image which is
30000 pixels wide down to 7 pixels. The filter parameters seem to be
created correctly, but they might trigger an overflow somewhere in the
convolution code; the output rectangle is white instead of red, as if
nothing was drawn.
- device-offset-scale: there are subtle differences which look like
convolution-related smoothing; I'm not sure whether this is OK or not.
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to prevent a race between concurrent destroy and use in another
thread, we need to acquire a reference to the snapshot->target under a
mutex. Whilst we hold that reference, it prevents the internal destroy
mechanism from freeing the memory we are using (if we have a pointer to
the original surface) and the client drops their final reference.
Oh boy, talk about opening a can of worms...
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
| |
References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
| |
References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
|
|
|
| |
Clearly demonstrated by using the test-base with the recording surfaces
and exemplified by the fallback-resolution with PDF, which is *almost*
fixed!
We're very close to making a release candidate for 1.12 now...
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
|
|
|
|
| |
Borrow the technique for installing a proxy-snapshot developed for
acquiring the image from a recording surface.
This prevents the cairo from exploding and using up all memory due to
infinite recursion, but it does break a few tests that perform
self-copies with differing transformations.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
| |
As _cairo_surface_get_source() returns the limits of the source, a chunk
of code to query the source extents became redundant.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
|
|
|
| |
Try and undo all the damage that has acrued over the years by plugging
into the compositor pipeline.
References: https://bugs.freedesktop.org/show_bug.cgi?id=42739
References: https://bugs.freedesktop.org/show_bug.cgi?id=42821
References: https://bugs.freedesktop.org/show_bug.cgi?id=33081
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
| |
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
| |
And reuse it.
|
|
|
|
|
|
|
|
|
|
| |
As discussed, overloading the cairo_surface_t semantics to include
sources (i.e. read-only surfaces) was duplicating the definition of
cairo_pattern_t. So rather than introduce a new surface type with
pattern semantics, start along the thorny road of extensible pattern
types.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
| |
By this point we have already paid the penalty for acquiring the source
image, so kiss.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
|
|
| |
In order to handle out-of-bounds sampling of a subsurface target we need
to first avoid incorrectly unwrapping it.
Fixes crash in subsurface-outside-target
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
It is already captured by the pattern extents.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
| |
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
| |
Fixes up the boundary on EXTEND_NONE replays.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
|
|
|
| |
The previous commit should have been a enormous warning that something
was horribly wrong. I was determined to preserve the optimisation of
replaying onto the matching format, however, we need to provide an alpha
channel if required.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
| |
When applying masks, typically it is useful to have an alpha channel.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
|
|
|
|
| |
Hmm, still not quite right but an improvement.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
|
|
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. :)
|