register_allocate: Fix the type of best_benefit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Remove the BRW_NEW_INPUT_DIMENSIONS flag.

When I removed the proj_attrib_mask optimization, I also removed the
last consumer of this bit without realizing it.

Since nobody uses it, there's no point in flagging it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
i965: Remove brw->vb.info and struct brw_vertex_info.

Nobody uses this value, so there's no need to set it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
i965: Remove a few BRW_STATE_... enum values.

These were likely used for BRW_NEW_... dirty bit flags at one point, but
they're unused now.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
intel: Require kernel 2.6.39 for relaxed relocation support.

Chris Wilson's relaxed relocation patch landed in March 2011.  Anyone
running pre-3.0 kernels probably isn't going to get the latest Mesa
anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
intel: Remove check for kernel 2.6.29.

Now that we require 2.6.39, there's no need to also check for 2.6.29.
Calling drm_intel_bufmgr_gem_enable_fenced_relocs() without checking
should be safe, as it simply sets a flag.

This does remove the check for zero fences available, but that doesn't
seem worth checking.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
intel: Add support for writing to our linear-temporary-CPU-map case.

This will be used for handling updates of large textures.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>.
intel: Do temporary CPU maps of textures that are too big to GTT map.

This still fails, since 8192*4bpp == 32768, which is too big to use the
blitter on.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
intel: Avoid making tiled miptrees we won't be able to blit.

Doing so was breaking miptree mapping, which we really need to be able to
handle.  With this change, intel_miptree_map_direct() falls through to
doing a CPU mapping on the buffer like we need.

With the previous 2 patches, all of these should be fixed:
piglit max-texture-size (all 3 patches required!)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37871
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44958
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53494

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Make check_build_array_max_size externally visible

A future commit will try to use this function in a different file.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Refactor handling of ast_array_index to a separate function

I love 800+ line switch-statements as much as the next guy... Future
commits will make changes to this part of the AST-to-HIR conversion, and
extracting this code will make that a bit easier.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Remove some unnecessary uses of error_emitted

The error_emitted flag is used in semantic checking to prevent spurious
cascading errors.  For example,

void foo(sampler2D s, float a)
{
    float x = a + (1.2 + s);

    ...
}

should only generate a single error.  Without the error_emitted flag for
the first error, "a + ..." would also generate an error.

However, a bunch of cases in _mesa_ast_array_index_to_hir that were
setting error_emitted would mask legitimate errors.  For example,

    vec4 a[7];
    float b = a[3.14];

should generate two error (float index and type mismatch in assignment).
The uses of error_emitted would cause only the first to be emitted.

This patch removes most of the places in _mesa_ast_array_index_to_hir
that would set the error_emitted flag.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Don't return a value from check_builtin_array_max_size

That last consumer of the return value was changed to not use it by the
previous commit.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Minor code compaction in _mesa_ast_array_index_to_hir

Also, document the reason for not checking for type->is_array in some of
the bound-checking cases.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Collect all of the non-constant index error checks together

This puts all of the checks togeher for easier reading.  It also means
that all the checks are blocked on array->type->is_array.  Shortly this
will allow elimination of some is_error check work-arounds in this
function.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Don't emit spurious errors for constant indexes of the wrong type

Previously the shader

uniform float x[6];
void main() { gl_Position.x = x[1.0]; }

would have generated the errors

0:2(33): error: array index must be integer type
0:2(36): error: array index must be < 6

Now only

0:2(33): error: array index must be integer type

will be generated.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Don't early-out for error-type inputs

Check the type of the array operand and the index operand before doing
other checks.  This simplifies the code a bit now (eliminating the
error_emitted parameter), and enables some later functional changes.

The shader

uniform float x[6];
uniform sampler2D s;
void main() { gl_Position.x = xx[s + 1]; }

still generates (only) the two expected errors:

0:3(33): error: `xx' undeclared
0:3(39): error: Operands to arithmetic operators must be numeric

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
st/mesa: fix levels in initial texture creation

calim pointed out we were getting mipmap levels for array multisamples,
this didn't make sense. So then I noticed this function takes last_level
so we are passing in a too high value here.

I think this should fix the case he was seeing.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
intel: Allocate hiz in intel_renderbuffer_move_to_temp()

When moving the renderbuffer to a new miptree, we neglected to allocate
the hiz buffer for the new miptree. Oops.

Fixes all Piglit depthstencil-render-miplevels tests from crash to pass on
Sandybridge.

Note: This is a candidate for the 9.1 branch.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
intel: Refactor selection of miptree tiling

This patch (1) extracts from intel_miptree_create() the spaghetti logic
that selects the tiling format, (2) rewrites that spaghetti into a lucid
form, and (3) moves it to a new function, intel_miptree_choose_tiling().
No behavioral change.

As a bonus, it is now evident that the force_y_tiling parameter to
intel_miptree_create() does not really force Y tiling.

v2 (Ken): Rebase on top of Eric's untiled-for-larger-than-aperture
changes.  This required passing in the miptree.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>