r600g: Add GL 3.3 support for 10.1 release

All patches on master below, except max samplers
which was removed on master.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>

commit 57c6bb18822ebf88a98b98714c846608ff3ba42b
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu Feb 6 00:48:57 2014 +0000

    bump max samplers

commit 2e4bd244493bebd41edf725a2c3c4e793282a5bb
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu Jan 30 04:19:57 2014 +0000

    r600g: add support for geom shaders to r600/r700 chipsets (v2)

    This is my first attempt at enabling r600/r700 geometry shaders,
    the basic tests pass on both my rv770 and my rv635,

    It requires this kernel patch:
    http://www.spinics.net/lists/dri-devel/msg52745.html

    v2: address Alex comments.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 0ed4f769d77c4db2259befba5fc1707f1cb5cb98
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Jan 29 21:48:09 2014 +0000

    r600g: enable GLSL 3.30 on evergreen GPUs

    This throws the switch to enable GL 3.3 and GLSL 330.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit aeca8f21dd42b9ecd3932ef028fa8846036c1307
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Feb 4 10:48:42 2014 +1000

    r600g: properly propogate clip dist write value

    This moves the value from the GS shader to the copy shader so the registers
    are setup correctly.

    fixes tests/spec/glsl-1.50/execution/geometry/clip-distance-out-values.shader_test

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit e1bc410fe670bb17078a55876f1700a504127fef
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Feb 3 15:31:26 2014 +1000

    r600g: calculate a better value for array_size (v2)

    attempt to calculate a better value for array size to avoid breaking apps.

    v2: use 0xfff like streamout, suggested by Grigori

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 6f2f117dec51eb51c1b09e86e829e176a98e3bfc
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Jan 31 03:35:51 2014 +0000

    r600g: fix CAYMAN geometry shader support

    cayman has a different end of program bit, so do that properly.

    fixes hangs with geom shader tests on cayman.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 305ea22fd517f83406aba3e3930d710fd42a3049
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Jan 29 00:17:15 2014 +0000

    r600g: fix up shader out misc stuff for copy shader

    set the correct values so the misc out register is setup correctly
    for the copy shader.

    This also updates the state for the gs copy shader so the hw
    gets programmed correctly.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 53630e14c8791a84798a03d74653bf46bd013fc7
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Jan 28 23:15:29 2014 +0000

    r600g: port the layered surface rendering patch from radeonsi

    This just makes r600 and evergreen do what the radeonsi codepaths do
    for layered rendering. This makes the 2d amd_vertex_shader_layer test
    pass on evergreen.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit aa4cd3b9bed1ea23468fba4aa5c428153e8cddc1
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Jan 28 13:04:00 2014 +1000

    r600g: initial VS output layer support

    This just adds support for emitting the proper value in the VS out misc.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 75a93f2e1e0f4d6015cdf63570ec4d3d12478b8d
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Jan 28 12:06:49 2014 +1000

    r600g: setup const texture buffers for geom shaders

    This just enables the workarounds we have for vertex/pixel shaders
    for geom shaders as well.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 88697a860635aae54e56dce2d6a839a06dea0c5a
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Jan 24 17:14:26 2014 +1000

    r600g: calculate correct cut value

    This selects the cut value depending on the shader selected.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit dfb88bef3e13112a838773e700c35052774f8a63
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Jan 24 14:46:37 2014 +1000

    r600g: fix dynamic_input_array_index.shader_test

    This follows what fglrx does, it unpacks the input we are
    going to indirect into a bunch of registers and indirects
    inside them.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit a3c6373f8cf3aab750399654a4b77150ec30bce9
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Jan 24 13:39:36 2014 +1000

    r600g: add support for indirect geom ring writes

    We need to be able to write to the ring using a base register
    for when we emit vertices in a loop, in theory the SB compiler
    could collapse these indirect writes to direct writes if the
    register value is constant and known, but that is outside my
    pay grade.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit dbc6a13adf935b118eaa6b396593f50d7b7e16e6
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Dec 24 05:59:19 2013 +0000

    r600g: write proper output prim type

    Vadim's code derived it from the info.mode, but it needs
    to be takes from the geometry shader output primitive.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit f7f51b0b775f652967e2b972cf7c183482a771be
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Dec 24 05:30:37 2013 +0000

    r600g: enable instance cnt register with new enough kernel

    The instance cnt register was missing for a few kernels,
    with a new enough kernel we can output it.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 9e6ce37f66372018ec5398f74c3b43ff5f5bf309
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Dec 23 01:30:03 2013 +0000

    r600g: add primitive input support for gs

    only enable prim id if gs uses it

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit fa932dfc7df3cf9ff63d08fb0e1db2119fc2ac93
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu Dec 19 05:17:00 2013 +0000

    r600g: emit streamout from dma copy shader

    This enables streamout with GS in the mix, from the
    VS dma shader.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 205defb542ac185b7f46508fd51a4077a4702107
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Dec 18 15:55:07 2013 +1000

    r600g/gs: fix cases where number of gs inputs != number of gs outputs

    this fixes a bunch of the geom shader built-in tests

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit d9e7ab40bc45644194c86f842599c76d0675243c
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Jan 28 10:21:03 2014 +1000

    r600g: increase array base for exported parameters

    Trivial fix to Vadim's code.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 82d67fbd3b96b6b2cc0124a19b6f31b7912ec152
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Jan 24 16:41:32 2014 +1000

    r600g: initialise the geom shader loop registers.

    As we do for vertex and pixel shaders.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 78be55d98d290d708bd1b3df3ef6cd5fa89865c7
