glamor: Fix a spelling mistake in GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE.

Pulled from Eric's xserver glamor.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Drop fixed function transformation matrix setup.

gl_ModelViewProjection and friends aren't used in our shaders, so this
setup didn't do anything.

Pulled from Eric's xserver glamor port.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
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.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: yInverted is a boolean value, so use the Bool type.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Pass pixmaps around to unifdef glamor_iformat_for_depth().

Pulled from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Unifdef the cache format indices.

We only ask for GL_RGB on desktop GL as far as I can see, but now if
GLES2 did happen to ask for GL_RGB it would return a cache index
instead of -1.

Pulled from Eric's glamor xserver tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Move glamor_get_tex_format_type_from_pictformat to a .c file.

A pair of 150 lines of inlined switch statements in a header file is
crazy.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Unifdef the picture-format-to-format-and-type functions.

There's no way these should be in a header file, but I'll leave that
cleanup until later.

Ported from Eric's glamor xserver tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
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.

Ported from Eric's glamor xserver tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
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.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Don't forget to set GL_INVALIDATE_RANGE_BIT on GL_ARB_mbr.

We don't need any current contents of the buffer, and this allows an
implementation to make a temporary BO for a streamed upload if it
wants to.

Ported from Eric's glamor xserver tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Avoid generating GL errors when doing two-pass CA.

We were double-unmapping the VBO, and the second would throw an error.

Ported from Eric's glamor xserver tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Drop bogus _X_UNLIKELY.

nbox > 4 is actually quite common for spans handling.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Fix some integer overflow errors.

Imagine a nbox that was (UINT_MAX + small number) / 4 * 2 *
sizeof(float). We'd malloc a few bytes after the integer overflow,
but glamor_set_normalize_vcoords would write over gigabytes of heap.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Rename a variable to be more descriptive.

The "valid_" prefix was used above to describe our allocation that
gets reused multiple times, which is totally unrelated.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Rename more solid fill variables to clean up the code.

Now the error path of allocation is more obvious: We leave things in
the a-few-boxes-at-a-time stack memory state.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Fix up doxygen for glamor_fill.c.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Extract the streamed vertex data code used by Render. (v2)

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.

Ported from Eric's glamor xserver tree.

v2: fix composite_vbo_offset init in trapezoid rendering

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Replace some goofy enum-likes with a real enum.

This unpacks the bitfield into an int size, but my experience has been
that packing bitfields doesn't matter for performance.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Drop unused GLAMOR_ACCESS_WO.

Nothing was using it, and it was going to complicate the
glamor_prepare_access bugfixing I'm going to do next.

Ported from Eric's xserver glamor tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>