Commit graph

10771 commits

Author SHA1 Message Date
Chris Wilson
22b7fae036 image: Add a reference for the clone's parent image
We use the parent as a flag during map-to-image/umap-image that the
resultant image came from a fallback rather than as direct call
to the backend's map_to_image(). Whilst we use it as a simple flag,
we need to make sure the parent surface obeys the reference counting
semantics and is consistent for all callers.

Unlike other users of the parent pointer, there is no resource sharing
between the two surfaces.

Reported-by: Henry Song <henry.song@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-31 14:19:53 +00:00
Chris Wilson
ec58fde294 perf: Synchronize before stopping the timers
Fixes a regression from

commit 2855ff4666
Author: Andrea Canciani <ranma42@gmail.com>
Date:   Wed Aug 31 16:42:03 2011 +0200

    perf: Reuse cairo-time

which dropped the essential call to synchronize when refactoring the
code.

Reported-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-31 14:06:48 +00:00
Chris Wilson
2560c0b657 xlib/shm: More clarification of seqno required
Everytime I read the predicate wrong, but hopefully, this time I have it
right!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 23:51:44 +00:00
Chris Wilson
91834fbdee xlib/shm: Clarify testing of seqno
Rename the seqno tests into seqno_passed(), seqno_before() and
seqno_after() in order to clarify their semantics.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 22:26:00 +00:00
Henry Song
89092b97b5 gl/msaa: Don't emit alpha when emitting vertices
The color attribute is disabled when not in spans mode, so the emitted
alpha is simply overwritten by the next vertex. Additionally, this can
potentially cause the alpha to be written past the end of the buffer.
2013-01-29 13:21:00 -08:00
Chris Wilson
74a19c527c configure: Include X11.h before testing for usability of Xrender.h
On Solaris at least, the Xrender.h header is not standalone and requires
X11/X.h to be included first to define the essential types.

Reported-by: Andreas F. Borchert <bugzilla@andreas-borchert.de>
Bugzilla; https://bugs.freedesktop.org/show_bug.cgi?id=58199
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 10:31:05 +00:00
Chris Wilson
41ae904461 xlib/shm: Appease the compiler for a 'maybe used uninitialised' variable
Initialise shm during its declaration so that it is indeed initialised
for the cleanup after every path.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 03:52:02 +00:00
Chris Wilson
9b92625151 xlib/shm: Simplify uploading of SHM image data
Make sure that we simply copy from the SHM segment into the target
drawable, and not inadvertently stage it through another SHM buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 03:51:01 +00:00
Chris Wilson
c006b886d2 xlib/shm: Force synchronisation for scratch SHM image buffers
The scratch image buffers are used for uploads to the xserver and so we
must be careful not to overwrite active SHM segments. Unfortunately we
told the core SHM allocator that we would sync before using the images,
which was a lie.

Reported-by: Michael Natterer <mitch@gimp.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 03:03:42 +00:00
Chris Wilson
fd59e6d86a xlib/shm: Always request a CompletionEvent from ShmPutImage
...and treat is as an expected event for synchronisation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 03:00:46 +00:00
Chris Wilson
a364a106b2 xlib/shm: Tidy up destroying the mempool for a shm block
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 02:52:10 +00:00
Chris Wilson
02a2baa8dc xlib/shm: Tidy creation of the proxy source for ShmPixmaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 02:51:25 +00:00
Chris Wilson
30e9505151 xlib/shm: Skip creating new SHM segments if the data is already in the xserver
If the image is already inside a SHM segment, but the image format does
not match the surface, fallback to the XRender paths in order to perform
colorspace conversion on the data already inside the Xserver.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 02:49:26 +00:00
Chris Wilson
1d1af825bb xlib/shm: Tighten mark-active to the actual CopyArea on the ShmPixmap
Along the draw_image_boxes() upload path, we were actually marking the
ShmPixmap as still active for the subsequent drawing operation - which
could in theory never be submitted...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-29 02:47:48 +00:00
Chris Wilson
3c18bae20e perf; Do not allow the backends to optimize away the clear before sync
The importance of writing to the scratch surface before retrieving an
image is that it makes that the write lands in the server queue, as well
as the GetImage, in order to serialise the timer against all the
operations.

Reported-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-28 10:06:47 +00:00
Chris Wilson
d9d5adec25 image: And more fallout from c986a73, restore the absent short runs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-27 16:51:52 +00:00
Chris Wilson
1ba9fb6fad Mark _cairo_path_is_simple_quad as private
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-27 16:29:41 +00:00
Chris Wilson
1d105f215a image: Fix opaque span fills
I should have realised the previous result was too good to be true!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-27 16:28:54 +00:00
Chris Wilson
c986a7310b image: Enable inplace compositing with opacities for general routines
On a SNB i5-2500:

