!UPSTREAM: i965/gs: Update defines related to GS surface organization.

Defines that previously referred to VS now refer to VEC4, since they
will be shared by the user-programmable vertex shader and geometry
shader stages.

Defines that previously referred to the Gen6 geometry shader stage
(which is only used for transform feedback) are now renamed to
explicitly refer to Gen6, to avoid confusion with the Gen7
user-programmable geometry shader stage.

Based on work by Eric Anholt <eric@anholt.net>.

TODO:
- Move before the patch that introduces brw_vec4_context_base.
i965: generalize brw_vs_pull_constants in preparation for GS.
i965/vs: generalize brw_vs_binding_table in preparation for GS.
i965/gs: Implement support for geometry shader surfaces.

This patch implements pull constant upload, binding table upload, and
surface setup for geometry shaders, by re-using vertex shader code
that was generalized in previous patches.

Based on work by Eric Anholt <eric@anholt.net>.
i965/gs: make the state atom for compiling Gen7 geometry shaders.

v2: Use "unsigned" rather than "GLuint".
i965/vs: generalize gen6_vs_push_constants in preparation for GS.
i965: Modify signature to update_texture_surface functions.

Previously these functions would accept a pointer to the binding table
and an index indicating which entry in the binding table should be
updated.  Now they merely take a pointer to the binding table entry to
be updated.

This will make it easier to generalize brw_texture_surfaces to support
geometry shaders.
i965/gs: generalize brw_texture_surfaces in preparation for gs.

There is a slight functionality change.  Previously we would compute a
common value for num_samplers for all stages, and populate that many
entries in each stage's surf_offset table regardless of how many
samplers each stage used.  Now we only populate the number of entries
in the surf_offset table corresponding to the number of samplers
actually used by the stage.
i965/gs: add geometry shader support to brw_texture_surfaces.
i965/gs: Implement support for geometry shader samplers.
i965/gen7: merge defines for 3DSTATE{VS,GS,WM} dword 2

Dword 2 of all 3DSTATE commands is the same, so there's no need tohave
separate defines for it.  This will allow us to unify some of the
state setup code between VS and GS.
i965/gen7: Generalize gen7_vs_state in preparation for GS.
i965/gs: Add a state atom to set up geometry shader state.
!UPSTREAM ===== END gs-phase-3 =====
glsl: During linking, record whether a GS uses EndPrimitive().

This information will be useful in the i965 back end.
i965/gs: Set control data header size/format appropriately for EndPrimitive().

The gen7 geometry shader uses a "control data header" portion of the
output URB entry to store either

(a) flag bits (1 bit/vertex) indicating whether EndPrimitive() was
    called after each vertex, or

(b) stream ID bits (2 bits/vertex) indicating which stream each vertex
    should be sent to (when multiple transform feedback streams are in
    use).

This patch modifies do_vec4_gs_prog() to determine the correct
hardware settings for configuring the control data header, and
modifies upload_gs_state() to propagate these settings to the
hardware.

In addition, it modifies do_vec4_gs_prog() to ensure that the output
URB entry is large enough to contain both the output vertices *and*
the control data header.
i965/gen7: Allow URB_WRITE channel masks to be used.

Previously, brw_urb_WRITE() would unconditionally override the channel
masks in the URB_WRITE message to 0xff (indicating that all channels
should be written to the URB).

For geometry shaders, we need the ability to set the channel masks
programatically, so create a flag to prevent brw_urb_WRITE() from
overriding them.
i965/gen7: Add the ability to send URB_WRITE_OWORD messages.

This will be used by geometry shaders to implement EndPrimitive()
functionality.
i965/gs: Add opcodes needed for EndPrimitive().
i965/vec4: Add the ability to emit opcodes with just a dst register.

This is needed for GS_OPCODE_PREPARE_CHANNEL_MASKS.