i965: Fix JIP/UIP calculations.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82846
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82929
vc4: Include stdio/stdlib in headers so I don't have to include it per file.

There are a few tools I want to have always available, and fprintf() and
abort() are among them.
vc4: Stop complaining about unknown texture channel types.

It doesn't matter to this code -- the sampler always returns 8-bit unorm
rgba.
vc4: Convert to using an enum for texture data types
vc4: Fix a typo in the validation for miplevels.

It meant that LUMALPHA was being marked as *many* miplevels, and
unsurprisingly wouldn't validate.  On the other hand, some miplevel counts
wouldn't get the small mips validated at all.
vc4: Add support for texture tiling.

This still treats everything as RGBA8888 for the most part, same as
before.  This is a prerequisite for handling other texture formats, since
only RGBA8888 has a raster-layout mode.
vc4: Add support for all the texture and FBO formats we can.

Now that tiling is in place, we can expose the other formats.  Depth is
still broken (need to make changes in the shader), but if you don't expose
it things crash all over.  SNORM is dropped, but we could re-add it later
with some shader fixes to handle converting between [0,1] and [-1,1].
vc4: Fix totally broken assertions about inter-instruction reg conflicts.

The spec citation talked about A and B, and I proceeded to pay no
attention to whether the waddrs were for A or B.  As a result, this pair
of instructions would claim to conflict:

mov ra4, ra4 ; nop nop, r0, r0
mov.ns ra4, rb4 ; nop nop, r0, r0
vc4: Fix FLR for integer values less than 0.

If we didn't truncate at all, then we don't need to fix for truncation
happening in the wrong direction.

Fixes piglit builtin-functions/*-floor-*
vc4: Emit the scoreboard wait just when it's needed.

This should improve performance on real hardware by allowing more shader
instances to run in parallel.  It also fixes assertion failures in tests
that don't emit a fragment color, since otherwise we didn't have enough
instructions to fit our signals in.
vc4: Avoid using undefined values when there's no color write.

The simulator assertion fails when you read-before-write a temporary
value, and there's no point in doing the packing if there was no color
written.
vc4: Make some helpers for setting condition codes in instructions.
vc4: Add support for fragment discards.

Fixes piglit glsl-fs-discard-01 and -03, and allows a lot of mesa demos to
start running.  glsl-fs-discard-02 has a problem where the first tile is
not getting stored on the first render.
i965/cfg: Add functions to test if a block is a successor/predecessor.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
i965/cfg: Add a function to remove a block from the cfg.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
i965: Add a basic-block aware backend_instruction::remove method.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
i965: Add basic-block aware backend_instruction::insert_* methods.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
i965: Add invalidate_cfg parameter to invalidate_live_intervals().

Will let us avoid invalidating the CFG if the optimization pass has
removed instructions using the new basic block methods.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
i965: Use basic-block aware insertion/removal functions.

To avoid invalidating and recreating the control flow graph. Also stop
invalidating the CFG in places we didn't add or remove an instruction.

cfg calculations:     202951 -> 80307 (-60.43%)

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
i965/fs: Preserve CFG in register allocation.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>