Commit Graph

37 Commits

Author SHA1 Message Date
Keith Packard 90d326fcc6 glamor: Remove _nf rendering functions
These were used by the non-standard glamor implementation in the intel
driver.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:01:39 -07:00
Keith Packard 7e6bd54684 glamor: Remove shader-based trapezoid implementation. Fixes Bug 76213.
I can't find any performance benefit to using the GL path and the code
renders this trapezoid incorrectly:

  		                 top: FIXED   29.50
		              bottom: FIXED   30.00
		            left top: POINT    0.00,   29.50
		         left bottom: POINT    0.00,   30.50
		           right top: POINT -127.50,   29.50
		        right bottom: POINT   52.50,   30.00

This should render a solid line from 0,30 to 52,30 but draws nothing.

The code also uses an area computation for trapezoid coverage which
does not conform to the Render specification which requires a specific
point sampling technique.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-09-18 15:53:39 -07:00
Eric Anholt e310387f44 glamor: Remove always-true yInverted flag.
All users of glamor had the same value set, and it complicated things
for no reason.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-07-17 17:35:38 -07:00
Eric Anholt d71ecbb458 glamor: Drop constant arguments to glamor_solid().
After keithp's change to drop the old glamor_fill() code, nothing ever
changed these values.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-07-17 17:34:29 -07:00
Keith Packard 18c09e60bf glamor: Replace glamor_solid_boxes and glamor_solid with GC using code
This provides glamor_solid_boxes and glamor_solid using regular GC
operations instead of calling directly to underlying rendering
functions. This will allow the old rendering code to be removed.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-06-15 23:17:58 +01:00
Eric Anholt fab0a4a4c9 glamor: Replace glamor_get/put_context() with just glamor_make_current().
Now that we have the DIX global state for the current context, we
don't need to track nesting to try to reduce MakeCurrent overhead.

v2: Fix a mistaken replacement of a put_context with make_current in
    glamor_fill_spans_gl() (caught by keithp).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1)
Reviewed-by: Adam Jackson <ajax@redhat.com> (v1)
2014-04-23 10:32:23 -07:00
Markus Wick 7c4e147296 glamor: Always keep GL_ELEMENT_ARRAY_BUFFER bound to the same IB.
We never used glDrawElements() with a different index buffer.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-03-26 12:58:40 -07:00
Markus Wick 9999a66013 glamor: don't reset the GLSL program
We don't use fixed function rendering, so there is no need to reset
the program at all.  This lets the driver avoid checking for state
changes between draw calls when we rebind the same program.

Improves xephyr x11perf -f8text performance by 6.03062% +/- 1.64928%
(n=20)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-03-17 14:30:58 -07:00
Eric Anholt 1a4b249939 glamor: Apply debug labels to our shaders.
This will help tools like fips, apitrace, or INTEL_DEBUG=shader_time
provide useful information about the shaders in use.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus@selfnet.de>
2014-03-17 14:30:57 -07:00
Eric Anholt d310d566b1 glamor: Extract the streamed vertex data code used by Render.
We should be uploading any vertex data using this kind of upload
style, since it saves a bunch of extra copies of our vertex data.

v2:
  - Add a simple comment about what the function does.
  - Use get_vbo_space()'s return in trapezoids, instead of dereffing
    glamor_priv->vb (by Markus Wick).
  - Fix the double-unmapping by moving put_vbo_space() outside of
    flush_composite_rects().
  - Remove the rest of the composite_vbo_offset usage, and just always
    use get_vbo_space()'s return value.
v3:
  - Fix failure to put_vbo_space in traps when no prims were
    generated.
  - Unbind the VBO from put_vbo_space().  Keeps callers from
    forgetting to do so.
v4:
  - Split out some changes into the previous 3 commits while trying to
    track down a regression.
  - Fix regression due to rebase fail where glamor_priv->vbo_offset
    wasn't incremented.
v5:
  - Fix GLES2 VBO sizing.
  - Add a comment about resize behavior.
  - Move glamor_vbo.c init code to glamor_vbo.c from
    glamor_render.c. (Derived from Markus's changes, but the GLES2 fix
    dropped almost all of the code in the functions).