Author: Dave Airlie <airlied@redhat.com>
Date:   Sat Nov 30 06:26:13 2013 +0000

    r600g: emit NOPs at end of shaders in more cases

    If the shader has no CF clauses at all emit an nop
    If the last instruction is an ENDLOOP add a NOP for the LOOP to go to
    if the last instruction is CALL_FS add a NOP

    These fix a bunch of hangs in the geometry shader tests.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 634b2498dc73efa3cca5a6fc3ed35c5bea6bb2e9
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu Nov 28 23:38:35 2013 +0000

    r600g: don't enable SB for geom shaders

    SB needs fixes for three GS instructions it seems to raise
    them outside loops etc despite my best efforts.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 5b61dd0e917e54625ac227b8b1c2c82955f51ab1
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Dec 24 04:56:25 2013 +0000

    r600g/sb: add MEM_RING support

    Although we don't use SB on geom shaders, the VS copy shader will use it
    so we might as well implement MEM_RING support in sb.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 0247375aec4681c154ae4d14b8cd637e7a9e0e3e
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Jan 29 04:08:43 2014 +0000

    r600g: don't fail if we can't map VS->GS ring entries

    This can happen in normal operation, so don't report an error on it,
    just continue.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 2c986600fac6cb5692e9e377cb04f9f50389172c
Author: Vadim Girlin <vadimgirlin@gmail.com>
Date:   Fri Aug 2 06:38:23 2013 +0400

    r600g: initial support for geometry shaders on evergreen (v2)

    This is Vadim's initial work with a few regression fixes squashed in.

    v2: (airlied)
    fix regression in glsl-max-varyings - need to use vs and ps_dirty
    fix regression in shader exports from rebasing.
    whitespace fixing.
    v2.1: squash fix assert

    Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit ce23c43e2b611f30964afe4d1c02c4d0361ba430
Author: Vadim Girlin <vadimgirlin@gmail.com>
Date:   Fri Aug 2 06:32:32 2013 +0400

    r600g: add hw register definitions for GS block setup

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit b0ec79c28d6373930ca0dc19168dd504204456b5
Author: Vadim Girlin <vadimgirlin@gmail.com>
Date:   Wed Jul 31 23:09:39 2013 +0400

    r600g: defer shader variant selection and depending state updates

    [airlied: fix dropped streamout line - fix for master]

    Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit e41cbfb4d15d519f9301699f39d7dd0153f2edf4
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Jan 13 10:19:00 2014 +1000

    r600g/bc: add support for indexed memory writes.

    It looks like we need these for geom shaders in the future.

    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 46efb1648e883b2cb231cca38c1540e7e9ec1ecc
Author: Vadim Girlin <vadimgirlin@gmail.com>
Date:   Wed Jul 31 20:02:22 2013 +0400

    r600g: move barrier and end_of_program bits from output to cf struct (v2)

    v2: fix regression on r600 NOP instructions.

    Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 42802d5d8d145f07cf3fca1bb6e8ab0cd1fd5c85
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Jan 29 01:33:14 2014 +0000

    r600g: split streamout emit code into a separate function

    For geometry shaders we need to call this code from a second place.

    Just move it out for now to keep future patches cleaner.

    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
docs: update 10.1 relnotes to note GL 3.3 on r600 and radeonsi.

Signed-off-by: Dave Airlie <airlied@redhat.com>