xcb: Fix SHM in _get_image()

Commit 2283ab9 introduced a logic error. Instead of falling back to the non-SHM
path when getting the image via SHM failed, we now did the fallback when getting
the image via SHM worked (which means that the SHM operation was a waste of
time).

Signed-off-by: Uli Schlachter <psychon@znc.in>
gl: Remove an unused variable
gl: Add a non-thread-aware mode for GL devices

GLX and EGL devices are thread-aware currently. This
is safe, but on certain GPUs can be very expensive. In
this patch, we expose a new API which turns off the
safety feature in cases where performance is a priority.
gl: Intelligently release the context

Regain the previous GL context when releasing a device. If the
current context hasn't changed, do nothing. This should serve
to make Cairo more transparent to external GL calls and avoid
some unnecessary context switches.
gl/msaa: Prevent stroke overlap

When stroking we do not send our polygon to the tessellator, so
it may have overlapping stroke components. Use the stencil buffer
to prevent stroke components from overlapping.
gl/msaa: Support for texture sources

Add support for texture sources, by unforking _cairo_gl_composite_begin.
_cairo_gl_composite_begin_tristrip is now just a small wrapper. Also
properly emit the source texture coordinates when emitting tristrip
vertices.
gl/msaa: Support for masking

Add support for masking in the OpenGL MSAA compositor. This is
accomplished simply by properly setting up the masking source,
emitting the entire bounded composite region, and unforking
vertex emission.
gl/msaa: Add support for unbounded operators

When filling and stroking with an unbounded operator, first fill
and stroke to a temporary surface and then paint the entire surface
back to the original target.
gl/msaa: Add ARB multisampling support

This implementation is not very efficient at the moment and does not
work with platforms using the incompatible IMG extension (mobile
GPUs).  Performance improvements and mobile GPU support will follow.
gl/msaa: Implement paint via masking

Instead of falling back to the spans compositor, let the msaa
compositor handle painting. This ensure clipping is handled
in a consistent way with the rest of the msaa compositor.
gl/msaa: Use unsigned short to build the index array

Some GPUs have trouble accepting vertex index data as
integers. Using unsigned shorts expands support.
gl: Add support for the IMG npot extension.
gl/msaa: Support the OpenGLES EXT multisampling extension

Add support for OpenGLES GPUs that support the EXT multisampling
extension.
gl/msaa: Support for non-texture surfaces

Add full support for non-texture surfaces, by correctly
querying primitives for stencil and multisample bits.
gl/msaa: Wait to clip until compositing begins

The MSAA compositors clips in a unique way We'd like to
share this method with the text rendering path, so we move
it to cairo-gl-composite so that it works in a way very
similar to clipping with the spans and traps compositors.
gl/msaa: Implement glyph rendering

Instead of falling back to the traps compositor to do glyph
rendering, handle it in the MSAA compositor. This allows using
the stencil buffer or scissor to clip and simplifies the MSAA
code path.
gl/msaa: Lazily flush the context

Instead of conservatively flushing after every single drawing
operation. Wait until we are certain we need to flush, which
in the case of the MSAA compositor is when we start compositing
with a different type of geometry.
gl/msaa: Add full support masking with the SOURCE operator
gl/msaa: Share the depth/stencil buffer among all surfaces

Instead of allocating a depth/stencil buffer for all surfaces, share
a common buffer that's the size of the largest surface. This should
reduce memory size when there are many surfaces of the same size.
gl/msaa: Avoid make current to previous context always.

Instead of make current to previous context, we do the following
1. when thread_aware is TRUE
    1. When mesa extension is present, we do not make current when
    release
    2. When mesa extension is not there, we make current to None
2. when thread_aware is FALSE we do not make current to None

At the end of a cairo drawing operation, the GL context is either
JNone or the current cairo GL context, application should makecurrent
to its own context before doing any GL work