Commit graph

6895 commits

Author SHA1 Message Date
Chris Wilson
c4ea7b13b4 scaled-font: Assert if attempting to finish a frozen font
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 15:03:06 +00:00
Chris Wilson
4d4bf8fddf scaled-font: Free the cached glyphs from the font before taking the global lock
In the case of a recording surface we may recurse into the global glyph
cache so we need to be careful and stage the ordering of how we free the
glyphs. So first we finish any information and surfaces from the scaled
font glyph cache (and so triggering recursion into other scaled fonts)
and then take the global cache and remove our pages.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54950
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 15:02:27 +00:00
Chris Wilson
44a093eb95 scaled-font: Always hold the mutex even for single glyph probes
The freeze/thaw routines have a side-effect of managing the global glyph
cache in addition to taking the mutex on the font. If we don't call
them, we may end up indefinitely keeping the global glyph cache frozen
(effectively leaking glyphs to the maximum of all open fonts) and
triggering asserts.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 15:02:26 +00:00
Chris Wilson
80cc532271 script: Thaw the scaled font cache on the error path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-08 15:01:38 +00:00
Chris Wilson
5f2e89660d image: Call pixman without a mask for opaque regions of inplace_spans
Speedups
========
firefox-paintball  59462.09 -> 40928.76:  1.45x speedup
 firefox-fishtank  43687.33 -> 34627.78:  1.26x speedup
     firefox-tron  52526.00 -> 45754.73:  1.15x speedup

However in order to avoid a regression with firefox-talos-svg we need to
prevent splitting up the scanline when using a gradient source.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-07 17:58:02 +00:00
Chris Wilson
a73e7ff018 xlib: Simplify source creation by use of map-to-image
We were open-coding the functionality of map-to-image inside the source
creation routines. so refactor to actually use map-to-image instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-06 11:30:02 +00:00
Chris Wilson
4f142f3a7b xlib/shm: Only mark the shm pixmap as active if we upload into it
Be more strict with when we mark the pixmap as active so that we only
wait for the actual XCopyArea involving the pixmap to complete.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-06 10:32:25 +00:00
Martin Robinson
9194904fa8 gl: Better handling of clear surfaces
When clearing a GL surface, set is_clear to true, and when mapping to an
image, handle is_clear like surfaces without modification. Additionally,
explicitly clear surfaces created via cairo_surface_create_similar.
2013-01-04 16:31:01 -08:00
Henry Song
9dde964553 gl/msaa: Only clear parts of the stencil buffer we will use
Writing to the stencil buffer can be expensive, so when using the
stencil buffer for clipping only clear the clip extent. When using the
stencil buffer to prevent overlapping rendering during stroking, only
clear the approximate stroke extents.
2013-01-03 16:37:18 -08:00
Alejandro G. Castro
5e9083f882 gl/msaa: Avoid the stencil buffer when possible during masking
In this case we can draw the clip path and avoid the stencil buffer,
which can be expensive.
2013-01-03 16:37:18 -08:00
Henry Song
dd850583a7 gl/msaa: Add full support for masking with the SOURCE operator
Since OpenGL does not have a means to represent a masking SOURCE
operation in one step, we use two steps combined with the ADD
operator.
2013-01-03 15:58:19 -08:00
Chuanbo Weng
c743e93451 gl: Support the GL_IMG_texture_npot extension
This extension, used by older PowerVR drivers, is functionally
equivalent to the GL_OES_TEXTURE_NPOT extension.
2013-01-03 11:40:36 -08:00
Chris Wilson
ae1724ced9 Add missing local slim proto for cairo_recording_surface_create
Dependency introduced in 749ef6be4d

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-03 15:07:18 +00:00
Chris Wilson
872a92b874 scaled-font: Mention ownership of returned object from get_font_face()
As suggested by Simon Sapin.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-03 15:07:18 +00:00
Chris Wilson
734a541dc3 xlib: Avoid copying the source twice if it is an image
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-03 15:07:18 +00:00
Chris Wilson
5bc1b1f6aa stroke: Make the incremental trapezoid stroker optionally available again
Whilst it cannot handle self-intersecting strokes (which includes the
antialias region of neighbouring lines and joints), it is about 3x
faster to use than the more robust algorithm. As some backends delegate
the rendering, the quality may still be preserved and so they should be
responsible for choosing the appropriate method for generation of the
stroke geometry.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-03 15:07:18 +00:00
Chris Wilson
74941f8220 xlib: Use SHM transport for ordinary image uploads
In theory this should just save a single copy, however PutImage will
break up requests into a series of scanlines requests which is less
efficient than the single-shot transfer provided by ShmPutImage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-03 12:28:33 +00:00
Chris Wilson
bf2a04c5ab xlib/shm: Fix typo in creation of a SHM image
Pass along the size the caller requests, not the size of the related
drawable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-03 12:27:34 +00:00
Chris Wilson
c29ab389fb gl: Provide a fast emitter for solid spans
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-30 12:54:26 +00:00
Chris Wilson
d3848521c4 gl: Provide a fast emitter for solid glyphs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-30 12:47:02 +00:00
Chris Wilson
127dd46669 gl: Use vfunc for vertex emission
In order to overload the emitters in future to provide specialised
routines for the common types of operands, begin by switching the
current users over to a vfunc interface.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-30 12:21:11 +00:00
Chris Wilson
71028865fa Revert "xlib/shm: Do not trigger a surplus event from XShmPutImage"
This reverts commit c97f2d4acd.

