Add GS_OPCODE_THREAD_END

TODO:
- Verify that I'm returning the correct value from implied_mrf_writes() for this new opcode.
Add GS_OPCODE_SET_WRITE_OFFSET
Add GS_OPCODE_SET_VERTEX_COUNT
WIP: add GS visitors
Make some files safe to include from C
i965: Make prim_to_hw_prim accessible outside brw_draw.c.

We will need access to this array in order to configure the geometry
shader.
i965/gs(gen7.5): Set max_gs_threads correctly
WIP: make the state atom for compiling Gen7 geometry shaders.  TODO: maybe disentangle
!UPSTREAM: i965: Fix some vec4 gs key setup

TODO:
- Test thoroughly
- Squash
!UPSTREAM: Generalize some error messages for GS.

TODO: find more places to generalize.
TODO: Don't use "VS/GS" terminology.  Use "vec4" terminology, since that will endure longer.
i965/gs(gen7): Allocate URB space for use by geometry shader
!UPSTREAM: i965/gs(gen7): Allocate push constant space
i965/vs: generalize push const upload in preparation for GS
i965/gs: set up GS state
!UPSTREAM: turn on GS

TODO:
- Commit message
!UPSTREAM: write out cut bits

Stuff that needs fixing:
- Not yet configuring 3DSTATE_GS to indicate that cut bits are present
- Not handling >31 output vertices correctly
- Probably should pack vertex_count and cut_bits into a single register
- Code should be conditioned on whether the shader uses EndPrimitive()
- At end of thread, shouldn't do the write if vertex_count is a multiple of 32
- At end of thread, should write to the appropriate DWORD
- At EmitVertex time, should write cut bits if vertex_counter%32 == 31
!UPSTREAM: vbo: Update vbo_count_tessellated_primitives for new primitive types.

TODO: test.
!UPSTREAM: i965: Add new primitive types.

TODO: test.
!UPSTREAM: Debug optimization passes
!UPSTREAM: Hack: avoid rounding errors in computation of atan

TODO:

- Rather than clamp the argument to asin to [-1, 1], it would be far
  better to use the formula:

    atan(x) = pi/2 - atan(1/x)

  when x > 1

  (and similar when x < -1).

  But I want to write better tests first.