gallium/hud: do not use free() for the free_query_data hook

That confuses Gallium's memory debugging code where CALLOC/MALLOC
must be matched with FREE, not free().

Reviewed-by: Marek Olšák <maraeo@gmail.com>
ilo: move internal shader interface to a new header

Move it to ilo_shader_internal.h.  The goal is to make files not part of the
compiler include only ilo_shader.h eventually.
ilo: use multiple entry points for shader creation

Replace ilo_shader_state_create() by

 ilo_shader_create_vs()
 ilo_shader_create_gs()
 ilo_shader_create_fs()
 ilo_shader_create_cs()

Rename ilo_shader_state_destroy() to ilo_shader_destroy().  The old
ilo_shader_destroy() is renamed to ilo_shader_destroy_kernel().
ilo: clean up finalize_shader_states()

Add ilo_shader_select_kernel() to replace the dependency table,
ilo_shader_variant_init(), and ilo_shader_state_use_variant().

With the changes, we no longer need to include ilo_shader_internal.h in
ilo_state.c.
ilo: add functions to query shaders

Add ilo_shader_get_type() to query the type (PIPE_SHADER_x) of the shader.
Add ilo_shader_get_kernel_offset() and ilo_shader_get_kernel_param() to query
the cache offset and various kernel parameters of the selected kernel.
ilo: introduce ilo_shader_cso for VS

When a new VS kernel is generated, a newly added function,
ilo_gpe_init_vs_cso(), is called to construct 3DSTATE_VS command in
ilo_shader_cso.  When the command needs to be emitted later, we copy the
command from the CSO instead of constructing it dynamically.
ilo: use ilo_shader_cso for GS

Add ilo_gpe_init_gs_cso() to construct 3DSTATE_GS once and early for geometry
shaders.
ilo: convert pipe_rasterizer_state to ilo_rasterizer_wm

Add ilo_gpe_init_rasterizer_wm() to construct fixed-function part of
3DSTATE_WM once in create_rasterizer_state().
ilo: use ilo_rasterizer_state exclusively in GPE

Replace pipe_rasterizer_state by ilo_rasterizer_state for the remaining GPE
functions for consistency.
ilo: use ilo_shader_cso for FS

Add ilo_gpe_init_fs_cso() to construct 3DSTATE_PS and shader part of
3DSTATE_WM once and early for fragment shaders.
ilo: map SO registers at shader compile time

The unmodified pipe_stream_output_info describes its outputs as if they are in
TGSI_FILE_OUTPUT.  Remap the register indices to where they appear in the VUE.

TGSI_SEMANTIC_PSIZE needs a little care because it is at the W channel.
ilo: use ilo_shader_state exclusively in GPE

This allows us to remove ilo_shader_internal.h from ilo_gpe_gen7.c.  The
unfinished code in 3DSTATE_DS, 3DSTATE_HS, and INTERFACE_DESCRIPTOR_DATA are
partly or entirely removed.
ilo: move SBE setup code to ilo_shader.c

Add ilo_shader_select_kernel_routing() to construct 3DSTATE_SBE.  It is called
in ilo_finalize_states(), rather than in create_fs_state(), as it depends on
VS/GS and rasterizer states.

With this change, ilo_shader_internal.h is no longer needed for
ilo_gpe_gen6.c.
ilo: speed up ilo_shader_select_kernel_routing() a bit

Remember the order of the source attributes and avoid recomputation when it
does not change.
ilo: remove ilo_shader_internal.h from GEN7 pipeline

Replace direct shader accesses with ilo_shader_get_kernel_param() and etc.
ilo: remove ilo_shader_internal.h from GEN6 pipeline

Replace direct shader accesses with ilo_shader_get_kernel_param() and etc.
ilo: honor render condition in blitter

Make pass_render_condition() available for blitter, and check for render
condition in (and only in) clear(), clear_render_target(), and
clear_depth_stencil().
nvc0: do not set tiled mode on gart bo when fence debugging is used

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
draw: avoid overflows in the llvm draw loop

Before we could easily overflow if start+count>max integer. To
avoid it we can just iterate over the count. This makes sure
that we never crash, since most of the overflow conditions
is already handled.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
draw: allow overflows in the llvm paths

Because our code couldn't handle it we were skipping rendering
if we detected overflows. According to the spec we should
still render but with all 0 vertices, which is what the llvm
code already does. So for the llvm paths lets enable processing
even if an overflow condition has been detected.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>