glamor: Revert a context related change. It caused a compilation error since context switcher related changes have not been pulled into this tree. This reverts commit 73ab7f4.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Use buffer_storage

29.5361% +/- 2.74092% improvement in x11perf -aa10text (n=489).

Pulled from Eric's xserver glamor tree.

v2: Fix fallback, return correct buffer offset, map whole buffer,
unmap conditionally.
v3: add conditional defines to make it compile with outdated headers.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
vbo: Raise VBO size

This reduces CPU overhead due to buffer orphaning, which results in
a small overall performance improvement.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor: Fix accelerated rendering of GTK's ARGB vs xBGR composites.

There is some complicated code to support tweaking the format as we
upload from a SHM pixmap (aka the GTK icon cache), but if we weren't
sourcing from a SHM pixmap we just forgot to check that the formats
matched at all.

We could potentially be a little more discerning here (xRGB source and
ARGB mask would be fine, for example), but this will all change with
texture views anyway, so just get the rendering working for 1.16
release.

Fixes the new rendercheck gtk_argb_xbgr test.

v2: Squash in keithp's fix for checking that we have a non-NULL
    pixmap, and reword the comment even more.

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

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
xv: workaround corruption

Keeping the video pixmaps persistent sometimes will lead to video
corruption (shifted chroma planes) for unknown reasons. Possibly
there are some subtle pixmap handling bugs in xv or other parts of
the glamor code. To workaround, simply destroy pixmaps after they
have been used once.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72821

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
glamor_xv: add missing include

glamor_xv.c uses DamageDamageRegion but does not include xorg/damage.h. This
causes the build to fail if 9b8217f9ef6279fff6628631d18497bed0343ef9 is not
present in the X server.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75466
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=499442

Signed-off-by: Chí-Thanh Christopher Nguyễn <chithanh at gentoo.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>