radeonsi: Fix up and enable flat shading.

Requires corresponding LLVM R600 backend fix to work correctly, but even
without that it doesn't hang anymore.

13 more little piglits.

Depends on LLVM: r175193, r175733

NOTE: This is a candidate for the 9.1 branch.
radeonsi: Fix w component of TGSI_SEMANTIC_POSITION fragment shader inputs.

It's the reciprocal of the register value.

Fixes piglit fragcoord_w and glsl-fs-fragcoord-zw-perspective.

NOTE: This is a candidate for the 9.1 branch.
radeonsi: Don't match TGSI_SEMANTIC_POSITION fs inputs to vs outputs
docs: import release notes for 9.0.3, add news item
r600g: don't enable ReZ mode on evergreen

Can cause lockups in certain cases when
zfunc/zenable/zwrite change without a flush
in between.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=60969
and lockups on Civ4 with wine.

This is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
i965: Avoid segfault in gen6_upload_state

This fixes a bug introduced in commit 258453716f001eab1288d99765213 and
triggered whenever "rb" is NULL.

Fixes at least one cause bug #59445:

	[SNB/IVB/HSW Bisected]Oglc draw-buffers2(advanced.blending.none) segfault
	https://bugs.freedesktop.org/show_bug.cgi?id=59445

(Though segfaults are still possible in that test case, but they have been
present since before commit 258453716f which is what's being fixed here.)

Reviewed-by: Eric Anholt <eric@anholt.net>
r300g/compiler: Add missing license headers

These are all files that I authored, but forgot to add the license
headers.

NOTE: This is a candidate for the stable branches.

Signed-off-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
r300g/compiler: Fix typo in comment

Reviewed-by: Marek Olšák <maraeo@gmail.com>
r300g/complier: Make r300_vertprog_swizzle_caps visible in other files

This will be used by the test suite in later commits.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
r300g/tests: Exit test runner with a valid status code

This way make check can report whether or not the tests pass.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
r300g/tests: Add helper functions for creating a full program

Now you can convert assembly strings into a full struct radeon_compiler
object and use it to test individual compiler pases.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
r300g/compiler: Fix bug in OMOD folding

The OMOD value was only being folded to one instruction in cases where
the MUL instruction was reading a value written by more than one
instruction.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
draw: make sure key size is calculated consistently.

Some parts calculated key size by using shader information, others by using
the pipe_vertex_element information. Since it is perfectly valid to have more
vertex_elements set than the vertex shader is using those may not be the same,
so we weren't copying over all vertex_element state - this caused the tgsi dump
to assert (iterates over all vertex elements). More importantly in this
situation it would also break vertex texturing completely (since the sampler
state derived from the key is at a different position than expected).
Fix thix by deriving key->nr_vertex_elements from the shader information
instead of the pipe_vertex_element state (unlike dx10, we can't have "holes"
in pipe_vertex_element state, so this should be safe).
(Note that actual llvm shader generation does not use the pipe_vertex_element
state from the key itself in any case (althogh I guess it could) but uses
the one from draw.pt (which should be the same though contains all elements)
instead.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
gallium/docs: improve text about resources a bit.

This clarifies some things and gets rid of some old stuff.
The most significant one is probably that buffers cannot have formats
(nearly all drivers completely ignored format and used width0 as byte size
already in any case). There seems to be no use case for "structured" buffers.
(Note while d3d11 has new Structured Buffers, these still aren't associated
with a format, rather a byte stride, which we can't do yet either way.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
llvmpipe: simplify buffer allocation logic.

Now with buffer formats clarification don't need all that logic any longer.
(Note that it never would have worked in any case, because blockwidth and
blockheight were swapped any allocation with multi-byte format would have
had zero size.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
r600g: Fix memory leak in r600_shader_select.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reported-by: Michel Dänzer <michel@daenzer.net>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
trace: Fix set_constant_buffer dumping.

We were dumping the trace driver pointer, instead of the pointer from the
underlying pipe driver.
trace: Never close stdout/stderr.

This could happen, when a trace screen was destroyed and then recreated.
llvmpipe: Fix rendering into PIPE_FORMAT_X8*_UNORM.

Mesa state tracker recently started using PIPE_FORMAT_X8B8G8R8_UNORM,
causing segfaults in texture-packed-formats, because swizze[chan] was
0xff for padding channel (X).

Signed-off-by: José Fonseca <jfonseca@vmware.com>
targets/xa-vmwgfx: Force c++ linker to fix undefined symbols

NOTE: This is a candidate for the 9.1 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61200
Reviewed-by: Matt Turner <mattst88@gmail.com>