glsl: fix several use-after-free bugs

The get_variable_being_redeclared() function can free the 'var' argument.
Thereafter, we cannot assume that 'var' is a valid  pointer.  This patch
replaces 'var->name' with 'earlier->name' in two places and calls
is_gl_identifier(var->name) before 'var' might get freed.

This fixes several piglit GLSL crashes, including:
spec/glsl-1.50/execution/geometry/clip-distance-in-param
spec/glsl-1.50/execution/geometry/clip-distance-bulk-copy
spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-before-global-redeclaration.geom

I'm not sure why these were not spotted sooner.
A similar bug was previously fixed by f9cecca7a.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
tgsi/ureg: add ureg_UARL shortcut (v2)

v2: moved in in same order as in p_shader_tokens (thanks Brian)
winsys/sw/wrapper: hook up is_displaytarget_format_supported

Gallium Nine make use of it, because we wrapping around sw screen.
gallium/auxiliary: implement sw_probe_wrapped

This is useful for resource sharing.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
gallium/draw: support hack to disable clipping (v2)

v2: drop ifdef change, which may be send later in separate commit
gallium/auxiliary: Prefer intrinsics to handrolled atomic ops for Linux (v2)

v2: prefer intrinsics only on Linux to avoid compilation problems
    on other platforms [1].

We need this patch, because Gallium Nine use directly intrinsics.
Otherwise build fails.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=30514

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
configure: add configurable pipe-driver location

This option gives better flexibility when using gallium pipe drivers.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
gallium/auxiliary: add inc and dec alternative with return

They're useful for Gallium Nine.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
gallium/auxiliary: add contained and rect checks (v3)

v2: thanks to Bruno Jimenez, fixed for() in u_box_clip_3d
v3: thanks to Brian, improved coding style, changed to enum

For D3D9 is very important have handled intersections and covers.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
gallium/auxiliary: add dump functions for bind and transfer flags

v2: rename and add support for MSVC (thanks to Brian)

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
nine: Add state tracker nine for Direct3D9

Work of Joakim Sindholt (zhasha) and Christoph Bumiller (chrisbmr).
DRI3 port done by Axel Davy (mannerov).

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
nine: Add drirc options (v2)

Implements vblank_mode and throttling, which  allows us change default ratio
between framerate and input lag.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
nine: Implement threadpool

DRI_PRIME setups have different issues due the lack of dma-buf fences
support in the drivers. For DRI3 DRI_PRIME, a race can appear, making
tearings visible, or worse showing older content than expected. Until
dma-buf fences are well supported (and by all drivers), an alternative
is to send the buffers to the server only when rendering has finished.
Since waiting the rendering has finished in the main thread has a
performance impact, this patch uses an additional thread to offload the
wait and the sending of the buffers to the server.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
ilo: Advertise DMA-BUF
nvc0: define numbers, make code better readable

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
mesa/gallium: API settings / rasterization rules

D3D9 has different system coordinate, add neccessary infrastructure for it.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
nvc0: use API settings / rasterization rules

Implement D3D9 infrastructure inside NVC0.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
nv50,nvc0: handle TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION

Allow viewport bypass used by D3D9 applications.
nv50,nvc0: handle NULL vertex elements without fallback

This makes Gallium Nine faster.
nv50/ir/tgsi: implement TGSI_OPCODE_NRM,DP2A

Used by d3d9 st.