configure: Don't special case Cygwin to use gnu99, define _XOPEN_SOURCE instead

Revert "build: Build on Cygwin with gnu99 instead of c99." and define
_XOPEN_SOURCE appropriately.

This reverts commit 53e36d333c9b619c1a5fe9a8d2d08665654b0234.

Since Cygwin 1.7.18 (April 2013), it's headers correctly prototype strtoll()
when using -std=c99, and correctly prototype strdup() when _XOPEN_SOURCE is
defined appropriately, so this workaround is no longer needed.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Cc: Vinson Lee <vlee@freedesktop.org>
i965/fs: Track dependencies in instruction scheduling per reg offset.

Previously instruction scheduling tracked dependencies on a per-register
basis. This meant that there was an artificial dependency between
interpolation instructions writing into the same virtual register.

Instruction scheduling would insert a number of instructions between the
two instructions in this example, when they are actually independent.

   linterp vgrf8+0.0:F, hw_reg2:F, hw_reg3:F, hw_reg6:F
   linterp vgrf8+1.0:F, hw_reg2:F, hw_reg3:F, hw_reg6+16:F

This lead to cases where the first texture coordinate is interpolated at
the beginning of the shader, but the second is done immediately before
the texture operation that uses it as a source.

After this change, the artificial dependency is removed and the
interpolation instructions are scheduled together.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Remove artificial dependency between math instructions.

... on Gen6+. I'm not actually sure which class Gen6 fits into.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
gallium: fix u_default_transfer_inline_write for textures

This doesn't fix any known issue. In fact, radeon drivers ignore all
the discard flags for textures and implicitly do "discard range"
for any write transfer.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
radeonsi: mark MSAA config state as dirty at the beginning of CS

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81020

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
glsl: Fix the foreach_in_list_reverse macro.

We clearly don't want to start at the head and walk backwards; we want
to start at the last real element before the tail sentinel.  If the list
is empty, tail_pred will be the head sentinel, and we'll stop.

Nothing uses this function, so I guess nobody noticed it was broken.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
i965/disasm: Fix disassembly of the any16h/all16h predicates.

BRW_PREDICATE_ALIGN1_ANY16H was incorrectly being disassembled as
"all16h", and ALL16H would probably print as "(null)".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
nv50/ir: use unordered_set instead of list to keep track of var uses

The set of variable uses does not need to be ordered in any way, and
removing/adding elements is a fairly common operation in various
optimization passes.

This shortens runtime of piglit test fp-long-alu to ~22s from ~4h

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
nvc0: allocate more space before a counter is configured

On nvc0, a counter can have up to 6 sources instead of only one
for nve4+. This fixes a crash when a counter uses more than
one source.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Add build_mesa.sh script
gallium: add pipe_screen::get_driver_query_group_info v2

Driver queries are organized as a single hierarchy where queries
are categorized into groups. Each goup has a list of queries and
a maximum number of queries that can be sampled.

This will be used by GL_AMD_performance monitor.

V2:
 - add doc to src/gallium/docs/source/screen.rst
 - s/pipe_context/pipe_screen in the commit msg
 - rewrite commit message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
gallium: add new fields to pipe_driver_query_info

This will be used by GL_AMD_performance_monitor.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
gallium: add a f32 field to pipe_query_result

This will be used by the GL_FLOAT counter type of
GL_AMD_performance_monitor.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
gallium: replace pipe_driver_query_info::max_value by a union v2

This will be used to return different numeric types for
driver queries.

V2:
 - use float instead of double
 - reorder pipe_numeric_type_union to avoid bad initializers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
gallium: make pipe_context::begin_query return a boolean

This can be used to check if a query is unable to start.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
mesa/st: implement GL_AMD_performance_monitor v4

This is based on the original patch of Christoph Bumiller.
(source: http://people.freedesktop.org/~chrisbmr/perfmon.diff)

Drivers must implement get_driver_query_group_info and
get_driver_query_info in order to enable this extension.

V2: (Samuel Pitoiset)
 - fix compilation
 - improve the original code
 - rewrite some parts of the original code

V3:
 - do not use pipe_driver_query_info::min_value which is always set to 0

V4:
 - only enable AMD_performance_monitor if the driver implements
 pipe_screen::get_driver_query_group_info and get_driver_query_info

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
gallium: add util_get_driver_query_group_info

This generic function will be used to get groups of queries.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
svga: implement pipe_screen::get_driver_query_group_info v3

This enables GL_AMD_performance_monitor for svga.

V2:
 - s/pipe_context/pipe_screen in the commit msg

V3:
 - use util_get_driver_query_group_info

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
freedreno: implement pipe_screen::get_driver_query_group_info v3

This enables GL_AMD_performance_monitor for freedreno.

V2:
 - s/pipe_context/pipe_screen in the commit msg

V3:
 - use util_get_driver_query_group_info

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
radeon: implement pipe_screen::get_driver_query_group_info v3

This enables GL_AMD_performance_monitor for radeon.

V2:
 - s/pipe_context/pipe_screen in the commit msg

V3:
 - use util_get_driver_query_group_info

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>