Commit Graph

71612 Commits

Author SHA1 Message Date
Emil Velikov 4fc86f183e svga: scons: remove unused HAVE_SYS_TYPES_H define
There isn't a single instance in mesa that
mentions HAVE_SYS_TYPES_H, other than this file.

Cc: Jose Fonseca <jfonseca@vmware.com>
Acked-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-07-29 17:40:47 +01:00
Matt Turner 23bba717e1 glsl: Avoid double promotion. 2015-07-29 09:34:52 -07:00
Matt Turner a562313f37 mesa: Avoid double promotion.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-07-29 09:34:52 -07:00
Matt Turner 7adc9fa1f1 mesa/math: Avoid double promotion.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-07-29 09:34:52 -07:00
Matt Turner 076f73edb3 program: Avoid double promotion.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-07-29 09:34:52 -07:00
Matt Turner 04aa8b58a0 swrast: Avoid double promotion.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-07-29 09:34:52 -07:00
Matt Turner c92b2a1d7b tnl: Avoid double promotion.
There are a couple of unrelated changes in t_vb_lighttmp.h that I hope
you'll excuse -- there's a block of code that's duplicated modulo a few
trivial differences that I took the liberty of fixing.
2015-07-29 09:34:52 -07:00
Matt Turner 2b47ef715a vbo: Avoid double promotion.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-07-29 09:34:52 -07:00
Matt Turner b568a5f6a8 util: Avoid double promotion.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-07-29 09:34:52 -07:00
Matt Turner 29ef7a9f19 gallium/auxiliary: Avoid double promotion.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-07-29 09:34:52 -07:00
Matt Turner 4251ccb47b nir: Avoid double promotion.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-07-29 09:34:51 -07:00
Matt Turner c1da15709a i965: Use float calculations when double is unnecessary.
Literals without an f/F suffix are of type double, and implicit
conversion rules specify that the float in (float op double) be
converted to a double before the operation is performed. I believe float
execution was intended (in nearly all cases) or is sufficient (in the
case of gen7_urb.c).

Removes a lot of float <-> double conversion instructions and replaces
many double instructions with float instructions which are cheaper.

   text     data      bss      dec      hex  filename
4928659   195160    26192  5150011   4e953b  i965_dri.so before
4928315   195152    26192  5149659   4e93db  i965_dri.so after

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2015-07-29 09:34:51 -07:00
Matt Turner c67ce2bd3b gallium/auxiliary: Use exp2(x) instead of pow(2.0, x). 2015-07-29 09:34:51 -07:00
Matt Turner b73782bf18 program: Use exp2(x) instead of pow(2.0, x). 2015-07-29 09:34:51 -07:00
Matt Turner f8a647883a mesa: Use floats for viewport bounds.
ARB_viewport_array specifies that DEPTH_RANGE consists of double-
precision parameters (corresponding commit d4dc35987), and a preparatory
commit (6340e609a) added _mesa_get_viewport_xform() which returned
double-precision scale[3] and translate[3] vectors, even though X, Y,
Width, and Height were still floats.

All users of _mesa_get_viewport_xform() immediately convert the double
scale and translation vectors into floats (which were floats originally,
but were converted to doubles in _mesa_get_viewport_xform(), sigh).

i965 at least cannot consume doubles (see SF_CLIP_VIEWPORT). If we want
to pass doubles to hardware, we should have a different function that
does that.

Acked-by: Mathias Froehlich <Mathias.Froehlich@web.de>
2015-07-29 09:34:51 -07:00
Matt Turner ecc559218d c99_math: Implement exp2f for MSVC.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-07-29 09:34:51 -07:00
Matt Turner 5c7fd67045 glsl: Remove MSVC implementations of copysign and isnormal.
Non-Gallium parts of Mesa require MSVC 2013 which provides these.
2015-07-29 09:34:51 -07:00
Francisco Jerez 02425d3ec2 i965/fs: Make the default builder 64-wide before entering the optimization loop.
Not a typo.  Replace the default builder with one of bogus width to
catch cases in which optimization passes assume that the default
dispatch width is good enough.  The execution controls of instructions
emitted during optimization should in general match the original code
that is being manipulated.  Many of the problems fixed in this series
were caught by the assertions introduced in this patch.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 19:30:11 +03:00
Francisco Jerez 4529916dfd i965/fs: Don't set exec_all on instructions wider than the original in lower_simd_width.
This could have led to somewhat increased bandwidth usage for lowered
texturing instructions on Gen4 (which is the only case in which
lower_width may be greater than inst->exec_size).  After the previous
patches the invariant mentioned in the comment should no longer be
assumed by any of the other optimization and lowering passes, so the
exec_all() call shouldn't be necessary anymore.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 19:30:11 +03:00
Francisco Jerez eaba922582 i965/fs: Initialize a builder explicitly in the gen4 send dependency work-arounds.
Instead of relying on the default one.  This shouldn't lead to any
functional changes because DEP_RESOLVE_MOV overrides the execution
size of the instruction anyway and other execution controls are
irrelevant.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 19:30:11 +03:00
Matt Turner 8b838fa9f0 i965/cfg: Assert that cur_do/while/if pointers are non-NULL.
More.. like in commit 4d93a07c.
2015-07-29 09:20:07 -07:00
Ilia Mirkin 9da9adcfd7 nvc0/ir: cache vertex out base so that we don't recompute again
The global CSE pass stinks and is unable to pull this out. Easy enough
to handle it here and avoid generating unnecessary special register
loads (which can allegedly be quite slow).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-07-29 11:05:56 -04:00
Ilia Mirkin ad75620863 nvc0/ir: output base for reading is based on laneid
PFETCH retrieves the address for incoming vertices, not output vertices
in TCS. For output vertices, we must use the laneid as a base.

