Commit graph

10583 commits

Author SHA1 Message Date
Chris Wilson
6ee216000a xlib: Explicitly discard the fallback shm pixmap upon user modification
If the user changes the size of the underlying drawable, we much make
sure that we discard the current ShmPixmap in order to create a new
fallback pixmap of the correct size next time.

Reported-by: Weng Xuetian <wengxt@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-13 15:30:27 +01:00
Chris Wilson
e2c4bb9465 xlib: Fix regression in cairo_xlib_surface_set_drawable()
In 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

I made the mistake of inverting the logic for
cairo_xlib_surface_set_drawable() causing it then to never update.

Thanks to Uli Schlachter for spotting my error.

References: https://bugs.freedesktop.org/show_bug.cgi?id=54657
Reported-by: Weng Xuetian <wengxt@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-13 12:40:49 +01:00
Chris Wilson
77330f6b84 xcb: Always flush the fallback damage to foreign drawables
We need to flush any fallback to a foreign drawable upon finish.
However, we must be careful not to attach the snapshot in that case or
else we end up with an expected reference. This is similar to the
treatment of xlib/shm in commit f864e2d70.

Reported-by: Henry Song <henry.song@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-11 18:24:33 +01:00
Andrea Canciani
93774ac034 test: Add degenerate closed path case to get-path-extents
This is a testcase to ensure that we do not regress
https://bugs.freedesktop.org/show_bug.cgi?id=54549 (which is already
fixed by b0c466e27a).
2012-09-10 23:16:08 +02:00
Chris Wilson
f34b87f6d7 path: Convert from backend coordinates back into user coordinates
Fixes regression from commit 83bfd85a13
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Apr 23 19:45:26 2010 +0100

    Implement cairo_backend_t

As there exists no public API to perform the operation we needed, and we
failed to create one, the constructed path failed to correctly remove
the device offset.

Fixes copy-path under device translation.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54732
Reported-by: Benjamin Berg <benjamin@sipsolutions.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-10 15:09:18 +01:00
Chris Wilson
df6780442f context: Add missing functions to transform between user and backend coordinates
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-10 15:09:15 +01:00
Chris Wilson
f864e2d70f xlib/shm: Explicitly release shm surface if we do not own the pixmap
In this case we want to prevent the short-circuiting of the flush of the
ShmPixmap that is ordinarily performed during finish().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-08 16:41:23 +01:00
Chris Wilson
558f0a5ab4 image: Check for an error surface before dereferencing the backend
As the surface->backend will be NULL in such an error surface, and we
may be legitimately doing boundary checks to reject the error surface.
The alternative would be to set an explicit error surface backend.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54664
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-08 15:12:58 +01:00
Chris Wilson
b0c466e27a path: Update last_move_point after move-to
Reported-and-tested-by: Jussi Kukkonen <jku@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54549
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-05 14:55:55 +01:00
Chris Wilson
83759e7d59 default-context: Convert the relative path segments into the backend coordinates
When transforming the incoming paths, the goal is to transform them from
user space onto the target coordinate system. Currently for relative
paths we used user_to_device_distance as we presumed that there was no
backend scale factor. However, Alex Larsson noticed that these then
broke when playing around with such a device transform...

