r600g/llvm: Add support for UBO

NOTE: This is a candidate for the Mesa stable branch.

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
r600g/llvm: Fix alpha_to_one piglit tests

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
r600g/llvm: Set Inputs/Outputs count to 32 (api reported value)

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
r600g/llvm: Support for TBO

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
radeonsi: properly implement S8Z24 depth-stencil format

Based on r600g commit 2b9659c9e627ad03160899b8be04f96307d098eb .

Fixes crashes with 4 piglit tests which are now hitting these formats.

NOTE: This is a candidate for the 9.1 branch.
radeonsi: Use stencil surface level information for stencil texturing

7 more little dwarves^W piglits.

NOTE: This is a candidate for the 9.1 branch.
radeonsi: Fix PIPE_FORMAT_X32_S8X24_UINT sampler hardware format

4 more little piglits.

NOTE: This is a candidate for the 9.1 branch.
st/mesa: factor out code for determining blit.mask from CopyTexSubImage

I'll need this later.

Reviewed-by: Brian Paul <brianp@vmware.com>
st/mesa: fix blit-based GetTexImage for depth/stencil formats

BTW, we have 0 tests for glGetTexImage(format=GL_DEPTH*).

Reviewed-by: Brian Paul <brianp@vmware.com>
st/mesa: fix blit-based GetTexImage for 1D array textures

This is not easy to hit, because we have 3 code paths now
(tried in this order):
- memcpy-based (skips the blit) -> _mesa_tex_getimage
- blit-based
- slow pixel packing -> _mesa_tex_getimage

The main difference later in the code is the parameters of
_mesa_image_address3d.

Reviewed-by: Brian Paul <brianp@vmware.com>
st/mesa: implement blit-based TexImage and TexSubImage

A temporary texture is created such that it matches the format and type
combination and pixels are copied to it using memcpy. Then the blit is used to
copy the temporary texture to the texture image being modified by TexImage or
TexSubImage. The blit takes care of the format and type conversion and
swizzling. The result is a very fast texture upload involving as little CPU
as possible.

This improves performance in apps which upload textures during rendering.
An example is the Wine OpenGL backend for DirectDraw, which I used to test
the game StarCraft. Profiling had shown that TexSubImage was taking 50% of
CPU time without this patch, which was the main motivation for this work, and
now TexSubImage only takes 14% of CPU time. I had to underclock my CPU to see
any difference in the game and this patch does make the game a lot faster
if the CPU is slow (or using the powersave cpufreq profile).

Reviewed-by: Brian Paul <brianp@vmware.com>
st/mesa: don't do sRGB conversion in CopyTexSubImage

Assuming I understand EXT_texture_sRGB correctly.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
st/mesa: simplify and improve CopyTexSubImage

It has become a bit messy.

Changes:

- finally correct checking for transfer ops depending on the base format

- making sure the base internal format and the texture format match
  (we were ignoring it, but it's important for correctness)

- the way-too-strict rule that both src and dst base formats must be the same
  was dropped; ensuring the simpler and more permissive rule mentioned above
  is enough

- stop using util_blit_pixels; pipe->blit is flexible enough, and now that we
  have RGBX and red-alpha formats, pipe->blit can be used for more cases

Reviewed-by: Brian Paul <brianp@vmware.com>
st/mesa: remove what is left from u_blit

Reviewed-by: Brian Paul <brianp@vmware.com>
draw: fix non-perspective interpolation in interp()

This fixes a regression from ab74fee5e1a3fc3323b7238278637b232c2d0d95.
When we use the clip coordinate to compute the screen-space interpolation
factor, we need to first apply the divide-by-W step to the clip
coordinate.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=60938

Note: This is a candidate for the 9.1 branch.
st/mesa: implement glBitmap unpacking from a PBO, for the cache path

We weren't mapping the PBO when using the bitmap cache (but we had
the PBO code for the non-cache path.)

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=61026

Note: This is a candidate for the stable branches.
glx: fix glGetTexLevelParameteriv for indirect rendering

A single element in a GLX reply is contained in the header itself.
The number of elements is denoted in the "n" field of the reply.
If "n" is 1, the length of additional data is 0.
The XXX_data_length() function of xcb does not return the length of
the (optional, n>1) data but the number of elements.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=59876

Note: This is a candidate for the stable branches.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
st/xlib: initialize the drawable size in create_xmesa_buffer()

Otherwise, the PBuffer's size was never set.  This also initializes
the buffer size for windows, pixmaps, etc.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=61012

Note: This is a candidate for the stable branches.
llvmpipe: fix handling of 0 x 0 framebuffer size

Bump up the size to 1 x 1.  This fixes a number of potential failure
points in the code.

See also http://bugs.freedesktop.org/show_bug.cgi?id=61012
i965: Remove unused userclip flags.

brw_vs_prog_data::userclip hasn't been used since commit f0cecd4
(i965: Move VUE map computation to once at VS compile time).

brw_gs_prog_key::userclip_active hasn't been used since commit 9f3d321
(i965: Make the userclip flag for the VUE map come from VS prog data).