winsys/svga: Avoid calling drm getparam for max surface size on older kernels

This avoids the kernel driver spewing out errors about the param not being
supported.

Also correct the max surface size used when the kernel does not support the
query.

Reported-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f5e681f3fae6b95b76bb068b367f5f96c58073c8)
mesa: do depth/stencil format conversion in glGetTexImage

glGetTexImage(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8) was just
using memcpy() instead of _mesa_unpack_uint_24_8_depth_stencil_row()
to convert texels from the hardware format to the GL format.

Fixes issue reported by David Meng at Intel.  The new piglit
ext_packed_depth_stencil-getteximage test checks for this bug.

Also, add some format/type assertions.  We don't yet handle the
GL_FLOAT_32_UNSIGNED_INT_24_8_REV type.  That should be fixed in
a follow-on patch.

Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 43dee0295e5da42425f1a3b6a3b3108173f4b676)
glsl: Add is_horizontal() method to ir_expression.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5eff8576ba274858a0b242ead97b8b5fc2b4f8ff)
glsl: Don't vectorize horizontal expressions.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75224
(cherry picked from commit 4bd7f1d044eee17587d6523322303a61aeb8d660)
r600g/compute: PIPE_CAP_COMPUTE should be false for pre-evergreen GPUs

This prevents clover from using unsupported devices.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

CC: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f61e382f0afc48bc09f21c50639f760acca85bc5)
i965: Allocate vec4_visitor's uniform_size and uniform_vector_size arrays dynamically.

v2: Don't add function parameters, pass the required size in
prog_data->nr_params.

v3:
- Use the name uniform_array_size instead of uniform_param_count.
- Round up when dividing param_count by 4.
- Use MAX2() instead of taking the maximum by hand.
- Don't crash if prog_data passed to vec4_visitor constructor is NULL

v4: Rebase for current master

v5 (idr): Trivial whitespace change.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71254
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 7189fce237cc7f4bc76a85cca8bcf75756d9affc)
i915: Only allow 8 vertex texture units

There's no reason to have more vertex texture units than fragment
texture units on this hardware.  Since increasing the default maximum
number of texture units from 16 to 32, this has triggered some segfault
in i915 driver.  There's probably some array or bitfield that isn't
properly sized now.  This really papers over the bug, but I don't think
I'll lose any sleep over that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74071
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 8ba157006fe98bca96b79bea1394b0c33ddf4ad3)
i915: Allocate the sys_buffer using _mesa_align_malloc

Though it won't matter on Linux, use _mesa_align_free to release it.
Since i965 doesn't have sys_buffer, I overlooked this in the
GL_ARB_map_buffer_alignment work a few months ago.  Fixes i915 (and
presumably i830) regressions in ARB_map_buffer_range tests and the
failure in arb_map_buffer_alignment-sanity_test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74960
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit ff2cbf9e0ca0ee46a15add1a42cd48705c84e0de)