Commit graph

6768 commits

Author SHA1 Message Date
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
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
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
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
Daniel Stone
140fafed89 Fix broken XRender ARGB32 formats
46d79228 did indeed silence the compilation warning, but did so by never
creating an ARGB32 format, as PictStandardARGB32 is defined to 0.  Fix
this by using PictStandardNUM as our canary value instead.

This fixes GEdit and Chromium for me, both of which were only rendering
backgrounds and text in their GTK+ sections.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-08-16 20:11:44 +01:00
Chris Wilson
95b7f4fe3a image: Temporarily resurrect the old non-pixman glyph compositor
As the easiest approach to making another snapshot that only depends
upon a stable pixman, make the new dependency a compile time option.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-12 19:10:04 +01:00
Chris Wilson
16426dab48 skia: Compile fix for changes to map-to-image
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-12 16:12:47 +01:00
Chris Wilson
d647d4f7db damage: Update tail pointer after allocating new chunk
Reported and based on a patch by fmot.fics

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53384
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-11 19:29:19 +01:00
Chris Wilson
adfe9b7eb6 gl: Fudge gradient color generation to handle multiple stops at 0
In order to generate the correct left-hand border color, we need to
fudge the offsets of the color stops if multiple stops are defined at 0.
The reason is that pixman will generate our color ramp by using the
right-most color stop for the pixel centre, but in order to provide the
sample colour outside of the gradient we need pixel 0 to be have the
left-most color.

Reported by Henry Song.
2012-08-11 18:25:27 +01:00
Chris Wilson
b0336e9aad gl: Use a wide texture ramp to emulate a linear step function
If the gradient contains a step function, we need an infinitely sharp
texture to emulate the correct output. Failing that, lets just use as
large a texture as can be reasonably handled by the hardware
2012-08-11 18:25:27 +01:00
Chris Wilson
46d79228df xlib: Silence compiler warning
cairo-xlib-display.c: In function '_cairo_xlib_display_get_xrender_format':
cairo-xlib-display.c:519:21: warning: 'pict_format' may be used
uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-11 17:48:17 +01:00
Chris Wilson
40e6be3278 gl: Remove unused variable
cairo-gl-glyphs.c: In function '_cairo_gl_composite_glyphs_with_clip':
cairo-gl-glyphs.c:442:9: warning: unused variable 'i' [-Wunused-variable]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-11 17:43:46 +01:00
Chris Wilson
f59b0914f4 egl: s/EGL_KHR_surfaceless_opengl/EGL_KHR_surfaceless_context/
Mesa changed the name of the extension it invented, so check for the
real name and the old name before falling back to pbuffers which are not
supported by most EGL implementations.

References: https://bugs.freedesktop.org/show_bug.cgi?id=53361
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-11 17:42:17 +01:00
Adrian Johnson
65854a0015 type1 subset: ensure encoding includes all glyphs
Bug 53040
2012-08-03 18:23:55 +09:30
Adrian Johnson
5dd0f2eb95 cff subsetting: widths can be floating point
Bug 52972
2012-07-31 22:52:09 +09:30
Henry Song
1e9abd6e4e gl: use absolute value for color difference between gradient stops 2012-07-26 18:32:00 +01:00
Chris Wilson
652c632fb2 gl: Fallback for copy_boxes if src/dst do not belong to the same device
If the source and destination are on difference devices (GL contexts) we
can not simply texture from one to the other, and must either import the
source into the destination context (which has not yet been done) or
fallback through an image copy.

This patch is based on the work by Henry Song, but moving the check from
the common compositor layer down into the GL backend. This should have
the same effect...

Fixes gl-surface-source

Suggested-by: Henry Song <henry.song@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-25 17:08:30 +01:00
Henry Song
f3abb1079a gl: translate proper matrix depending up type of gl_operand
Fixes radial-gradiant-mask-source.
2012-07-25 17:08:30 +01:00
Andrea Canciani
d00539ca13 quartz: Use the correct transform when replaying recording surfaces
Recording surfaces should be replayed with the transform matrix used
in the pattern, otherwise the image surface will be transformed,
introducing artifacts.

Fixes record{1414x,2x}-paint-alpha-{,solid-clip,clip},
record2x-{self-intersecting,text-transform} and record90-paint-alpha.
2012-07-24 11:06:30 +02:00
Henry (Yu) Song - SISA
44a07a6613 quartz: Never acquire recording surfaces
We need to replay if the source/mask surface is a recording surface
otherwise, a crash happens if it is unbounded.

Fixes crashes in recordxx-xxx tests
2012-07-24 11:06:30 +02:00
Henry (Yu) Song - SISA
459c060b6f clip: Transform clip path in _cairo_clip_intersect_clip_path_transformed()
_cairo_clip_intersect_clip_path_transformed() completely ignored the
transformation matrix instead of transforming all the clip paths with
it.

This caused bugs when replaying recording surfaces.

Fixes record{2x,1414x,90}-paint-alpha-clip-mask.
2012-07-24 11:06:29 +02:00
Andrea Canciani
5f1dd8b368 xcb: Fix make check
The xcb private header uses the ASSERT_NOT_REACHED macro.
This macro is defined in cairoint.h, which needs to be included.

Fixes:

  CHECK cairo-xcb-private.h
In file included from headers-standalone-tmp.c:1:
./cairo-xcb-private.h: In function ‘_cairo_xcb_connection_shm_put_image’:
./cairo-xcb-private.h:636: error: ‘ASSERT_NOT_REACHED’ undeclared (first use in this function)
./cairo-xcb-private.h:636: error: (Each undeclared identifier is reported only once
./cairo-xcb-private.h:636: error: for each function it appears in.)
2012-07-24 10:45:52 +02:00
Chuanbo Weng
21e3f2e903 gl: copy_boxes() does not support copying from a non-texture source
So check for the appropriate surface type at the start and return
UNSUPPORTED if we cannot handle it directly. We will then fallback to
pushing the image instead.

Together with the previous patch, fixes 8 fails in cairo-test-suite.
2012-07-12 18:15:00 +01:00
Chuanbo Weng
77f8bd3199 gl: Create a new texture surface if the source surface type is gl-window
When the source surface type is gl-window, we should return unsupported
and then create a new texture surface for it. Based on the code of
Henry's tree.
2012-07-12 18:14:59 +01:00
Dongyeon Kim
ac2668dd08 gl: Set is_clear flag to FALSE after map_to_image
In _cairo_gl_surface_map_to_image(), the image surface data has been
filled by glReadPixels, so is_clear flag should be set to FALSE.
Otherwise mapped image surface does not get drawn as it is presumed
clear and so returns true from nothing_to_do().
2012-07-12 18:14:59 +01:00
Chris Wilson
6aed048484 gl: Add the compile fix that I forgot to add to the previous commit 2012-07-11 11:51:36 +01:00
Henry Song
bdb9c2cb43 gl: Destroy glyph cache surface during finish
We must destroy glyph cache surface in device_finish instead of in
device_destroy because in device_destroy device status is
DEVICE_FINISHED and the operation is invalid.
2012-07-11 10:05:51 +01:00
Henry Song
64a236246b gl: generate correct gradient color texture
Pixman generates gradient color at the center of pixel.  We need to
adjust such accordingly in GL when generating gradient texture
2012-07-10 16:14:54 +01:00
Chris Wilson
6938592ec7 xlib: If a sample accesses outside of a repeating image, upload it all
Fixes bug-51910

Reported-by: Albertas Vyšniauskas <thezbyg@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51910
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-09 21:57:03 +01:00