winsys/radeon: remove cs_write_reloc, add simpler cs_get_reloc

The only difference is that it doesn't write to the CS and only returns
the index.

Reviewed-by: Christian König <christian.koenig@amd.com>
r600g: remove redundant r600_flush_from_winsys

Reviewed-by: Christian König <christian.koenig@amd.com>
radeonsi: cleanup redundant computation of flush flags and rename a function

Reviewed-by: Christian König <christian.koenig@amd.com>
winsys/radeon: fold cs_set_flush_callback into cs_create

Reviewed-by: Christian König <christian.koenig@amd.com>
r600g: remove redundant r600_flush_dma_from_winsys

Reviewed-by: Christian König <christian.koenig@amd.com>
gallium/radeon: create and return a fence in the flush function

All flush functions get a fence parameter. cs_create_fence is removed.

Reviewed-by: Christian König <christian.koenig@amd.com>
radeonsi: merge si_flush with si_context_flush

This also removes si_flush_gfx_ring.

Reviewed-by: Christian König <christian.koenig@amd.com>
r600g: merge r600_flush with r600_context_flush

Reviewed-by: Christian König <christian.koenig@amd.com>
r600g,radeonsi: share r600_flush_from_st

Reviewed-by: Christian König <christian.koenig@amd.com>
r600g,radeonsi: share some of gfx flush code

Reviewed-by: Christian König <christian.koenig@amd.com>
Revert "scons: Enable building through Clang Static Analyzer."

This reverts commit a45a50a4828e1357e9555474bc127c5585b3a420.

Unfortunately gcc dumps argv[0] as the first word of --version, so it is
unreliable for detecting gcc.

In particular `cc --version` and `i686-w64-mingw32-gcc --version` give
wrong results.

A better solution needs to be found -- most likely using C-preprocessing
like autotools does.  Revert for now.
gallivm: fix compilation with llvm 3.5 r206241+

Just adjust to the ever-changing API, pass in MCContext when creating the
MCDisassembler.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
r600g: Disable LLVM by default at runtime for graphics

For graphics, the LLVM compiler backend currently has many shortcomings
compared to the non-LLVM one. E.g. it can't handle geometry shaders yet,
but that's just the tip of the iceberg.

So building Mesa with --enable-r600-llvm-compiler is currently not
recommended for anyone who doesn't want to work on fixing those issues.
However, for protection of users who end up enabling it anyway for some
reason, let's disable the LLVM backend at runtime by default. It can be
enabled with the environment variable R600_DEBUG=llvm.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
glsl: Fix copy-paste error in linker_warning()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
mesa: Fix glGetVertexAttribi(GL_VERTEX_ATTRIB_ARRAY_SIZE)

mesa currently returns 4 when GL_VERTEX_ATTRIB_ARRAY_SIZE is queried
for a vertex array initially set up with size=GL_BGRA. This patch
makes changes to return size=GL_BGRA as required by the spec.

Fixes Khronos OpenGL CTS test: vertex_array_bgra_basic.test

V2: Use array->Format instead of adding a new variable

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
mesa: Add helper function _mesa_is_format_integer()

This function will be used in the following patch.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
mesa: Add error condition for integer formats in glGetTexImage()

OpenGL 4.0 spec, page 306 suggests an INVALID_OPERATION in glGetTexImage
if :
   "format is one of the integer formats in table 3.3 and the internal
    format of the texture image is not integer, or format is not one of
    the integer formats in table 3.3 and the internal format is integer."

V2: Use helper function _mesa_is_format_integer()

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
i965: Add reads_accumulator_implicitly() function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Add is_accumulator() function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
i965: Add writes_accumulator flag

Our hardware has an "accumulator" register, which can be used to store
intermediate results across multiple instructions.  Many instructions
can implicitly write a value to the accumulator in addition to their
normal destination register.  This is enabled by the "AccWrEn" flag.

This patch introduces a new flag, inst->writes_accumulator, which
allows us to express the AccWrEn notion in the IR.  It also creates a
n ALU2_ACC macro to easily define emitters for instructions that
implicitly write the accumulator.

Previously, we only supported implicit accumulator writes from the
ADDC, SUBB, and MACH instructions.  We always enabled them on those
instructions, and left them disabled for other instructions.

To take advantage of the MAC (multiply-accumulate) instruction, we
need to be able to set AccWrEn on other types of instructions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>