v6:
  - Drop the initial BufferData on GLES2 (it happens at put() time).
  - Don't forget to set vbo_offset to the size on GLES2.
  - Use char * instead of void * in the cast to return the vbo_offset.
  - Resize the default FBO to 512kb, to be similar to previous
    behavior.  +1.66124% +/- 0.284223% (n=679) on aa10text.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus at selfnet.de>
2014-03-10 13:57:21 -07:00
Eric Anholt ffc8423077 glamor: Track the next vertex offset as we go for AA traps.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus at selfnet.de>
2014-03-10 13:57:21 -07:00
Eric Anholt ca307fd18d glamor: Track the next vertex offset as we go for non-AA traps.
v2: Use sizeof(float) instead of 4.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus at selfnet.de>
2014-03-10 13:57:21 -07:00
Eric Anholt 438d8aceec glamor: Move glamor_emit_composite_vert() to traps, where it's used.
It's only used in the nonantialiased, triangle-based trapezoids path.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus at selfnet.de>
2014-03-10 13:57:21 -07:00
Eric Anholt 9553020b71 glamor: Drop a bunch of GLES2 ifdefs.
Now that we're using epoxy, we can write code using both desktop and
ES symbols and decide what to use at runtime.

v2: Fix a spelling mistake (latter), since the lines were moved
    anyway (noticed by Rémi Cardona).  Fix condition invert in
    glamor_set_composite_texture (caught by Michel Dänzer).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com> (v1)
Reviewed-by: Adam Jackson <ajax@redhat.com> (v1)
2014-02-14 18:30:01 -08:00
Eric Anholt 62965d278c glamor: Drop useless glEnable/glDisable(GL_TEXTURE_2D) calls.
Those calls are only for enabling texture handling in the fixed
function pipeline, while everything we do is with shaders.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-02-14 18:30:01 -08:00
Eric Anholt 781c692cf9 glamor: Rename glamor_get/put_dispatch to glamor_get/put_context.
It used to be the thing that returned your dispatch table and happeend
to set up the context, but now it just sets up the context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-02-14 18:29:56 -08:00
Eric Anholt 0373b3f4f7 glamor: Convert to using libepoxy.
Libepoxy hides all the GL versus GLES2 dispatch handling for us, with
higher performance.

v2: Squash in the later patch to drop the later of two repeated
    glamor_get_dispatch()es instead (caught by keithp)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-02-14 18:28:56 -08:00
Eric Anholt 7f6e865359 glamor: Fix some indent damage of putting a ' ' after the '*' for pointers.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-01-27 09:30:47 -08:00
Eric Anholt 5f57d436c3 glamor: Fix some mangling of shader strings by indent.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-01-27 09:30:47 -08:00
Eric Anholt d84d71029a glamor: Apply x-indent.sh.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-01-27 09:30:47 -08:00
Grigori Goronzy 8afa008ec4 Use glDrawRangeElements instead of glDrawElements
This lets us explicitly specify the range of vertices that are used,
which the OpenGL driver can use for optimization. Particularly,
it results in lower CPU overhead with Mesa-based drivers.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:54 -08:00
Michel Dänzer 39e95cd0f5 Reset traps_count and ptrap when necessary for the next trapezoid cliprect
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64912
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: He Junyan <junyan.he@inbox.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:54 -08:00
Zhigang Gong b8f0a21882 Silence compilation warnings.
After increase to gcc4.7, it reports more warnings, now
fix them.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Junyan He<junyan.he@linux.intel.com>
2013-12-18 11:23:53 -08:00
Junyan He c3096c5a56 Fallback to pixman when trapezoid mask is big.
The trapezoid generating speed of the shader is relatively
 slower when the trapezoid area is big. We fallback when
 the trapezoid's width and height is bigger enough.
 The big traps number will also slow down the render because
 of the VBO size. We fallback if ntrap > 256

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Reviewed-By: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:53 -08:00
Zhigang Gong e7af7cb76d glamor_trapezoid: workaround a glsl like problem.
It seems that the following statement cann't run as expected on SNB.
bool trap_left_vertical = (abs(trap_left_vertical_f - 1.0) <= 0.0001);

Have to rewrite it to another style to let the vertical edge trapezoid
to be rendered correctly.