Testing suggests that keeping that event is a win; so do so.
2012-12-29 15:05:53 +00:00
Chris Wilson
c97f2d4acd xlib/shm: Do not trigger a surplus event from XShmPutImage
As our lazy event mechanism is sufficient for tracking when to reuse shm
memory, and the events are not necessary for ShmPut/ShmGetImage paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-29 14:56:24 +00:00
Chris Wilson
0c84a5474d xlib/shm: Rate-limit events and only use as necessary
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-29 14:55:17 +00:00
Martin Robinson
21db1c9910 gl: Cleanup selection of multisampling mode
Fold the choice of multisampling mode into the cairo_gl_composite_t
structure itself. This makes it more similar to other settings.
2012-12-28 14:29:24 -08:00
Chris Wilson
7d02e2d62d xlib/shm: Populate send_event and serial
Hopefully this random choice is more meaningful than random junk.

Bugzilla; https://bugs.freedesktop.org/show_bug.cgi?id=58672
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-23 11:19:16 +00:00
Adrian Johnson
e748c12243 doc: Add CAIRO_MIME_TYPE_UNIQUE_ID to list of supported mime types 2012-12-22 18:34:43 +10:30
David Maxwell
4e751fcb03 type1-subset: always include subroutine 4 (hint replacement idiom)
http://lists.cairographics.org/archives/cairo/2012-December/023846.html
2012-12-22 14:36:38 +10:30
Behdad Esfahbod
b94a519aad [ft] Fix resizing of bitmap fonts
Say, you were asking cairo for a font at 200px.  For bitmap-only fonts,
cairo was finding the closes strike size and using it.  If the strike
was at 20px, well, that's what you were getting.  We now scale that 20px
strike by a factor of 10 to get the correct size rendering.

Note that by itself this patch doesn't change much on the Linux desktop.
The reason is that the size you are interested in (eg. 200px) is lost by
fontconfig.  When you request a font at 200px, fontconfig returns a font
pattern that says 20px, and so the next layers thing you want a font at
20px.  To address that, one also needs a piece of fontconfig config that
puts the 200 back into the pixelsize.  Something like this:

<match target="font">
  <test name="scalable" mode="eq">
    <bool>false</bool>
  </test>
  <edit name="pixelsize" mode="assign">
    <times>
      <name>size</name>
      <name>dpi</name>
      <double>0.0138888888888</double> <!--1/72.-->
    </times>
  </edit>
</match>

I'm going to try to upstream this config so it will be enabled by
default.  The config can be a bit smarter.  For example, if
metricshinting is enabled and the size difference is small, we may as
well not scale.

The nice thing about this is that the configuration of whether and when
to scale bitmaps will be done in fontconfig, not cairo / Qt / ... code.
2012-12-21 18:47:16 -05:00
Behdad Esfahbod
1404ed9692 [ft] Remove ancient check for FT_Bitmap_Size.y_ppem
That member is available in the version of FreeType we require.
2012-12-21 18:47:10 -05:00
Behdad Esfahbod
867c876b0e [Minor] Improve logging 2012-12-21 18:46:56 -05:00
Adam Jackson
5d21c9e224 xlib/shm: Fix memory leak
Despite subclassing image surfaces, we never called down to the image
surface destructor, so we leaked a pixman_image_t every time.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=882976
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-12-18 20:27:19 +00:00
Uli Schlachter
51435eeb0c xcb: Fix xcb-huge-subimage
This teaches the xcb backend how to split up a PutImage request for a subimage
into multiple requests. The backend already does the same for "normal" PutImage
where it doesn't have to assemble the image from various rows.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-12-17 18:37:10 +01:00
Uli Schlachter
749ef6be4d context: Use recording surfaces for unbounded groups
The old code uses an uninitialized variable for the extents of the group that is
created. This patch makes it use an unbounded recording surface instead.