Reported-by: Alexander Larsson <alexl@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-04 14:47:22 +01:00
Chris Wilson
c0b1b17818 xlib/shm: Masquerade as an ordinary ShmCompletionEvent
Needs a bit of extra work to create the extension event, but this leaves
the application with only a single spurious event to filter.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-27 13:21:35 +01:00
Chris Wilson
be2973e405 bentley-ottmann: Cache the most recent edge colinearity check
We frequently compare neighbouring edges for their colinearity (in case
we can skip over them in the active list) so we can record the last
comparison and reuse the result next time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:59:46 +01:00
Chris Wilson
637659fb51 bentley-ottmann: hint that the insertion compare function should be inlined
Albeit it too large for gcc to automatically inline, it is only used
from within a single function. Hopefully gcc can optimise better with
the hint.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:16:32 +01:00
Chris Wilson
3c6e4311fb bentley-ottmann: Only check the pairs of coordinates for equality.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:16:32 +01:00
Chris Wilson
535b4e970c bentley-ottman: Remove a few superfluous status propagation
For the traps it is simpler if we report the status at the end, and
no-op the accumulation of the trap after hitting the error condition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:16:32 +01:00
Chris Wilson
b66065537c stroke: Compute bounds for fallback stroker (typically dashing)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:15:53 +01:00
Chris Wilson
99593538a9 stroke: Convert fallback stroker to new pen vertex finder
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:14:17 +01:00
Chris Wilson
4eb8e9f861 stroke: Convert a very small round-join into a miter
Avoid adding a bevel join if the miter point is within tolerance.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:13:28 +01:00
Chris Wilson
fa93fc63b6 stroke: Precompute the line half-width
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:12:52 +01:00
Chris Wilson
3cf6551ac7 stroke: Use new pen vertex range finders
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:10:42 +01:00
Chris Wilson
74e9ae8cdf pen: Use bisection to speed up vertex finding
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:10:07 +01:00
Chris Wilson
aeb039b16d stroke: Skip spline evaluation when stroking to a polygon
If the spline is wholly outside the clip region, accounting for the
stroke width and additional rendering, then we can simplify that spline
with a straight line.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:08:02 +01:00
Chris Wilson
bdf83008f4 compositor: Skip invisible strokes
If the pen is reduced to a single point, it is effectively invisible
when rasterised, so skip the stroke composition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26 11:07:57 +01:00
Chris Wilson
fc38d7375d xlib/shm: Add missing release of the display after GetImage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-24 17:39:35 +01:00
Chris Wilson
5355eab17d xlib/shm: Reduce the frequency at which we emit events
Flushing the shm operation is a fairly rare event, as it is typically
only involved with mixed rendering on a similar image, and should be
triggering its own events. Therefore we should be able to reduce our
event emission to the critical points in order to limit the amount of
extra overhead we generate.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-24 11:38:58 +01:00
Martin Robinson
5c4087af81 gl: Add a non-thread-aware mode for GL devices
GLX and EGL devices are thread-aware currently. This
is safe, but on certain GPUs can be very expensive. In
this patch, we expose a new API which turns off the
safety feature in cases where performance is a priority.
2012-08-22 13:49:14 -07:00
Martin Robinson
9741099093 gl: Remove the shader language version abstraction
Cairo only needs to support one version of the shader language API,
thanks to the dispatch table. This seems unlikely to change any time
soon. This makes the addition of new features, such as a uniform
location cache, simpler.
2012-08-22 10:42:18 -07:00
Chris Wilson
5c77b4df14 xlib/shm: Only check if we are expecting an event
As the XCheckWindowEvent() has the unwanted side-effect of flushing the
output queue when there is no event available (libX11 seems to be
entirely anti-performant), we need to roll our own that only checks the
already available event queue.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-21 22:20:02 +01:00
Chris Wilson
aa5c712309 xlib/shm: Use a genuine event rather than an open-ended request
Adding lots of requests without popping the replies causes xcb to
continually sort large lists of unprocessed data. Use an event instead
and regularly dequeue them.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-21 10:34:23 +01: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
a7d505d40f ft: Report FILE_NOT_FOUND if creating a font with a specified nonexistent file
If the FcPattern used to create a font specifies an exact file to use
and it does not exist we will fail much later with an ambiguous
NO_MEMORY error. As suggested by Behdad Esfahbod we should report this
back to the user so that they can take the appropriate action rather
than providing an automatic fallback.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-20 16:43:28 +01:00
Chris Wilson
ee7f560719 stroker: Avoid emitting a miter join for across an elided degenerate segment
Given the criteria of the rectlinear stroker that it only handles
horizontal and vertical line segments, and eliminates degenerate
segments before stroking, we must be careful not to apply a join between
two horizontal segments (for example if the intervening vertical segment
was degenerate and so elided). A miter join between two colinear
segments is empty, yet we were blissfully extending the line caps to
cover the join.

