Commit Graph

20 Commits

Author SHA1 Message Date
Dave Airlie a955286869 glamor: add EXT_gpu_shader4 support
This enables a number of the GLSL 1.30 paths on GPUs that have
EXT_gpu_shader4 but don't have GLSL 1.30 exposed.

(Intel gen4/5 mainly)

Reviewed-by: Adam Jackson <ajax@redhat.com>
2021-07-07 08:42:09 +10:00
Eric Anholt 1b2e224d7d glamor: Switch the gl_flavor to a boolean is_gles.
There are only 2 flavors we are distinguishing -- GL versions are
handled separately.

Signed-off-by: Eric Anholt <eric@anholt.net>
2019-04-17 19:34:48 +00:00
Adam Jackson 8171d4c2d6 render: Store and use all 16bpc of precision for solid pixels (v2.1)
This plumbs the full width color for solid pictures through to fb, exa,
and glamor. External drivers and acceleration code may wish to make a
similar change for sufficiently new servers.

v2: Don't break ABI (Michel Dänzer)
v2.1: Use the (correct) full color in fb too (Michel Dänzer)

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2018-02-26 16:46:34 -05:00
Eric Anholt 2aca2dadda glamor: Fix link failure on GLES2.
Current Mesa requires that the precision qualifier on uniforms matches
between stages, even if (as in this case) the uniform isn't used in
one of the stages.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-29 09:11:12 -07:00
Keith Packard 181a4bd0cc glamor: Preserve GL_RED bits in R channel when destination is GL_RED [v2]
A1 and A8 pixmaps are usually stored in the Red channel to conform
with more recent GL versions. When using these pixmaps as mask values,
that works great. When using these pixmaps as source values, then the
value we want depends on what the destination looks like.

For RGBA or RGB destinations, then we want to use the Red channel
for A values and leave RGB all set to zero.

For A destinations, then we want to leave the R values in the Red
channel so that they end up in the Red channel of the output.

This patch adds a helper function, glamor_bind_texture, which performs
the glBindTexture call along with setting the swizzle parameter
correctly for the Red channel. The swizzle parameter for the Alpha
channel doesn't depend on the destination as it's safe to leave it
always swizzled from the Red channel.

This fixes incorrect rendering in firefox for this page:

	https://gfycat.com/HoarseCheapAmericankestrel

while not breaking rendering for this page:

	https://feedly.com

v2: Add change accidentally left in patch for missing
    glDisable(GL_COLOR_LOGIC_OP).
    Found by Emil Velikov <emil.l.velikov@gmail.com>

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63397
Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2016-05-26 09:17:59 -07:00
Keith Packard 743b6f231e glamor: Disable logic ops when doing compositing [v4]
If the logic op gets left enabled, it overrides the blending
operation, causing incorrect contents on the display.

v2: Disable only on non-ES2, but disable even for PictOpSrc

v3: Found another place this is needed in
    glamor_composite_set_shader_blend

v4: Remove change dependent on new glamor_set_composite_texture
    API. This belongs in a different patch.
    Found by Emil Velikov <emil.l.velikov@gmail.com>

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-05-26 09:17:59 -07:00
Michel Dänzer a3e681eafa glamor: Source pictures are always depth 32
We were using the destination pixmap depth to determine the source
picture format.

Fixes incorrect text rendering with some MATE desktop GTK3 themes.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94246
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2016-03-08 15:17:19 -05:00
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
Eric Anholt 5c440817f7 glamor: Use ARRAY_SIZE in a couple more places for consistency.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:06:36 -07:00
Eric Anholt 7b6edb5243 glamor: Mark a bunch of single-file data static.
This gives the compiler a chance to optimize when the data is never
changed -- for example, with pict_format_combine_tab, the compiler
ends up inlining the 24 bytes of data into just 10 more bytes of code.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:06:36 -07: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
Maarten Lankhorst b66501b4fd glamor: do not check for gl errors in glamor_build_program
According to Eric Anholt the check for glGetError is not needed here.
Because a opengl error might be set before this function is called
keeping the check could result in glamor_build_program returning
failure when building the shader succeeded.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:01:38 -07:00
Keith Packard bd3b2c48f6 glamor: Add accelerated stipple support
This copies the stipple to a 8bpp pixmap and uses that to paint the
texture from.

v2: Create deep stipple pixmap without GLAMOR_CREATE_FBO_NO_FBO

v3: Fix stipple origin sign (matches tiles now). Track changes
    to original stipple with damage. This isn't required by the
    X spec, but java appears to depend on it, so we'll just do it.
    When Glamor switches to 8bpp bitmaps, we'll be able to render
    directly from them and not need this anymore.

v4: Review comments from Eric:

    * Remove stray whitespace change
    * Avoid "large" pixmap for stipple by using GLAMOR_CREATE_NO_LARGE
    * Wrap to 80 columns

v5: Don't crash when stipple damage tracker is destroyed

    The stipple damage tracker is automatically destroyed when the
    associated stipple pixmap is destroyed. When this happens, just
    clear the pointer from the GC rather than calling
    glamor_invalidate_stipple; that function would call
    DamageUnregister on the now invalid stipple damage pointer and
    crash.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-06-15 23:17:56 +01: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 693e6bea89 glamor: Use plain GLSL 1.20 features for fill code.
This prevents performance regressions from losing acceleration support
on older hardware as we transition to using glamor_program.c for
acceleration.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-03 13:07:51 -07:00
Keith Packard 5b76b3978d glamor: Compute supported GLSL version and save in screen private
This currently computes the GLSL version in a fairly naïve fashion,
and leaves that in the screen private for other users. This will let
us update the version computation in one place later on.

v2: Drop an accidental rebase-squashed hunk (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-04-03 13:07:51 -07: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