Speedups
========
         firefox-chalkboard  34284.16 -> 19637.40:  1.74x speedup
         swfdec-giant-steps    778.35 ->   665.37:  1.17x speedup
                  ocitysmap    485.64 ->   431.94:  1.12x speedup

Slowdowns
=========
           firefox-fishbowl  46878.98 -> 54407.14:  1.16x slowdown

That slow down is due to overhead of the increased number of calls to
pixman_image_composite32() (pixman_transform_point for analyzing the
source extents in particular) outweighing any advantage gained by
performing the rasterisation in a single pass and eliding gaps. The
solution that has been floated in the past is for an interface into
pixman to only perform the analysis once and then to return a kernel to
use for all spans.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-26 16:10:47 +00:00
Martin Robinson
cfe0e59663 gl/msaa: Add a fast path for fills that are simple quads
Instead of invoking Bentley-Ottman for fills that are simple
quadrilaterals, just pass the geometry straight to OpenGL.
2013-01-25 16:30:11 -08:00
Henry Song
1e3424cfd1 gl: Use GL_ALPHA textures for CAIRO_CONTENT_ALPHA glyph caching
It's safe to us GL_ALPHA for glyph caching surfaces, since Cairo only
uses them for texture uploading. This saves a little bit of memory.
2013-01-25 14:09:18 -08:00
Henry Song
a44b8bd706 gl: Fix typos in multisampling detection
Instead of looking for the EXT_framebuffer_multisample, this code should
look for GL_EXT_framebuffer_multisample. GL_ARB_framebuffer_object also
contains all necessary API for using multisampling, so we don't need to
check for both it and the GL_EXT_framebuffer_blit and
GL_EXT_framebuffer_multisample pair.
2013-01-25 12:45:10 -08:00
Henry Song
bb40720460 gl/msaa: Fix a memory leak in _clip_to_traps
We need to clean up the polygon we create when decomposing a path into
trapezoids.
2013-01-25 11:55:10 -08:00
Henry Song
7054c9969c gl: Don't query the display when checking if the context changed
If display has changed, the associated context must change. A
context is tied a display so we can avoid this check, eliminating
unnecessary work during context acquisition and release.
2013-01-23 16:55:38 -08:00
Chris Wilson
fa4f48cccb xlib: Do not upload the whole image just because we want an entire row
Fixes regression exposed by

commit a73e7ff018
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jan 6 11:29:27 2013 +0000

    xlib: Simplify source creation by use of map-to-image

but ultimately from

commit 74941f8220
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 2 22:27:55 2013 +0000

    xlib: Use SHM transport for ordinary image uploads

Reported-by: Gökçen Eraslan <gokcen.eraslan@gmail.com>
Reported-by: Guillaume Ayoub <guillaume.ayoub@kozea.fr>
Reported-by: Emmanuel Benisty <benisty.e@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59635
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-23 15:09:35 +00:00
Chris Wilson
ed2fa6b16b version: Post-release bump to 1.12.11 2013-01-16 20:58:46 +00:00
Chris Wilson
2d6204c67d 1.12.10 release 2013-01-16 20:22:38 +00:00
Martin Robinson
1dfea39841 gl: Follow up fix for the previous commit
Handle "fake" surfaces created by _cairo_gl_pattern_to_source which just
embed a GL backend operand. These surfaces do not have a backend, so we
should not fall back if a surface without a backend is not a texture
surface.
2013-01-15 17:14:01 -08:00
Henry Song
769ea3b2c7 gl: Support for non-texture sources and masks
If a GL surface is not a texture and is used as source or mask,
fall back to using an image surface as an intermediary.

