nvc0: allocate more space before a counter is configured

On nvc0, a counter can 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>
gallium: add pipe_context::get_driver_query_group_info

This will be used to sort counters per group for
GL_AMD_performance_monitor.

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

V2:
 - make group_id the last field of this struct, this fixes
 drivers which use pipe_driver_query_info like radeon

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
gallium: use of pipe_driver_query_info::group_id

This adds two groups of queries for nvc0. All other drivers
which use pipe_driver_query_info (freedreno, svga and radeon)
only define one group of queries.

V2:
 - rewrite commit message

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

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

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

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
nvc0: implement pipe_context::get_driver_query_group_info

This adds two groups of queries.

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

This allows to return different numeric types for queries.

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

This will be used by GL_AMD_performance_monitor.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
nvc0: use of new counter types

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

This will be used for the GL_FLOAT counter type of
AMD_performance_monitor.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@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>
nvc0: make begin_query return false when all MP counters are used

V2:
 - do not return immediately after nvc0_mp_pm_query_end() in
 order to set the current state of the given query

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

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

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

V2: (Samuel Pitoiset)
 - Fix compilation
 - Improve the original code
 - Rewrite some parts of the original code

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
[RFC] mesa/st: enable GL_AMD_performance_monitor

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