Commit Graph

40 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Dave Airlie f0a5c0d1fd glamor: fix leak of fs_getcolor_source.
This is created using XNFstrdup, so it needs to be freed.

Pointed out by coverity.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2018-09-12 12:26:48 +10:00
Jeff Smith ff410c56bf glamor: tidy up some gradient color formulas
- Avoid some needlessly complex equations for calculating the color at a
  point in a gradient field.
- Avoid calculating certain values multiple times.
- Use similar variable names across the two versions of the get_color
  function where practical.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-29 16:18:31 -05:00
Jeff Smith 3bd17dff1a glamor: remove unused variables in linear gradient shader
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-29 16:18:28 -05:00
Jeff Smith 5815c7b595 glamor: fix no-reflect case for gradients
When compositing a no-reflect gradient, 'before' the gradient is empty,
but 'after' the gradient is padded with the final color.  Both sides are
supposed to be empty.

This is fixed by moving the virtual stops to match the first and last
client-supplied stops for no-reflect gradients, then causing everything
'before' the initial virtual stop and 'after' the final virtual stop to
emit rgba(0,0,0,0).  This does not impact gradients using the other
reflect modes.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-29 16:18:07 -05:00
Jeff Smith 3e377e238f glamor: fix repeat-reflect case in linear gradient shader
If _pt_distance is negative, it causes the final distance to be negative
in the repeat-reflect case.  Moving the scaling by _pt_distance earlier
avoids this problem, and simplifies some equations as a bonus.

Bugzilla: https://bugs.freedesktop.org/98508
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-29 16:18:04 -05:00
Adam Jackson 13409b91b1 glamor: Unconditionalize GLAMOR_GRADIENT_SHADER
Effectively always true anyway.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-10-30 13:16:30 -04:00
Eric Engestrom 128d40b2dd glamor: fix spelling mistakes
v2: Fix "orignal" too (review feedback by ajax, change by anholt)_

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-25 10:40:08 -07:00
Dave Airlie 5582ad1b9b glamor: use vbos in gradient/picture code.
This converts two client arrays users to using vbos,
this is necessary to move to using core profile later.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-01-21 06:47:35 +10:00
Eric Anholt c5e6fffbdd glamor: Drop CloseScreen-time GL resource cleanup code.
These will all be freed when the context is freed.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:35 -07:00
Alan Coopersmith f59236c286 Convert glamor & glx to new *allocarray functions
v2: fixup whitespace

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-04-21 16:58:08 -07:00
Eric Anholt 6ba6cc57e1 glamor: Just set the logic op to what we want at the start of all rendering.
By dropping the unconditional logic op disable at the end of
rendering, this fixes GL errors being thrown in GLES2 contexts (which
don't have logic ops).  On desktop, this also means a little less
overhead per draw call from taking one less trip through the
glEnable/glDisable switch statement of doom in Mesa.

The exchange here is that we end up taking a trip through it in the
XV, Render, and gradient-generation paths.  If the glEnable() is
actually costly, we should probably cache our logic op state in our
screen, since there's no way the GL could make that switch statement
as cheap as the caller caching it would be.

v2: Don't forget to set the logic op in Xephyr's drawing.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-03-24 12:43:34 -07:00
Keith Packard af687396f1 glamor: Remove screen private and pixmap ptrs from pixmap private and fbo
There's no reason to waste memory storing redundant copies of the same
pointer all over the system; just pass in pointers as necessary to
each function.

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:32:46 -07:00
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
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 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