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>
mesa: fix depth/stencil comments in formats.h
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>
glsl: Optimize lrp(0, y, a) into y * a.

Helps two programs in shader-db:

instructions in affected programs:     254 -> 234 (-7.87%)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Optimize lrp(x, 0, a) into x - (x * a).

Helps one program in shader-db:

instructions in affected programs:     96 -> 92 (-4.17%)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Add is_horizontal() method to ir_expression.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
glsl: Don't vectorize horizontal expressions.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75224
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>
configure: avoid constantly building megadrivers 'core'

The issue is caused by a thinko that an empty string will be
considered of zero length by 'test'. This is not the case,
thus we were building the 'core' of megadrivers even when no
classic drivers were built.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
configure: avoid setting variables as empty strings

Recent patch converted our logic to use test -n and test -z.
An emptry string variable (empty_str="") return true for both
thus making the check unreliable.

Fix this by correctly setting the variable when applicable.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
configure: error out when building xa only with swrast

Building to provide accelration using swrast does not make
sense.

Note: update your build script to explicitly mention svga
in the gallium drivers list, if you are building the vmwgfx
xa library.

v2: Update error message to provide more clarify, add an example.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
configure: enable the drm pipe-loader for non swrast drivers

All hardware drivers including the virtual vmwgfx require
the drm pipe-loader in order to be properly loaded by xa,
gbm and opencl.

Note this does _not_ add support for the above three it only
allows the pipe driver to be loaded by the library.

Eg. GBM will now properly open the pipe-i915 driver, should
one be working on the such hardware.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75453
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
configure: use enable_dri_glx local variable

GLX can be either dri or xlib based, while enable_dri is
used in a variety of contexts.

With enable_dri_glx the context is clearly visible.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
gbm: export gbm_device_is_format_supported

Probably depending on compiler settings, the definition can be hidden,
so undefined reference error can be encountred during linking.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75528
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
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>
i965: Assert array index on access to vec4_visitor's arrays.

v2: vec4_visitor::pack_uniform_registers(): Use correct comparison in the
  assert, this->uniforms is already adjusted. Compare the actual value used to
  index uniform_size and uniform_vector_size instead.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
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>
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>
r300g/tests: Added missing fclose for FILE resource.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
gbm/dri: Fixed buffer object memory leak in case of failure.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>