Commit Graph

7 Commits

Author SHA1 Message Date
Dave Airlie e7308b6c77 glamor: Add support for CA rendering in a single pass.
It's been on the list to add dual source blending support to avoid the
two pass componentAlpha code.  Radeon has done this for a while in
EXA, so let's add support to bring glamor up to using it.

This adds dual blend to both render and composite glyphs paths.

Initial results show close to doubling of speed of x11perf -rgb10text.

v2: Fix breakage of all of CA acceleration for systems without
    GL_ARB_blend_func_extended.  Add CA support for all the ops we
    support in non-CA mode when blend_func_extended is present.  Clean
    up some comments and formatting.  (changes by anholt)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-01-26 12:02:42 -08:00
Keith Packard b0d2e01031 glamor: Replace CompositeGlyphs code [v2]
New composite glyphs code uses the updated glamor program
infrastructure to create efficient shaders for drawing render text.

Glyphs are cached in two atlases (one 8-bit, one 32-bit) in a simple
linear fashion. When the atlas fills, it is discarded and a new one
constructed.

v2: Eric Anholt changed the non-GLSL 130 path to use quads instead of
two triangles for a significant performance improvement on hardware
with quads. Someone can fix the GLES quads emulation if they want to
make it faster there.

v3: Eric found more dead code to delete

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-05-14 16:32:07 -07:00
Keith Packard 1b745e0c1f glamor: Adapt glamor_program API to handle render acceleration
This extends the existing API to support options needed for render
accleration, including an additional fragment, 'combine', (which
provides a place to perform the source IN mask operation before the
final OP dest state) and an additional 'defines' parameter which
provides a way to add target-dependent values without using a uniform.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-05-14 16:12:42 -07:00
Keith Packard e977b404d7 glamor: * 1/size is faster than / size in VS
Pass the inverse of the texture size to glamor vertex shaders so that
we multiply by that instead of dividing by the size as multiplication
is generally faster than division.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-03-24 12:43:35 -07:00
Keith Packard d18f5801c9 glamor: Add glamor_program based 0-width dashed lines
This makes sure the pixelization for dashed lines matches non-dashed
lines, while also speeding them up.

v2: Switch to glamor_make_current

v3: Create dash pattern pixmap without GLAMOR_CREATE_FBO_NO_FBO

v4: Adopt suggestions from Eric's review:

  - Drops power-of-two alignment of our line vertex data, simplifying
    the code.

  - Stops reading from the VBO.  While on keithp's and my machines the
    VBO is mapped cached, on many implementations it will be mapped WC,
    making those reads extremely expensive.

  - Style fixes (line wrapping, spaces around operators).

v5: Adopt suggestions from Markus' review:

  - Use max when computing zero-width dashed line length.

    Don't open code max here.

  - Embed CoordModePrevious into VBO writing for dashed lines

    Instead of pre-computing the coord mode previous results, just
    embed this in the loop which fills the vertex buffer. Saves
    re-writing the request buffer, and shortens the code a bit

v6: Export glamor_destroy_gc for UXA

    UXA needs to call glamor_destroy_gc from its GCFuncs, so export
    it.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-06-15 22:02:41 +01:00
Keith Packard 45ebc4e3fa glamor: Add glamor_program based copy acceleration
Paints with textures, using a temporary buffer for overlapping copies

Performs CPU to GPU transfers for pixmaps in memory. Accelerates copy
plane when both objects are in the GPU. Includes copy_window
acceleration too.

v2: Use NV_texture_barrier for non-overlapping copies within the same
drawable

v3: Switch to glamor_make_current

v4: Do overlap check on the bounding box of the region rather than
    on individual boxes

v5: Use Eric Anholt's re-written comments which provide a more accurate
    description of the code

v6: Use floating point uniform for copy plane bit multiplier. This
    avoids an int to float conversion in the copy plane fragment shader.

    Use round() instead of adding 0.5 in copy plane. round() and +0.5
    end up generating equivalent code, and performance measurements
    confirm that they are the same speed. Round() is a bit clearer
    though, so we'll use it.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus@selfnet.de>
2014-06-15 22:02:41 +01:00
Keith Packard 029b64c30a glamor: Add infrastructure for generating shaders on the fly
This just adds a bunch of support code to construct shaders from
'facets', which bundle attributes needed for each layer of the
rendering system. At this point, that includes only the primitive and
the fill stuff.

v2: Correct comment in glamor transform about 1/2 pixel correction needed
    for GL_POINT. (Eric Anholt)
v3: Rebase on Markus's cleanups (change by anholt)

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-03-26 12:58:40 -07:00