Reviewed-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:53 -08:00
Junyan He 5512c14e34 Fix the problem of VBO leak.
In some cases we allocate the VBO but have no vertex to
 emit, which cause the VBO fail to be released. Fix it.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:53 -08:00
Junyan He 9f78e22fa6 Just use the shader to generate trapezoid if PolyMode == Imprecise
The precise mode of trapezoid rendering need to sample the trapezoid on
 the centre points of an (2*n+1)x(2*n-1) subpixel grid. It is computationally
 expensive in shader, and we use inside area ratio to replace it.
 The result has some difference, and we just use it if the polymode == Imprecise.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:53 -08:00
Junyan He fe024a7822 Change the trapezoid render to use VBO.
Because some uniform variables need to be set for every
 trapezoid rendering, we can not use vbo to render multi
 trapezoids one time, which have performance big loss.
 We now add attributes which contain the same value to bypass
 the uniform variable problem. The uniform value for one
 trapezoid will be set to the same value to all the vertex
 of that trapezoid as an attribute, then in FS, it is still
 a constant.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:53 -08:00
Zhigang Gong 37d4022f01 glamor_render: Optimize the two pass ca rendering.
For the componentAlpha with PictOpOver, we use two pass
rendering to implement it. Previous implementation call
two times the glamor_composite_... independently which is
very inefficient. Now we change the control flow, and do
the two pass internally and avoid duplicate works.

For the x11perf -rgb10text, this optimization can get about
30% improvement.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:52 -08:00
Junyan He 2122e60bf9 Fix a bug for trapezoid clip
We find in some cases the trapezoid will be render as a triangle and
 the left edge and right edge will cross with each other just bellow
 the top or over the bottom. The distance between the cross poind and
 the top or bottom is less than pixman_fixed_1_minus_e, so after the
 fixed converted to int, the cross point has the same value with the
 top or botton and the triangle should not be affected. But in our
 clip logic, the cross point will be clipped out. So add a logic
 to fix this problem.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:52 -08:00
Zhigang Gong b4a499b7db trapezoid: Fallback to sw-rasterize for largepixmap.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:52 -08:00
Junyan He 8f31aed48c Use the direct render path for A1
Because when mask depth is 1, there is no Anti-Alias at all,
 in this case, the directly render can work well and it is faseter.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:52 -08:00
Junyan He fa74a213ad Add the trapezoid direct render logic
We firstly get the render area by clipping the trapezoid
 with the clip rect, then split the clipped area into small
 triangles and use the composite logic to generate the result
 directly. This manner is fast but have the problem that
 some implementation of GL do not implement the Anti-Alias
 of triangles fill, so the edge sometimes has sawtooth. It is
 not acceptable when use trapezoid to approximate circles and
 wide lines.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:52 -08:00
Junyan He 5f1560c84a Modilfy the composite logic to two phases
We seperate the composite to two phases, firstly to
 select the shader according to source type and logic
 op, setting the right parameters. Then we emit the
 vertex array to generate the dest result.
 The reason why we do this is that the shader may be
 used to composite no only rect, trapezoid and triangle
 render function can also use it to render triangles and
 polygens. The old function glamor_composite_with_shader
 do the whole two phases work and can not match the
 new request.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:52 -08:00
Junyan He 0b0391765f Add macro of vertex setting for triangle stripe
Add macro of vertex setting for triangle stripe draw,
  and make the code clear.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:52 -08:00
RobinHe bd180be619 Use shader to generate the temp trapezoid mask
The old manner of trapezoid render uses pixman to
 generate a mask pixmap and upload it to the GPU.
 This effect the performance. We now use shader to
 generate the temp trapezoid mask to avoid the
 uploading of this pixmap.
 We implement a anti-alias manner in the shader
 according to pixman, which will caculate the area
 inside the trapezoid dividing total area for every
 pixel and assign it to the alpha value of that pixel.
 The pixman use a int-to-fix manner to approximate but
 the shader use float, so the result may have some
 difference.
 Because the array in the shader has optimization problem,
 we need to emit the vertex of every trapezoid every
 time, which will effect the performance a lot. Need to
 improve it.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:52 -08:00
RobinHe 6dd81c5939 Create the file glamor_triangles.c
Create the file glamor_trapezoid.c, extract the logic
 relating to trapezoid from glamor_render.c to this file.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
2013-12-18 11:23:52 -08:00