Fixes subsurface-image-repeat, subsurface-modify-child,
subsurface-modify-parent, subsurface-outside-target, subsurface-pad,
subsurface-reflect, subsurface-repeat, and subsurface-scale.
2013-01-15 15:09:03 -08:00
Martin Robinson
d01a502710 gl/msaa: Check for more extensions before using MSAA
The MSAA compositor is implicitly relying on the existence of several
OpenGL extensions. This change makes those dependencies explicit.
2013-01-15 12:07:33 -08: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
6639c12310 xlib: Initialise Pixmap for proxy sources
So that we do not try to tell X to free a garbage pixmap and promptly
kill us.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-13 22:48:30 +00:00
Chris Wilson
fd34f420ec compositor: Pass back the internal failure
In order to pass back a CAIRO_INT_STATUS_UNSUPPORTED, we need to use the
internal error surface creation functions as they do not assert on
private error codes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-13 18:37:08 +00:00
Chris Wilson
14c32ee1cf compositor: Convert image surface into backend source
Before passing a surface to the backend composite functions, they expect
them to be a native source. The copy'n'paste code for the mask
compositor forgot to perform the conversion upon the clip surfaces,
which originally were native to the backend and are now images.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-13 18:37:08 +00:00
Chris Wilson
7012334ebb xlib: Handle lack of XRenderFillRectangles
Remember to check for a supported render version before making a
FillRectangle request, and fallback to the core protocol where possible
instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-13 18:37:08 +00:00
Chris Wilson
503b6b9e2e xlib: Only fallback through the mask intermediate if we can composite the mask
Before rendering into the mask, we should first check whether the
subsequent call to composite the mask will trigger a fallback. In that
case, we should fallback earlier and do the operation in place.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-11 13:18:26 +00:00
Martin Robinson
1bcd59ef4c gl/msaa: Rely on the stencil buffer to cache the clip
When using a texture surface the depth/stencil buffer is private to
cairo so we can rely on the fact that any previously painted clip is
still valid.

We also only scissor when there's a previously painted clip on the
stencil buffer, otherwise we disable the scissor test. This fixes a few
test cases.
2013-01-09 14:33:41 -08:00
Martin Robinson
d524697ede gl/msaa: No need to set the clip when masking
After 5e9083f882 there's no need to set a
clip on the cairo_gl_composite_t when masking. Clips are converted to
traps and rendered directly when masking now.
2013-01-09 14:33:41 -08:00
Chris Wilson
17418371b6 xcb: _cairo_scaled_font_reset_cache does it own locking
So we can drop ours.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-09 15:06:28 +00:00
Chris Wilson
dd20c1f4d6 xlib: map-to-image requires an extents
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-09 12:38:09 +00:00
Chris Wilson
351a9e756d stroke: Flip the dev slope as well for computing the cusp on a degeneracy
Otherwise, the join think it starts and end in exactly the same
direction and elimiates the round capping.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-09 12:31:10 +00:00
Chris Wilson
14720cd0db gstate: Use the polygon intermediate for geometry queries
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-09 12:11:25 +00:00
Chris Wilson
a942938e90 scaled-font: Fix use after free when clearing the glyph cache
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-09 00:36:13 +00:00
Chris Wilson
c5b353c372 scaled-font: Make reset-font-cache threadsafe
Stop trying to workaround the destroy-callback requiring the font mutex
as we already hold the mutex whilst cleaning up the font caches.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-09 00:26:19 +00:00
Martin Robinson
d1184b69e8 gl: Do less work when acquiring and releasing devices
After acquiring a GL device and the same GL context, surface, and
display combination is already active outside of Cairo, do not ask EGL
or GLX to change the current context as that may cause a flush on some
drivers. Also do not unset the context when releasing the device for the
same reason.
2013-01-08 15:09:33 -08:00
Chris Wilson
7401455cb4 image: Allocate a temporary buffer for inline span composition
Allow the inpline span compositor to operate on wider images than its
temporary buffer by allocating a scanline mask.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 22:26:25 +00:00
Chris Wilson
0d38518c38 scaled-font: Remove a non-threadsafe double-freeze assert
Sadly we cannot check ahead of acquiring the lock whether we hold the
lock. Just have to rely on lockdep.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 18:52:08 +00:00
Chris Wilson
e4acba6d1d xlib/shm: Only destroy an existing damage
_cairo_damage_destroy() does not like to be passed a NULL.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 16:38:11 +00:00
Chris Wilson
2ed484817e xlib/shm: Discard damage upon shm finish
Both to make sure we do not leak the memory, but to also prevent
_cairo_xlib_surface_put_shm() from operating upon the finished shm
surface after the display is closed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58253
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 16:07:32 +00:00
Chris Wilson
b5dcc8ce44 scaled-font: Hold the scaled font mutex whilst reaping from the global cache
If we need to reap the global cache, this will call back into the scaled
font to free the glyph page. We therefore need to be careful not to run
concurrently with a user adding to the glyph page, ergo we need locking.
To complicate matters we need to be wary of a lock-inversion as we hold
the scaled_font lock whilst thawing the global cache. We prevent the
deadlock by careful ordering of the thaw-unlock and by inspecting the
current frozen state of the scaled-font before releasing the glyph
page.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 15:03:25 +00:00