i965: Clarify nomenclature: vert_result -> varying

This patch removes the terminology "vert_result" from the i965 driver,
replacing it with "varying".  The old terminology, "vert_result", was
confusing because (a) it referred to the enum gl_vert_result, which no
longer exists (it was replaced with gl_varying_slot), and (b) it
implied a vertex output, but with the advent of geometry shaders, it
could be either a vertex or a geometry output, depending what shaders
are in use.  The generic term "varying" is less confusing.

No functional change.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: Whitespace fixes.
i965: Rename BRW_VARYING_SLOT_MAX -> BRW_VARYING_SLOT_COUNT.

The new name clarifies that it represents *one more* than the maximum
possible brw_varying_slot value.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965/gen7: Use WE_all mode when enabling channel masks for URB write.

Gen7 adds mask bits to the message header for a URB write which allow
the write to apply only to certain channels.  We don't use this
functionality, so to ensure that the entire write always occurs, we
emit an OR instruction to set the mask bits.

With the advent of geometry shaders, URB writes won't just happen at
the end of a thread; they will happen in mid-thread too.  Thus, we can
no longer rely on channel 0 being enabled, so we need to emit the OR
instruction in WE_all mode to ensure that it is executed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Move brw_vs_prog_data::outputs_written into VUE map.

Future patches will allow for there to be separate VUE maps when both
a geometry shader and a vertex shader are in use.  When this happens,
we will want to have correspondingly separate outputs_written
bitfields.  Moving outputs_written into the VUE map will make this
easy.

For consistency with the terminology used in the VUE map, the bitfield
is renamed to "slots_valid" in the process.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Store the geometry output VUE map in brw_context.

Currently, the GPU pipeline has one active VUE map in effect at any
given time--the one representing the layout of vertex data coming from
the vertex shader.  However, when geometry shaders are added, they
will have their own independent VUE map.  Later pipeline stages (clip,
sf, fs) will need to consult the geometry shader VUE map if a geometry
shader is in use, and the vertex shader VUE map otherwise.

This patch adds a new field to brw_context, vue_map_geom_out, which
contains the VUE map that should be used by later pipeline stages.  It
also adds a new state flag, BRW_NEW_VUE_MAP_GEOM_OUT, which is
signalled whenever the contents of the VUE map changes.

Since we don't support geometry shaders yet, vue_map_geom_out is
currently set only by the brw_vs_prog state atom.

v2: Don't set vue_map_geom_out in do_vs_prog--that's redundant and
possibly problematic for precompiles.  Only set it in
brw_upload_vs_prog.  Also, make a copy instead of using a
pointer--this makes it possible to detect when the VUE map hasn't
changed, so we can avoid redundant state uploads.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Use brw.vue_map_geom_out instead of VS output VUE map where appropriate.

This patch modifies post-GS pipeline stages (transform feedback, clip,
sf, fs) to refer to the VUE map through brw->vue_map_geom_out rather
than brw->vs.prog_data->vue_map.  This ensures that when geometry
shader support is added, these pipeline stages will consult the
geometry shader output VUE map when appropriate, rather than the
vertex shader output VUE map.

v2: Fixed some stale "CACHE_NEW_VS_PROG" comments.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965/fs: Rename vp_outputs_written to input_slots_valid.

With the introduction of geometry shaders, fragment inputs will no
longer come exclusively from the vertex shader; sometimes they come
from the geometry shader.  So the name "vp_outputs_written" will
become a misnomer.  This patch renames vp_outputs_written to
input_slots_valid, to reflect the true meaning of the bitfield from
the fragment shader's point of view: it indicates which of the
possible input slots contain valid data that was written by the
previous shader stage.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Shrink brw_vue_map struct.

This patch changes the arrays in brw_vue_map (which only ever contain
values from -1 to 58) from ints to signed chars.  This reduces the
size of the struct from 488 bytes to 136 bytes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: fix STATIC_ASSERT to use 127 instead of 128.

Reviewed-by: Eric Anholt <eric@anholt.net>
llvmpipe: Fix assertions with assignment instead of comparison.

Fixes assign instead of compare defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
gallivm: move code for dealing with rgb9e5 and r11g11b10 formats to own file

This is really not generic conversion stuff and the code very particular to
these formats.
mesa: Disable validate_ir_tree() on release builds.

Since half of ir_validate uses asserts() (the other using printf() then
abort()), there's not much use to calling it in a release build.  Cuts
6.3% of the startup time of TF2.

NOTE: This is a candidate for the stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
android: fix Android.mk bug in mesa/drivers/dri/common

target-specific variables are undefined when used as pre-requisites.
instead, use secondary-expansion.

I noticed this when building the patch:
     i965: Add a driconf option to disable flush throttling

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
freedreno: track maximal scissor bounds

Optimize out parts of the render target that are scissored out by taking
into account maximal scissor bounds in fd_gmem_render_tiles().

This is a big win on things like gnome-shell which frequently do partial
screen updates.

Signed-off-by: Rob Clark <robdclark@gmail.com>
freedreno: prefer sw upload for textures

Since we are UMA, in most cases the GPU blit doesn't make much sense for
texture upload.

Signed-off-by: Rob Clark <robdclark@gmail.com>
swrast: init vars to silence warnings

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
gallivm: init vars to silence warnings

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
gallium: undef PACKAGE_* macros to silence warnings

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
glsl ir: add as_dereference_record

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
freedreno: use u_debug for debug env vars

Signed-off-by: Rob Clark <robdclark@gmail.com>
r600g: Use virtual address for PIPE_QUERY_SO* in r600_emit_query_end

Virtual address is used for PIPE_QUERY_SO* queries in
r600_emit_query_begin, but not in r600_emit_query_end.

This will trigger a GPU fault when one of those queries is
made and virtual address is enabled.

Note: this is a candidate for the 9.1 branch

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>