autotools: Add missing top-level include dir.

Fixes autotools build failure.  Not sure if there are more, as I have
difficulties in building the full tree.
(cherry picked from commit 7bff1cc3f635dc80f3ccb218af847513c53a51b5)
mesa,gallium,egl,mapi: One definition of C99 inline/__func__ to rule them all.

This is a squash-commit of the two commits listed below.  The first
introduced a 'make check' failure, and the second fixed it.

    mesa,gallium,egl,mapi: One definition of C99 inline/__func__ to rule them all.

    We were in four already...

    NOTE: Candidate for the stable branches.

    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit 70fe7c6d3e1c7534f6598c4616bebf672f42668b)

And:

    tests: Add $(top_srcdir)/include to AM_CPPFLAGS.

    Fixes this build error with make check.

      CC     collision.o
    In file included from ../../../../../src/mesa/main/hash_table.h:34:0,
                     from collision.c:31:
    ../../../../../src/mesa/main/compiler.h:51:53: fatal error: c99_compat.h: No such file or directory

    Signed-off-by: Vinson Lee <vlee@freedesktop.org>
    (cherry picked from commit a6bb7a94957468453c436e3860ee2dd47575c461)
mesa: Add previously picked commit to .cherry-ignore

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
include: Fix build with VS 11 (i.e, 2012).

NOTE: Candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 57cd1d1454653f778837eec0ee5d4060bc59c5ba)
mesa: Fix FB blitting in case of zero size src or dst rect

Framebuffer blitting operation should be skipped if any of the
dimensions (width/height) of src/dst rect is zero.

V2: Move the dimension check after error checking in _mesa_BlitFramebuffer.

Fixes: fbblit(negative.nullblit.zeroSize) in Intel oglconform
https://bugs.freedesktop.org/show_bug.cgi?id=59495

Note: Candidate for all the stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
(cherry picked from commit d78dcdf103271c539ff246651236e71f7a9c10fd)
i965: Add definitions for gen7+ data cache messages.

We were sparsely using some of these message types, but I'll just fill
them all in now.  It will be used for fixing shader_time on HSW.

v2: Add missing MEDIA_BLOCK_READ.

NOTE: This is a candidate for the 9.1 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit a2d08f170ab0d4ac7ba8d4c74db3a410f6cafa19)
i965: Fix INTEL_DEBUG=shader_time for Haswell.

Haswell's "Data Cache" data port is a single unit, but split into two
SFIDs to allow for more message types without adding more bits in the
message descriptor.

Untyped Atomic Operations are now message 0010 in the second data cache
data port, rather than 6 in the first.

v2: Use the #defines from the previous commit. (by anholt)

NOTE: This is a candidate for the 9.1 branch.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net> (v1)
(cherry picked from commit f27a220cadd1326e6293a2c3fb945b7765a85da4)
i965: Specialize SURFACE_STATE creation for shader time.

This is basically a copy and paste of gen7_create_constant_surface, but
with the parameters filled in to offer a simpler interface.

It will diverge shortly.

I didn't bother adding it to the vtable for now since shader time is only
exposed on Gen7+.

v2: Replace tabs in the new code (by anholt)
    Add back dropped memset() and add a comment about HSW channel selects.

NOTE: This is a candidate for the 9.1 branch.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 125b34cffbd377a3b27967b37767692796542250)
i965: Make INTEL_DEBUG=shader_time use the RAW surface format.

Untyped Atomic Operation messages are illegal for non-RAW formats.  The
IVB hardware proceeds happily (after all, who cares what the format of the
surface is if you're doing untyped ops on it?), but later hardware
apparently doesn't.  The simulator for gen7 does complain, though.

v2: Rebase against updates to previous patches. (by anholt)

NOTE: This is a candidate for the 9.1 branch.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 91df4d746bd50b328b9f4b55126c95c046087a4d)
i965: Apply depthstencil alignment workaround when doing fast clears.

Fast depth clears have the same depth/stencil alignment requirements
as other drawing operations.  Therefore, we need to call
brw_workaround_depthstencil_alignment() from both the clear and
drawing paths.

Without this fix, we get image corruption if the following conditions
hold: (a) the first ever drawing operation to a depth miplevel (or the
first drawing operation after having used the texture for sampling) is
a clear, (b) the depth miplevel has a size that is eligible for fast
depth clears, and (c) the depth miplevel has an offset within the
miptree that isn't 8x8 aligned.

Fixes piglit "depthstencil-render-miplevels" tests with size 273.

NOTE: This is a candidate for stable branches

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit c5d5827951fb321a58cc781b4e386551035ebf1a)
gallium/build: Fix visibility CFLAGS in automake

v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Fix formatting - use one CFLAG per line

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59238
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
(cherry picked from commit f70c3853513637fa6ed38e75f73d472a9fa61213)
radeon/llvm: Link against libgallium.la to fix an undefined symbol

