intel: Use the parent miptree's format for setting up HiZ miptrees.

This worked out before because the parent was always 4 bytes so it
didn't affect the layout, but now we want to support Z16 too.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Start using HIZ for Z16 textures.

I had left this out for a long time because it regressed some
depthstencil-render-miplevels cases when it was enabled.  Now that the
bugs causing those are fixed, there's nothing stopping us.

Improves glbenchmark 2.1 offscreen performance by 7.3% +/- 2.8% (n=10).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Fix border color handling for deprecated SNORM formats.

We don't have native hardware support for these, so they get promoted to
RGBA, in which case we don't have hardware dealing with the channel
swizzling for us.

Fixes piglit EXT_texture_snorm/texwrap formats bordercolor (-swizzled).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
mesa: add missing texel fetch code for sRGB DXT formats

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=58548
i965: Add a note about a bug from the no-recompile-on-sampler-updates change.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Fix a typo in a comment.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Add texrect scale parameters before pointers to ParameterValues.

If adding scale parameters during program compile caused a realloc of
ParameterValues, then the driver uniform storage set up by
_mesa_associate_uniform_storage() would point to potentially freed
memory.

Note that this uses TexturesUsed, which may change at runtime for GLSL
when sampler uniforms change.  This is a flaw in our handling of texrect
in general, and not one I'm fixing currently.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Add asserts to check that we don't realloc ParameterValues.

Things are even more restrictive than they used to be, so I've made
mistakes in this area.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965/fs: Remove the param_index/param_offset indirection.

Now that ParameterValues doesn't change across the visitor, we don't
need to go through this.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Add a note about a surprising feature of gl_uniform_storage->type.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965/fs: Reference the core GL uniform storage for non-builtin uniforms.

There's no reason to use an external copy if the relayout in the
external copy isn't serving us.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965/vs: Reference the core GL uniform storage for non-builtin uniforms.

Like in the FS, there's no reason to use an external copy if the
ParameterValues[] relayout of it isn't the layout we need.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Consistently use nr_pull_params instead of NumParameters.

NumParameters used to be an upper bound on the number of vec4s to be
uploaded, which was basically safe (unless your buffer was bound near
the top of address space *and* you array indexed outside the buffer, in
which case I think you might GPU hang).  As I migrate the driver away
from ParameterValues[], this is no longer true.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Stop making a copy of non-builtin uniforms in ParameterValues[].

We don't need them now that our set of parameter pointers points at the
GL core storage for them.  This should save memory/bandwidth/overhead in
uniform updates.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
intel: Turn a test in miptree_match_image into an assert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
intel: Skip texture validation logic when nothing has changed.

Improves GLBenchmark 2.1 offscreen performance by 3.2% +/- 1.5% (n=52).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Fail to blit rather than assert on invalid pitch requirements.

Dungeon Defenders hits TexImage()'s try_pbo_upload() path where
image->Width == 2, which doesn't meet intelEmitCopyBlit's requirement
that the pitch needs to be a multiple of 4.

Since intelEmitCopyBlit can already fail for a myriad of other reasons,
and it's not clear that other callers are immune to this failure mode,
simply make it return false rather than assert.

Fixes Dungeon Defenders on i965/Ivybridge.  Now playable (aside from
having to work around the EXT_bindable_uniform issue).

NOTE: This is probably a candidate for the 9.0 branch.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
xlib: handle _mesa_initialize_visual()'s return value

If the call fails, we should return NULL from XMesaCreateVisual().
This was found when Waffle tried to create a visual with depth/stencil
bits = -1.  That's an illegal value for glXChooseFBConfig() and we should
return NULL in that situation.

Note: This is a candidate for the stable branches.
glsl: add cast to silence signed/unsigned comparision warning
mesa: fix signed/unsignd mix-up in fetch_signed_l_latc1()

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=58844