Fixes barrier piglit test, which was failing for entirely non-barrier
reasons, but rather that it was (a) trying to draw multiple patches and
(b) the incoming patch size was not the same as the outgoing patch size.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-07-29 09:40:44 -04:00
Francisco Jerez e42d2948d3 Revert "pipe-loader: simplify pipe_loader_drm_probe"
This reverts commit a27ec5dc46.  It
breaks the intended behaviour of pipe_loader_probe() with ndev==0 as
relied upon by clover to query the number of devices available to the
pipe loader in the system.

Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-07-29 16:17:17 +03:00
Francisco Jerez 5e645e68d6 i965/fs: Switch opt_cse() to the fs_builder constructor from instruction.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:15:34 +03:00
Francisco Jerez 992cda2c8a i965/fs: Switch lower_logical_sends() to the fs_builder constructor from instruction.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:15:23 +03:00
Francisco Jerez 930ebb2585 i965/fs: Switch lower_load_payload() to the fs_builder constructor from instruction.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:15:16 +03:00
Francisco Jerez a0b192d3d9 i965/fs: Don't rely on the default builder to create a null register in emit_spill.
It's not guaranteed to have the same width as the instruction
generating the spilled variable.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:15:10 +03:00
Francisco Jerez bfad71606a i965/fs: Set up the builder execution size explicitly in opt_sampler_eot().
opt_sampler_eot() was relying on the default builder to have the same
width as the sampler and FB write opcodes it was eliminating, the
channel selects didn't matter because the builder was only being used
to allocate registers, no new instructions were being emitted with it.
A future commit will change the width of the default builder what will
break this assumption, so initialize it explicitly here.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:15:03 +03:00
Francisco Jerez 09039f4bc1 i965/fs: Initialize a builder explicitly in opt_peephole_predicated_break().
This wasn't taking into account the execution controls of the original
instruction, but it was most likely not a bug because control flow
instructions are typically full width.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:14:56 +03:00
Francisco Jerez e1f4724097 i965/fs: Set execution controls explicitly in opt_peephole_sel().
Emit the SELs and MOVs with the same execution controls as the
original MOVs, and the CMP with the same execution controls as the IF.
Also explicitly check that the execution controls of any pair of MOVs
being folded into a SEL are compatible (which is almost always going
to be the case), since otherwise it would seem wrong to initialize the
builder object below from the then_mov instruction only.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:14:49 +03:00
Francisco Jerez ff463af436 i965/fs: Set execution controls correctly in lower_integer_multiplication().
lower_integer_multiplication() was ignoring the execution controls of
the original MUL instruction.  Fix it by using the new fs_builder
constructor.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:14:42 +03:00
Francisco Jerez ce90227c71 i965/fs: Set execution controls correctly for lowered pull constant loads.
demote_pull_constants() was ignoring the execution size and channel
selects of the instruction that wanted the constant, which doesn't
matter for uniform pull constant loads because all channels get the
same scalar value, but it might for varying pull constant loads.  Fix
it by using the new fs_builder() constructor that takes care of
setting execution controls compatible with the instruction passed as
argument.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:14:35 +03:00
Francisco Jerez 53077aee66 i965/fs: Set the execution size of the MOVs correctly in opt_combine_constants().
The execution size was being left equal to the default of 8/16, which
AFAICT would have overwritten components other than the one we wanted
to initialize and could potentially have corrupted other registers.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:14:29 +03:00
Francisco Jerez 6f7dea0b32 i965/fs: Define a new fs_builder constructor taking an instruction as argument.
We have a number of optimization passes that repeat the same pattern
before inserting new instructions into the program based on some
previous instruction: They point the default builder at the original
instruction, then call exec_all() and group() to select the same
execution controls the original instruction had, and then maybe call
annotate() to clone the debug annotation from the original
instruction.