Fixes: outline-tolerance
Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=407107
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-20 14:21:23 +01:00
Chris Wilson
2a0d817432 tests: Add outline-tolerance
From https://bugs.freedesktop.org/show_bug.cgi?id=53841:

"Rectangle drawn incorrectly when it has zero height
and miter limit greater than 1.414"

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-20 13:34:33 +01:00
Chris Wilson
d6f8ce91dc xlib: Move the shm cleanup from CloseDisplay to finish()
Make sure that we always detach the ShmSegments upon dispose, or else we
can trivially leak lots of memory when using serial Display connections.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-19 23:55:28 +01:00
Chris Wilson
43c5387d1b ft: Only use a specified font filename if its accessible
If we try to use a non-existent path, FT_New_Face returns an error.
Instead, just use fontconfig to generate a fallback pattern.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-19 12:41:15 +01:00
Chris Wilson
b3448c3dff xlib: Drop the false optimisation of using a potentially busy shm upload pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-18 09:28:37 +01:00
Chris Wilson
10ef077324 xlib/shm: Mark the ShmPixmap as active following an upload flush
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-18 09:16:49 +01:00
Chris Wilson
99a0d38a33 xlib/shm: Fix runtime checking of has-shm-pixmaps for !shm case
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-18 09:10:07 +01:00
Chris Wilson
ec01c71eca xlib/shm: Wrap the detection of shm with locking
As we access a global error variable, we need to hold a mutex against
simultaneous checking of multiple Displays. This should already be true
as we hold our display mutex to serialize initialisation, so just add an
assertion. As the client may mix use of cairo in one thread with X from
another, we need to hold the Display lock and serialise whilst
manipulating the low-level state of the Display.

Suggested-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-18 08:06:26 +01:00
Chris Wilson
1bc9f673b6 xlib/shm: Avoid using a synchronous ShmCreatePixmap if evading the readback
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-18 00:06:06 +01:00
Chris Wilson
3da2d8a1e2 xlib: Only use CopyArea if the ShmPixmap and destination are the same depth
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-18 00:06:06 +01:00
Chris Wilson
94815189a4 xlib/shm: Clear the similar image surface
The upper layers check that the surface returned to userspace is
cleared; make it so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 23:43:26 +01:00
Chris Wilson
c068691ff5 xlib/shm: Use an impromptu upload ShmSegment
Reduce the number of copies required for uploading large image data.
Ultimately we want the client to allocate the similar-image itself to
acheive zero copy, this is just an intermediate step for legacy clients.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 23:43:26 +01:00
Chris Wilson
bc38108947 xlib/shm: Limit use of the impromptu fallback pixmap for uploads
We want to avoid unnecessary readback and so only want to use the
ShmPixmap when uploading the complete surface.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 23:20:01 +01:00
Chris Wilson
4af7a1c863 xlib/shm: Propagate the last-request to the synchronous create
If we optimise away the pending frees we must be careful to propagate
the implied sync.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 23:20:01 +01:00
Chris Wilson
1a87c526bf xcb: Migrate to the common mempool implementation
Having extracted the code for use by the SHM allocator for xlib, remove
the now redundant copy from xcb.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 17:52:37 +01:00
Chris Wilson
e568e7c18b xlib/shm: Fix up the shrinking of the priority queue
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 15:38:16 +01:00
Chris Wilson
7266d59ebc configure: Restore previous pixman required version of 0.22.0
With optional compile time support for pixman glyphs, our hard pixman
requirement is then just 0.22.0 for the radial fixes (iirc).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 15:31:07 +01:00
Chris Wilson
f42c0dcf7b tor22: Add a simple method to quickly compute coverage (with saturation)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 13:58:09 +01:00
Chris Wilson
0bfd2acd35 xlib: Implement SHM fallbacks and fast upload paths
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17 13:58:09 +01:00