This has the implicit assumption that everything that is unbounded smells like a
recording surface. Let's see when this assumption breaks. :-)

http://lists.cairographics.org/archives/cairo/2012-October/023585.html

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-12-17 18:37:09 +01:00
Martin Robinson
433a5829d7 Revert "gl/msaa: Share the depth/stencil buffer among all surfaces"
This was pushed mistakenly. Sorry.

This reverts commit a7d684e6fe.
2012-12-17 17:56:19 +01:00
Martin Robinson
9d9aa04b60 gl: Add BGRA download support for GLES2
Some OpenGLES2 drivers support downloading BGRA data. On little-endian
systems BGRA and GL_UNSIGNED_BYTe is equivalent to the typical
cairo_image_t format, so this can prevent CPU bit swizzling for
operations that involve images.
2012-12-10 10:18:15 +01:00
Martin Robinson
a7d684e6fe gl/msaa: Share the depth/stencil buffer among all surfaces
Instead of allocating a depth/stencil buffer for all surfaces, share a
common buffer that's the size of the largest surface. This reduces
video memory usage when there are many GL surfaces.
2012-12-08 13:31:13 +01:00
Chuanbo Weng
ba4a4eae05 gl/msaa: Use GL_IMG_multisampled_render_to_texture when available
Some OpenGLES platforms support GL_IMG_multisampled_render_to_texture
instead of GL_EXT_multisampled_render_to_texture.
2012-12-05 16:17:10 -08:00
Henry Song
3bedff0c00 gl: Properly disable ctx->spans when necessary
When compositing starts, if we are not using the spans compositor, we
should set the spans member of the context to false.
2012-12-05 15:56:35 -08:00
Henry Song
18e7234c7e gl/msaa: Also setmsaa_active to true for non-texture surfaces
This is important because there are places in the code where msaa_active
is used to decide whether or not to complete an operation with
multisampling or not.
2012-12-05 15:30:28 -08:00
Henry Song
9f43f096b2 gl: Flush context upon evicting a gradient
As the random selection of a gradient can possible destroy the currently
active gradient, we need to flush the context in order to flush any
references to the texture before deletion.
2012-12-01 17:08:56 +00:00
Chris Wilson
a0fb139131 mempool: Reduce the assertion into an alignment adjustment for the base
Instead of asserting that the caller passed in a chunk-aligned base
pointer, just perform the fixup whilst initialising the mempool. This
means that the caller (xcb!) cannot assume that the mempool->base is
then the same base pointer as passed in and so needs to store it
separately for use in computing SHM offsets.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-01 09:23:37 +00:00
Zozó Teki
62b795fe52 recording: Append new elements to the end of the bbtree chain
I have noticed that some of my objects were lost when drawing them on
a recording surface and playing them back. Later elements with the same
extents as a prior one tend to disappear from the chain of headers
having similar extents. After doing some debugging, I found that they
are not properly added to the bbtree during playback, and were instead
clobbering the existing chain.
2012-11-10 08:37:23 +00:00
Adrian Johnson
cf07bd866d type1-subset: remove unused variable 2012-11-03 11:08:01 +10:30
Adrian Johnson
9f537156ad type1-subset: fix memory leak 2012-11-03 11:07:02 +10:30
Chris Wilson
724c6dfa95 xlib/shm: Need IncludeInferiors when creating the source fallback
Reported-by: Benjamin Otte <otte@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-02 17:01:07 +00:00
Chris Wilson
1f4d05b55c stroke: Fix calling '_cairo_spline_intersect' for in-bounds checking of splines
Fixes stroke-clipped, within reason. There still remains some
antialiasing noise (between rendering the circle piecewise and wholly)
worth investigating - but that is probably an artefact of switching
between analytical rendering modes in the scanline
rasterisation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-02 14:53:18 +00:00
Chris Wilson
e9d4570584 pen: Tighten checking for bevel (start==stop) joins
From commit d7f5a1bec4
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Oct 31 09:27:52 2012 +0000

    pen: First check whether the in/out edges lie within the single pen vertex

makes a couple of tests much happier.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-01 11:42:46 +00:00
Chris Wilson
90860241bb gl: Tune the default VBO size to reduce overhead on embedded devices
Henry Song found that the 256k buffers were disadvantageous on his
embedded hardware. As there is no obvious right value for the default
VBO size, we can tune for the more obvious constraints.

Based on a patch by Henry Song <henry.song@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-01 09:47:00 +00:00
Chris Wilson
0c1ff1572f xlib: Fixup standalone header compilation for 'make check'
Missing include of string.h

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-01 08:45:37 +00:00