Ported from downstream:
http://anonscm.debian.org/gitweb/?p=pkg-xorg/lib/mesa.git;a=blob;f=debian/patches/119-libllvmradeon-link.patch;h=ee47f8a07dbf33c32f8b57faed923680ed6648fb;hb=refs/heads/ubuntu%2B1

Fixes a regression introduced with
f70c3853513637fa6ed38e75f73d472a9fa61213

NOTE: This is a candidate for the 9.1 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62434
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
(cherry picked from commit 36320bfa54b758b34df732250365b91ff1ab858c)
gallivm: fix return opcode handling in main function of a shader

If we're in some conditional or loop we must not return, or the code
after the condition is never executed.
(v2): And, we also can't just continue as nothing happened, since the
mask update code would later check if we actually have a mask, so we
need to remember that there was a return in main where we didn't exit
(to illustrate this, a ret in a if clause would cause a mask update
which is still ok as we're in a conditional, but after the endif the
mask update code would drop the mask hence bringing execution back to
pixels which should have their execution mask set to zero by the ret).
Thanks to Christoph Bumiller for figuring this out.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=62357.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 5af7b45986d1b56c568ebe9c3a40d48853e2e9ff)
mesa: use ieee fp on s390 and m68k

Taken from downstream:
http://anonscm.debian.org/gitweb/?p=pkg-xorg/lib/mesa.git;a=blob;f=debian/patches/02_use-ieee-fp-on-s390-and-m68k.patch;h=d3d6c1d7fec3c72ecf320706167deb61c52636c3;hb=refs/heads/ubuntu%2B1

Fixes Debian bug #349437.

Patch written by David Nusinow.

NOTE: This is a candidate for stable branches.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 7962f28c439948853dbdf2be04914e004a77c1d7)
build: Enable x86 assembler on Hurd.

Taken from downstream:
http://anonscm.debian.org/gitweb/?p=pkg-xorg/lib/mesa.git;a=blob;f=debian/patches/10-hurd-configure-tweaks.diff;h=984e17df1b8afdf8e4b36bee96aa5ab6a5691021;hb=refs/heads/ubuntu%2B1

Thanks to Pino Toscano.

v2: Don't bother with x86_64. AFAICT GNU/Hurd doesn't support it so far.

NOTE: This is a candidate for stable branches.

Acked-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Acked-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 06fff296e98b054fb54cfa32f72331f10f0bb629)
osmesa: fix out-of-tree build

Taken from downstream:
http://anonscm.debian.org/gitweb/?p=pkg-xorg/lib/mesa.git;a=blob;f=debian/patches/14-fix-osmesa-build.diff;h=00581d0e1833c5492d9050e1bf3d5e658cad782e;hb=refs/heads/ubuntu%2B1

v2: Move the added line immediately after -I$(top_srcdir)/src/mapi

NOTE: This is a candidate for the 9.1 and 9.0 branches.

Acked-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 92e6260c1960f78692417433206c38170ec1a625)
gallium/egl: fix out-of-tree build

Taken from downstream:
http://anonscm.debian.org/gitweb/?p=pkg-xorg/lib/mesa.git;a=blob;f=debian/patches/15-fix-oot-build.diff;h=7040999a22d3937d0578cfd85ee2c71d7dc614bb;hb=refs/heads/ubuntu%2B1

NOTE: This is a candidate for the 9.1 branch.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 182895c4e691e9e783278f1448772e855ade7b33)
radeon/llvm: Do not link against libgallium when building statically.

NOTE: This is a candidate for the 9.1 branch.

Tested-by: Vincent Lejeune <vljn@ovi.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
(cherry picked from commit 7c3d8301afed46cf932bf23431085de490a1f83a)
i965: Don't use texture swizzling to force alpha to 1.0 if unnecessary.

Commit 33599433c7 began setting the texture swizzle mode to XYZ1 for
RED, RG, and RGB textures in order to force alpha to 1.0 in case we
actually stored the texture as RGBA.

This had a unforseen performance implication: the shader precompile
assumes that the texture swizzle mode will be XYZW for non-shadow
sampler types.  By setting it to XYZ1, this means every shader used with
a RED, RG, or RGB texture has to be recompiled.  This is a very common
case.

Unfortunately, there's no way to improve the precompile, since RGBA
textures still need XYZW, and there's no way to know by looking at
the shader source what texture formats might be used.

However, we only need to smash alpha to 1.0 if the texture's memory
format actually has alpha bits.  If not, the sampler already returns 1.0
for us without any special swizzling.  XRGB8888, for example, is a very
common case where this occurs.

This partially fixes a performance regression since commit 33599433c7.
More work is required to fully fix it in all cases.  This at least helps
Warsow.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit d86efc075ed84a8c45bfb71cee56dcd18858f727)
radeonsi: Emit pixel shader state even when only the vertex shader changed

Fixes random failures with piglit glsl-max-varyings.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Christian König <christian.koenig@amd.com>
(cherry picked from commit 032e5548b3d4b5efa52359218725cb8e31b622ad)