In fact an optimization pass missing any of these steps is likely to
be broken if the intention was to emit new code based on a preexisting
instruction, so let's make it easy for passes to do the right thing by
having an fs_builder constructor that automates the task of setting up
a builder to emit a given instruction provided as argument.

The following patches fix all cases I've found in which we weren't
explicitly initializing the execution controls of the emitted
instructions, and clean-up optimization passes which were already
doing the right thing to use the new constructor.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:13:49 +03:00
Francisco Jerez 7cb60d770f i965/fs: Translate memory barrier NIR intrinsics.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:50 +03:00
Francisco Jerez b5f1a48e23 i965/fs: Execute nir_setup_uniforms, _inputs and _outputs unconditionally.
Images take up zero uniform slots in the nir_shader::num_uniforms
calculation, but nir_setup_uniforms needs to be executed even if the
program has no non-image uniforms so the driver-specific image
parameters are uploaded.  nir_setup_uniforms is a no-op if there are
really no uniforms, so checking the num_uniform count is useless in
any case.

The nir_setup_inputs and _outputs changes shouldn't lead to any
functional change, they are just meant to preserve the symmetry
between them and nir_setup_uniforms.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:50 +03:00
Francisco Jerez 3e5a90792d i965/fs: Don't overwrite fs_visitor::uniforms and ::param_size during the SIMD16 run.
Image variables need to allocate additional uniform slots over
nir_shader::num_uniforms.  nir_setup_uniforms() overwrites the values
imported from the SIMD8 visitor and then exits early before entering
the nir_shader::uniforms loop, so image uniforms are never re-created.
Instead leave the imported values alone, they *must* be the same for
the uniform layout of both runs to be compatible.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:49 +03:00
Francisco Jerez ea0ac53f05 i965/fs: Drop unused untyped surface read and atomic emit methods.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:49 +03:00
Francisco Jerez 854c4d8b37 i965/fs: Revisit NIR atomic counter intrinsic translation.
Rewrite the NIR atomic counter intrinsics translation code making use
of the recently introduced surface builder.  This will allow the
removal of some of the functionality duplicated between the visitor
and surface builder.

v2: Drop VEC4 suport.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:49 +03:00
Francisco Jerez 1aab58f394 i965/fs: Import surface message builder helper functions.
Implement helper functions that can be used to construct and send
untyped and typed surface read, write and atomic messages to the
shared dataport unit easily.

v2: Drop VEC4 suport.
v3: Reimplement in terms of logical send opcodes.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:49 +03:00
Francisco Jerez 03846696ce i965/fs: Handle zero-size allocations in fs_builder::vgrf().
This will be handy to avoid some ugly ternary operators in the next
patch, like:
 fs_reg reg = (size == 0 ? null_reg_ud() : vgrf(..., size));

Because a zero-size register allocation is guaranteed not to ever be
read or written we can just return the null register.  Another
possibility would be to actually allocate a zero-size VGRF what would
involve defining a zero-size register class in the register allocator
and a considerable amount of churn.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:49 +03:00
Francisco Jerez 3352724dfa i965/fs: Implement lowering of logical surface instructions.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:49 +03:00
Francisco Jerez 086d29f4d7 i965/fs: Hook up SIMD lowering to unroll surface instructions of unsupported width.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:49 +03:00
Francisco Jerez 7a594a95a9 i965/fs: Define logical typed and untyped surface opcodes.
Each logical variant is largely equivalent to the original opcode but
instead of taking a single payload source it expects its arguments
separately as individual sources, like:

 typed_surface_write_logical null, coordinates, source, surface,
                                    num_coordinates, num_components

This patch defines the opcodes and usual instruction boilerplate,
including a placeholder lowering function provided mainly as
documentation for their source registers.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-07-29 14:12:49 +03:00
Francisco Jerez 3af2623da5 i965: Lift the constness restriction on surface indices passed to untyped ops.
v2: Update NIR atomic intrinsic handling too (Ken).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-29 14:12:49 +03:00
Francisco Jerez a0c02d2bbb i965: Define the setup_vector_uniform_values() backend_visitor interface.
This cleans up the VEC4 implementation of setup_uniform_values()
somewhat and will avoid duplication of the image uniform upload code
by having a common interface to upload a vector of uniforms on either
back-end.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-29 14:12:48 +03:00
Francisco Jerez bd0d6a9cce i965/fs: Remove the emit_texture_gen*() fs_visitor methods.
This is now dead code.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-29 14:12:48 +03:00
Francisco Jerez 59979b133d i965/fs: Reimplement emit_mcs_fetch() in terms of logical sends.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-29 14:12:48 +03:00
Francisco Jerez ba78a50071 i965/fs: Reimplement emit_texture() in terms of logical send messages.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-29 14:12:48 +03:00