Commit Graph

25 Commits

Author SHA1 Message Date
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
2e75d974bc glamor: Remove unneeded unbindings.
They are already cleared in glamor_put_vbo_space.

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
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
708fe0625f glamor: Use glsl "fract/mod" instead of "while" in gradient shaders.
This fixes gtkperf. It seemed to hang forever.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-03-26 12:58:39 -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
Alan Coopersmith
6227f07b69 Remove duplicate assignment of repeat_type_uniform_location
Flagged by cppcheck 1.64:
[glamor/glamor_gradient.c:987] -> [glamor/glamor_gradient.c:991]:
    (performance) Variable 'repeat_type_uniform_location' is
             reassigned a value before the old one has been used.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
2014-03-17 14:30:57 -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
25be6b3842 glamor: Fix a mismatched glamor_get/put_context().
We don't call GL in this function any more, so we can just drop the
get.

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
80cdbb20f9 glamor: Fix linking of the gradient shaders on GLES2.
GLES2 sensibly doesn't allow you to attach multiple shaders for the
same stage to a single program.  This means we have to attach the
whole thing in one glShaderSource call.

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
76bd0f9949 glamor: Don't bother keeping references to shader stages for gradients.
They never get reattached to any other program, so saving them to
unreference later is a waste of code.

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
6e62cdf66d glamor: Fix typo in setting v_position's attrib location.
Assuming it was the first attribute assigned by the GL, it would have
ended up with location 0 anyway.

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
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
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
Zhigang Gong
ace35e408c glamor_largepixmap: first commit for large pixmap.
This is the first commit to add support for large pixmap.
The large here means a pixmap is larger than the texutre's
size limitation thus can't fit into one single texutre.

The previous implementation will simply fallback to use a
in memory pixmap to contain the large pixmap which is
very slow in practice.

The basic idea here is to use an array of texture to hold
the large pixmap. And when we need to get a specific area
of the pixmap, we just need to compute/clip the correct
region and find the corresponding fbo.

We need to implement some auxiliary routines to clip every
rendering operations into small pieces which can fit into
one texture.

The complex part is the transformation/repeat/repeatReflect
and repeat pad and their comination. We will support all of
them step by step.

This commit just add some necessary data structure to represent
the large pixmap, and doesn't change any rendering process.
This commit doesn't add real large pixmap support.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:51 -08:00
Junyan He
4c174f4c9c Fix the problem of x_source and y_source causing radial error
The x_source and y_source cause some problem in
 gradient. The old way to handle it by recaulate P1 P2
 to minus the x_source and y_source, but this causes
 problem in radial shader. Now we modify the manner to
 set the texture coordinates: (x_source, y_source) -->
 (x_source + width, y_source + height) to handle all the
 cases.

Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:51 -08:00
Junyan He
553910d08b Fix the problem of vertical and horizontal case error in linear gradient.
1. The vertical and horizontal judgement in linear
 gradient have problem when p1 point and p2 point
 distance is very small but the gradient pict have a
 transform matrix which will convert the X Y coordinates
 to small values. So the judgement is not suitable.
 Because this judgement's purpose is to assure the
 divisor not to be zero, so we simply it to enter
 horizontal judgement when p1 and p2's Y is same.
 Vertical case is deleted. 2. Delete the unused p1 p2
 uniform variable.

Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:51 -08:00
Junyan He
41aa93c393 Fix the problem of set the same stop several times.
Some gradient set the stops at the same position, for
 example: firstly 0.5 to red color and then set 0.5 to
 blue. This kind of setting will cause the shader work
 not correctly because the percentage caculating need to
 use the stop[i] - stop[i-1] as dividend. The previous
 patch we just kill some stop if the distance between
 them is 0. But this cause the problem that the color
 for next stop is wrong. We now modify to handle it in
 the shader to avoid the 0 as dividend.

Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:51 -08:00
Junyan He
09de37ec1c Fix a bugy macro definition.
The macro like "#define LINEAR_SMALL_STOPS 6 + 2" causes
 the problem. When use it to define like "GLfloat
 stop_colors_st[LINEAR_SMALL_STOPS*4];" The array is
 small than what we supposed it to be. Cause memory
 corruption problem and cause the bug of render wrong
 result. Fix it.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:51 -08:00
Junyan He
d900f553c2 Extract the gradient related code out.
1. Extract the logic of gradient from the glamor_render.c
 to the file glamor_gradient.c.
 2. Modify the logic of gradient pixmap gl draw. Use the
 logic like composite before, but the gradient always just
 have one rect to render, so no need to set the VB and EB,
 replace it with just call glDrawArrays. 3.Kill all the
 warning in glamor_render.c

Reviewed-by: Zhigang Gong<zhigang.gong@linux.intel.com>

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:51 -08:00