mesa.git
6 years agonir: Use deref instructions in lower_constant_initializers
Jason Ekstrand [Fri, 16 Mar 2018 19:08:15 +0000 (12:08 -0700)]
nir: Use deref instructions in lower_constant_initializers

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/builder: Use deref instructions for load/store/copy_var
Jason Ekstrand [Mon, 26 Mar 2018 21:35:05 +0000 (14:35 -0700)]
nir/builder: Use deref instructions for load/store/copy_var

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradv: Disable lower_io_to_temporaries during deref changes.
Bas Nieuwenhuizen [Sun, 3 Jun 2018 23:10:05 +0000 (01:10 +0200)]
radv: Disable lower_io_to_temporaries during deref changes.

Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Use derefs in nir_lower_samplers
Jason Ekstrand [Mon, 19 Mar 2018 17:53:45 +0000 (10:53 -0700)]
nir: Use derefs in nir_lower_samplers

We change glsl_to_nir to provide derefs for bot textures and samplers
while we're at it.  This makes the lowering much easier since we only
either replace sources or remove them.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/lower_samplers: Clean up function arguments
Jason Ekstrand [Thu, 15 Mar 2018 16:32:24 +0000 (09:32 -0700)]
nir/lower_samplers: Clean up function arguments

This little refactor makes us stop passing stage around and puts the
builder as the first parameter to some functions.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/lower_samplers: split out _legacy version for deref chains
Rob Clark [Tue, 15 May 2018 22:27:18 +0000 (18:27 -0400)]
nir/lower_samplers: split out _legacy version for deref chains

To simplify the transition, and make things bisectable, split out a
legacy copy or lower_samplers.  This way the i965 and gallium drivers
can independently switch over to deref instructions.

Since the lower_samplers_as_deref pass is only used by gallium drivers,
it can be converted in lock-step with moving the lower_deref_instrs
pass, and so does not need a corresponding _legacy clone.

This legacy pass will be removed in a future commit.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/blorp: Stop setting tex->texture/sampler
Jason Ekstrand [Mon, 2 Apr 2018 23:48:59 +0000 (16:48 -0700)]
intel/blorp: Stop setting tex->texture/sampler

nir_tex_instr_create uses rzalloc so it's already NULL

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/nir: Only lower load/store derefs
Jason Ekstrand [Fri, 23 Mar 2018 17:31:59 +0000 (10:31 -0700)]
intel/nir: Only lower load/store derefs

Everything else should already be handled.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/fs: Use image_deref intrinsics instead of image_var
Jason Ekstrand [Fri, 23 Mar 2018 17:27:12 +0000 (10:27 -0700)]
intel/fs: Use image_deref intrinsics instead of image_var

Since we had to rewrite the deref walking loop anyway, I took the
opportunity to make it a bit clearer and more efficient.  In particular,
in the AoA case, we will now emit one minmax instead of one per array
level.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv/pipeline: Convert apply_pipeline_layout to deref instructions
Jason Ekstrand [Fri, 23 Mar 2018 06:25:07 +0000 (23:25 -0700)]
anv/pipeline: Convert apply_pipeline_layout to deref instructions

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv/apply_pipeline_layout: Simplify extract_tex_src_plane
Jason Ekstrand [Sun, 18 Mar 2018 04:37:36 +0000 (21:37 -0700)]
anv/apply_pipeline_layout: Simplify extract_tex_src_plane

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv/pipeline: Convert lower_multiview to deref instructions
Jason Ekstrand [Tue, 3 Apr 2018 00:46:36 +0000 (17:46 -0700)]
anv/pipeline: Convert lower_multiview to deref instructions

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv/pipeline: Convert YCbCr lowering to deref instructiosn
Jason Ekstrand [Fri, 23 Mar 2018 05:32:45 +0000 (22:32 -0700)]
anv/pipeline: Convert YCbCr lowering to deref instructiosn

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv/pipeline: Convert lower_input_attachments to deref instructions
Jason Ekstrand [Fri, 23 Mar 2018 05:15:51 +0000 (22:15 -0700)]
anv/pipeline: Convert lower_input_attachments to deref instructions

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv/pipeline: Do less deref instruction lowering
Jason Ekstrand [Fri, 23 Mar 2018 05:11:23 +0000 (22:11 -0700)]
anv/pipeline: Do less deref instruction lowering

This commit removes most of the deref instruction lowering.  Instead of
lowering early, we only lower textures and images and we only do so
right before any of the anv image lowering passes.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradv: Remove image_var stores.
Bas Nieuwenhuizen [Fri, 11 May 2018 12:02:13 +0000 (14:02 +0200)]
radv: Remove image_var stores.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradv: Use deref instructions for tex derefs in meta shaders.
Bas Nieuwenhuizen [Sun, 25 Mar 2018 11:10:07 +0000 (13:10 +0200)]
radv: Use deref instructions for tex derefs in meta shaders.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac/nir: Add deref interp support.
Bas Nieuwenhuizen [Wed, 25 Apr 2018 16:57:46 +0000 (18:57 +0200)]
ac/nir: Add deref interp support.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac/nir: Add shared atomic deref instr support.
Bas Nieuwenhuizen [Wed, 25 Apr 2018 16:22:02 +0000 (18:22 +0200)]
ac/nir: Add shared atomic deref instr support.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradv: Gather info for deref instr based load/store.
Bas Nieuwenhuizen [Wed, 25 Apr 2018 15:07:16 +0000 (17:07 +0200)]
radv: Gather info for deref instr based load/store.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac/nir: Add deref based var loads/stores.
Bas Nieuwenhuizen [Tue, 24 Apr 2018 22:08:39 +0000 (00:08 +0200)]
ac/nir: Add deref based var loads/stores.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradv: Add shader info support for image deref instructions.
Bas Nieuwenhuizen [Sun, 25 Mar 2018 14:22:46 +0000 (16:22 +0200)]
radv: Add shader info support for image deref instructions.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac/nir: Add deref support to image intrinsics.
Bas Nieuwenhuizen [Sun, 25 Mar 2018 13:03:01 +0000 (15:03 +0200)]
ac/nir: Add deref support to image intrinsics.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac/nir: Implement derefs for integer gather4 lowering.
Bas Nieuwenhuizen [Fri, 11 May 2018 13:56:52 +0000 (15:56 +0200)]
ac/nir: Implement derefs for integer gather4 lowering.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac/nir: Support deref instructions in tex instructions.
Bas Nieuwenhuizen [Wed, 21 Mar 2018 23:45:54 +0000 (00:45 +0100)]
ac/nir: Support deref instructions in tex instructions.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac/nir: Support deref instructions in get_sampler_desc.
Bas Nieuwenhuizen [Wed, 21 Mar 2018 11:52:41 +0000 (12:52 +0100)]
ac/nir: Support deref instructions in get_sampler_desc.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac/nir: Implement the deref instr for shared memory.
Bas Nieuwenhuizen [Tue, 24 Apr 2018 22:45:33 +0000 (00:45 +0200)]
ac/nir: Implement the deref instr for shared memory.

v2: Store the result in ctx->ssa_defs.
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir,spirv: Rework function calls
Jason Ekstrand [Thu, 22 Mar 2018 23:41:18 +0000 (16:41 -0700)]
nir,spirv: Rework function calls

This commit completely reworks function calls in NIR.  Instead of having
a set of variables for the parameters and return value, nir_call_instr
now has simply has a number of sources which get mapped to load_param
intrinsics inside the functions.  It's up to the client API to build an
ABI on top of that.  In SPIR-V, out parameters are handled by passing
the result of a deref through as an SSA value and storing to it.

This virtue of this approach can be seen by how much it allows us to
delete from core NIR.  In particular, nir_inline_functions gets halved
and goes from a fairly difficult pass to understand in detail to almost
trivial.  It also simplifies spirv_to_nir somewhat because NIR functions
never were a good fit for SPIR-V.

Unfortunately, there is no good way to do this without a mega-commit.
Core NIR and SPIR-V have to be changed at the same time.  This also
requires changes to anv and radv because nir_inline_functions couldn't
handle deref instructions before this change and can't work without them
after this change.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agospirv/cfg: Make the builder fully capable for both walks
Jason Ekstrand [Fri, 23 Mar 2018 01:48:01 +0000 (18:48 -0700)]
spirv/cfg: Make the builder fully capable for both walks

We were only initializing vtn_builder::func for the pre-walk where we
build the CFG.  We were only initializing the nir_builder for the later
walk through the instructions even though were were setting b->cursor
for the pre-walk.  Let's set both both places so that everything is
consistent.  This useful because we handle OpFunctionParameter in the
pre-walk and we're going to need to be able to emit instructions.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agospirv: Record the type of functions
Jason Ekstrand [Fri, 23 Mar 2018 01:44:06 +0000 (18:44 -0700)]
spirv: Record the type of functions

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agospirv: Update vtn_pointer_to/from_ssa to handle deref pointers
Jason Ekstrand [Thu, 22 Mar 2018 23:39:54 +0000 (16:39 -0700)]
spirv: Update vtn_pointer_to/from_ssa to handle deref pointers

Now that pointers can be derefs and derefs just produce SSA values, we
can convert any pointer to/from SSA.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agospirv: Allow pointers to have a deref at the base
Jason Ekstrand [Fri, 23 Mar 2018 15:22:54 +0000 (08:22 -0700)]
spirv: Allow pointers to have a deref at the base

Previously, pointers fell into two categories: index/offset for UBOs,
SSBOs, etc. and var + access chain for logical pointers.  This commit
adds another logical pointer mode that's deref + access chain.

It's tempting to think that we can just replace variable-based pointers
with deref-based or at least replace the access chain with a deref
chain.  Unfortunately, there are a few sticky bits that prevent this:

 1) We can't return deref-based pointers from OpVariable because those
    opcodes may come outside of a function so there's no place to emit
    the deref instructions.

 2) We can't always use variable-based pointers because we may not
    always know the variable.  (We do now, but he upcoming function
    rework will take that option away.)

 3) We also can't replace the access chain struct with a deref.  Due to
    the re-ordering we do in order to handle loop continues, the derefs
    we would emit as part of OpAccessChain may not dominate their uses.
    We normally fix this up with nir_repair_ssa but that generates phi
    nodes which we don't want in the middle of our deref chains.

All in all, we have no real better option than to support partial access
chains while also re-emitting the deref instructions on the spot.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agospirv: Clean up vtn_pointer_to_offset
Jason Ekstrand [Thu, 22 Mar 2018 16:07:01 +0000 (09:07 -0700)]
spirv: Clean up vtn_pointer_to_offset

Now that push constants are using on-the-fly offsets, we no longer need
to handle access chains in vtn_pointer_to_offset.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agospirv: Make push constants an offset-based pointer
Jason Ekstrand [Thu, 22 Mar 2018 15:50:34 +0000 (08:50 -0700)]
spirv: Make push constants an offset-based pointer

Push constants have been a weird edge-case for a while in that they have
explitic offsets but we've been internally building access chains for
them.  This mostly works but it means that passing pointers to push
constants through as function arguments is broken.  The easy thing to do
for now is to just treat them like UBOs or SSBOs only without a block
index.  This does loose a bit of information since we no longer have an
accurate access range and any indirect access will look like it could
read the whole block.  Unfortunately, there's not much we can do about
that.  Once NIR derefs get a bit more powerful, we can plumb these
through as derefs and be able to reason about them again.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agospirv: Use NIR per-member splitting
Jason Ekstrand [Thu, 22 Mar 2018 00:30:22 +0000 (17:30 -0700)]
spirv: Use NIR per-member splitting

Before, we were doing structure splitting in spirv_to_nir.
Unfortunately, this doesn't really work when you think about passing
struct pointers into functions.  Doing it later in NIR is a much better
plan.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/spirv: Pass nir_variable_data into apply_var_decoration
Jason Ekstrand [Thu, 22 Mar 2018 00:24:07 +0000 (17:24 -0700)]
nir/spirv: Pass nir_variable_data into apply_var_decoration

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add a concept of per-member structs and a lowering pass
Jason Ekstrand [Wed, 21 Mar 2018 23:48:35 +0000 (16:48 -0700)]
nir: Add a concept of per-member structs and a lowering pass

This adds a concept of "members" to a variable with an interface type.
It allows you to specify the full variable data for each member of the
interface instead of once for the variable.  We also add a lowering pass
to lower those variables to a sequence of variables and rewrite all the
derefs accordingly.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agospirv: Use deref instructions for most variables
Jason Ekstrand [Fri, 16 Mar 2018 20:35:59 +0000 (13:35 -0700)]
spirv: Use deref instructions for most variables

The only thing still using old-school drefs are function calls.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agost/nir: Move lower_deref_instrs later
Jason Ekstrand [Tue, 20 Mar 2018 19:28:35 +0000 (12:28 -0700)]
st/nir: Move lower_deref_instrs later

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965: Move nir_lower_deref_instrs to right before locals_to_regs
Jason Ekstrand [Tue, 20 Mar 2018 01:00:14 +0000 (18:00 -0700)]
i965: Move nir_lower_deref_instrs to right before locals_to_regs

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/lower_tex: Always copy deref and offset sources
Jason Ekstrand [Tue, 27 Mar 2018 16:32:57 +0000 (09:32 -0700)]
nir/lower_tex: Always copy deref and offset sources

This should make nir_lower_tex properly handle deref instructions as
well as make it more correct when texture arrays are used and it's
called after lowering samplers to binding table indices.

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/nir: Fixup deref modes after lowering patch vertices
Jason Ekstrand [Sat, 17 Mar 2018 06:20:46 +0000 (23:20 -0700)]
intel/nir: Fixup deref modes after lowering patch vertices

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel,ir3: Disable nir_opt_copy_prop_vars
Jason Ekstrand [Tue, 20 Mar 2018 21:19:32 +0000 (14:19 -0700)]
intel,ir3: Disable nir_opt_copy_prop_vars

This pass doesn't handle deref instructions yet.  Making it handle both
legacy derefs and deref instructions would be painful.  Since it's not
important for correctness, just disable it for now.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in opt_undef
Jason Ekstrand [Mon, 2 Apr 2018 23:44:24 +0000 (16:44 -0700)]
nir: Support deref instructions in opt_undef

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Consider deref instructions in opt_peephole_select
Jason Ekstrand [Tue, 27 Mar 2018 16:45:00 +0000 (09:45 -0700)]
nir: Consider deref instructions in opt_peephole_select

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Consider deref instructions in lower_phis_to_scalar
Jason Ekstrand [Tue, 27 Mar 2018 01:13:59 +0000 (18:13 -0700)]
nir: Consider deref instructions in lower_phis_to_scalar

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_drawpixels
Jason Ekstrand [Mon, 2 Apr 2018 22:57:25 +0000 (15:57 -0700)]
nir: Support deref instructions in lower_drawpixels

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_clamp_color_outputs
Jason Ekstrand [Tue, 27 Mar 2018 00:20:12 +0000 (17:20 -0700)]
nir: Support deref instructions in lower_clamp_color_outputs

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_alpha_test
Jason Ekstrand [Tue, 27 Mar 2018 00:06:35 +0000 (17:06 -0700)]
nir: Support deref instructions in lower_alpha_test

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in loop_analyze
Jason Ekstrand [Mon, 26 Mar 2018 22:21:36 +0000 (15:21 -0700)]
nir: Support deref instructions in loop_analyze

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in remove_unused_varyings
Jason Ekstrand [Wed, 21 Mar 2018 05:10:58 +0000 (22:10 -0700)]
nir: Support deref instructions in remove_unused_varyings

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_pos_center
Jason Ekstrand [Fri, 23 Mar 2018 14:51:24 +0000 (07:51 -0700)]
nir: Support deref instructions in lower_pos_center

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_wpos_ytransform
Jason Ekstrand [Wed, 21 Mar 2018 03:03:26 +0000 (20:03 -0700)]
nir: Support deref instructions in lower_wpos_ytransform

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_atomics
Jason Ekstrand [Tue, 20 Mar 2018 23:30:54 +0000 (16:30 -0700)]
nir: Support deref instructions in lower_atomics

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_io
Jason Ekstrand [Sun, 18 Mar 2018 02:27:36 +0000 (19:27 -0700)]
nir: Support deref instructions in lower_io

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in gather_info
Jason Ekstrand [Sun, 18 Mar 2018 04:09:14 +0000 (21:09 -0700)]
nir: Support deref instructions in gather_info

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in propagate_invariant
Jason Ekstrand [Sat, 17 Mar 2018 18:22:03 +0000 (11:22 -0700)]
nir: Support deref instructions in propagate_invariant

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_clip_cull
Jason Ekstrand [Sat, 17 Mar 2018 06:18:38 +0000 (23:18 -0700)]
nir: Support deref instructions in lower_clip_cull

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_system_values
Jason Ekstrand [Sat, 17 Mar 2018 05:13:00 +0000 (22:13 -0700)]
nir: Support deref instructions in lower_system_values

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_indirect_derefs
Jason Ekstrand [Sat, 17 Mar 2018 00:23:14 +0000 (17:23 -0700)]
nir: Support deref instructions in lower_indirect_derefs

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_vars_to_ssa
Jason Ekstrand [Fri, 16 Mar 2018 08:27:35 +0000 (01:27 -0700)]
nir: Support deref instructions in lower_vars_to_ssa

Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in split_var_copies
Jason Ekstrand [Sat, 17 Mar 2018 04:20:44 +0000 (21:20 -0700)]
nir: Support deref instructions in split_var_copies

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_var_copies
Jason Ekstrand [Fri, 16 Mar 2018 07:20:57 +0000 (00:20 -0700)]
nir: Support deref instructions in lower_var_copies

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add a deref path helper struct
Jason Ekstrand [Tue, 20 Mar 2018 18:11:25 +0000 (11:11 -0700)]
nir: Add a deref path helper struct

This commit introduces a new nir_deref.h header for helpers that are
less common and really only needed by a few heavy-duty passes.  In this
header is a new struct for representing a full deref path which can be
walked in either direction.

v2 (Jason Ekstrand):
 - Assert that deref != NULL (Caio)
 - Fill _short_path with 0xdeadbeef in debug builds when not used (Caio)
 - Make nir_deref_path a typedef (Rob)

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_io_to_temporaries
Jason Ekstrand [Thu, 15 Mar 2018 22:54:35 +0000 (15:54 -0700)]
nir: Support deref instructions in lower_io_to_temporaries

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in lower_global_vars_to_local
Jason Ekstrand [Thu, 15 Mar 2018 22:54:23 +0000 (15:54 -0700)]
nir: Support deref instructions in lower_global_vars_to_local

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add a pass for fixing deref modes
Jason Ekstrand [Thu, 15 Mar 2018 22:37:50 +0000 (15:37 -0700)]
nir: Add a pass for fixing deref modes

This will be needed by anything which changes variable modes without
rewriting derefs.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support deref instructions in remove_dead_variables
Jason Ekstrand [Tue, 20 Mar 2018 21:16:06 +0000 (14:16 -0700)]
nir: Support deref instructions in remove_dead_variables

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agottn: convert to deref instructions
Rob Clark [Thu, 5 Apr 2018 00:39:01 +0000 (20:39 -0400)]
ttn: convert to deref instructions

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoprog/nir: Use deref instructions for params
Jason Ekstrand [Mon, 19 Mar 2018 20:43:54 +0000 (13:43 -0700)]
prog/nir: Use deref instructions for params

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoglsl/nir: Use deref instructions instead of dref chains
Jason Ekstrand [Thu, 15 Mar 2018 16:58:22 +0000 (09:58 -0700)]
glsl/nir: Use deref instructions instead of dref chains

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoglsl/nir: Only claim to handle intrinsic functions
Jason Ekstrand [Mon, 19 Mar 2018 22:10:29 +0000 (15:10 -0700)]
glsl/nir: Only claim to handle intrinsic functions

Non-intrinsic function handling has never actually been tested and
probably doesn't work.  Just get rid of it for now.  We can always add
it back in later if it's useful.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: add deref lowering sanity checking
Rob Clark [Wed, 16 May 2018 14:02:55 +0000 (10:02 -0400)]
nir: add deref lowering sanity checking

This will be removed at the end of the transition, but add some tracking
plus asserts to help ensure that lowering passes are called at the
correct point (pre or post deref instruction lowering) as passes are
converted and the point where lower_deref_instrs() is called is moved.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv,i965,radv,st,ir3: Call nir_lower_deref_instrs
Jason Ekstrand [Mon, 19 Mar 2018 17:50:40 +0000 (10:50 -0700)]
anv,i965,radv,st,ir3: Call nir_lower_deref_instrs

This inserts a call to nir_lower_deref_instrs at every call site of
glsl_to_nir, spirv_to_nir, and prog_to_nir.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/deref: Add some deref cleanup functions
Jason Ekstrand [Wed, 21 Mar 2018 00:32:07 +0000 (17:32 -0700)]
nir/deref: Add some deref cleanup functions

Sometimes it's useful for a pass to be able to clean up its own derefs
instead of waiting for DCE.  This little helper makes it very easy.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add helpers for working with deref instructions
Jason Ekstrand [Fri, 16 Mar 2018 08:15:47 +0000 (01:15 -0700)]
nir: Add helpers for working with deref instructions

This commit adds a pass for lowering deref instructions to deref chains
as well as some smaller helpers to ease the transition.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add deref sources to texture instructions
Jason Ekstrand [Mon, 19 Mar 2018 17:24:59 +0000 (10:24 -0700)]
nir: Add deref sources to texture instructions

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add _deref versions of all of the _var intrinsics
Jason Ekstrand [Thu, 15 Mar 2018 21:56:43 +0000 (14:56 -0700)]
nir: Add _deref versions of all of the _var intrinsics

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/builder: Add deref building helpers
Jason Ekstrand [Thu, 15 Mar 2018 14:57:58 +0000 (07:57 -0700)]
nir/builder: Add deref building helpers

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add a deref instruction type
Jason Ekstrand [Thu, 15 Mar 2018 04:45:38 +0000 (21:45 -0700)]
nir: Add a deref instruction type

This commit adds a new instruction type to NIR for handling derefs.
Nothing uses it yet but this adds the data structure as well as all of
the code to validate, print, clone, and [de]serialize them.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/validate: Rework intrinsic type validation
Jason Ekstrand [Tue, 3 Apr 2018 02:23:36 +0000 (19:23 -0700)]
nir/validate: Rework intrinsic type validation

This moves the switch statement for specific intrinsics above source and
destination validation.  We also rework the source and destination
validation to use different bit_size values for each source and/or
destination.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonv50/ir: only avoid spilling constrained def if a mov is added
Karol Herbst [Wed, 2 May 2018 16:36:41 +0000 (18:36 +0200)]
nv50/ir: only avoid spilling constrained def if a mov is added

fix spilling regression introduced by 5428066f5e

this is just a minor mistake done while moving the code out into a new
function. The function contained a loop which might have been terminated
earlier and skipped setting noSpill to 1. After the refactoring it was always
set.

Fixes: 5428066f5e1ef5ea6ae04c84019f270023cfc6aa
("nv50/ir: make a copy of tex src if it's referenced multiple times")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
6 years agomeson: Fix typo that breaks -Dgalium-xvmc=false
Dylan Baker [Fri, 22 Jun 2018 17:08:47 +0000 (10:08 -0700)]
meson: Fix typo that breaks -Dgalium-xvmc=false

_xmvc -> _xvmc. Sigh

Fixes: a6943bb4ce99ea7af7222552f1326fb80823d0b2
       ("meson: Fix auto option for xvmc")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Clayton Craft <clayton.a.craft@intel.com>
6 years agomeson: Fix auto option for va
Dylan Baker [Thu, 21 Jun 2018 15:35:03 +0000 (08:35 -0700)]
meson: Fix auto option for va

The same as the previous two patches, but for the libva state tracker.

Fixes: 724916c8a84b5bba8f880f17da936585d52c97b6
       ("meson: dedup gallium-xvmc logic")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: Fix auto option for xvmc
Dylan Baker [Thu, 21 Jun 2018 15:34:05 +0000 (08:34 -0700)]
meson: Fix auto option for xvmc

This fixes the same problem as the previous patch did for vdpau, but for
xvmc.

Fixes: 724916c8a84b5bba8f880f17da936585d52c97b6
       ("meson: dedup gallium-xvmc logic")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: Correct behavior of vdpau=auto
Dylan Baker [Thu, 21 Jun 2018 15:28:36 +0000 (08:28 -0700)]
meson: Correct behavior of vdpau=auto

Currently if vdpau is set to auto, it will be disabled only in cases
where gallium is disabled or the host OS is not supported (mac, haiku,
windows). However on (for example) Linux if libvdpau is not installed
then the build will error because of the unmet dependency. This corrects
auto to do the right thing, and not error if libvdpau is not installed.

Fixes: 992af0a4b8224bdb4809e01c2f00d2f32546aee5
       ("meson: dedup gallium-vdpau logic")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoradv: always check the return error when submitting a CS
Samuel Pitoiset [Thu, 21 Jun 2018 12:39:30 +0000 (14:39 +0200)]
radv: always check the return error when submitting a CS

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: check the return values of radv_signal_fence()
Samuel Pitoiset [Thu, 21 Jun 2018 12:39:29 +0000 (14:39 +0200)]
radv: check the return values of radv_signal_fence()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: change the returned error in radv_signal_fence()
Samuel Pitoiset [Thu, 21 Jun 2018 12:39:28 +0000 (14:39 +0200)]
radv: change the returned error in radv_signal_fence()

From my point of view, when we aren't able to submit a CS
something terribly wrong happens and we are most likely
going to lost the device.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agofreedreno: a2xx: fix clear color
Jonathan Marek [Thu, 21 Jun 2018 21:06:30 +0000 (17:06 -0400)]
freedreno: a2xx: fix clear color

the format of the CLEAR_COLOR register doesn't depend on the target format
this fixes clear color when rendering to 32-bit RGBA and 16-bit targets

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: a2xx: fix crash when freeing context
Jonathan Marek [Thu, 21 Jun 2018 21:06:29 +0000 (17:06 -0400)]
freedreno: a2xx: fix crash when freeing context

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: a2xx: fix crash on first clear
Jonathan Marek [Thu, 21 Jun 2018 21:06:28 +0000 (17:06 -0400)]
freedreno: a2xx: fix crash on first clear

blend can be NULL, so check for that

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: add a20x
Jonathan Marek [Thu, 21 Jun 2018 21:06:27 +0000 (17:06 -0400)]
freedreno: add a20x

this patch adds support for a20x, which has some differences with a220:
-no VGT_MAX_VTX_INDX register
-no CLEAR_COLOR register
-set RB_BC_CONTROL in restore (hangs without)
-different CP_DRAW_INDX format

tested with kmscube and glmark2 scenes, on par with a220

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: a2xx: increase size of the offset field in instr_fetch_vtx_t
Jonathan Marek [Thu, 21 Jun 2018 21:06:26 +0000 (17:06 -0400)]
freedreno: a2xx: increase size of the offset field in instr_fetch_vtx_t

The offset field is 22 bit large.
11 bits are necessary because MaxVertexAttribRelativeOffset = 2047

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agov3d: Don't forget to initialize the buffer offset of a new winsys handle.
Eric Anholt [Wed, 20 Jun 2018 23:56:26 +0000 (16:56 -0700)]
v3d: Don't forget to initialize the buffer offset of a new winsys handle.

6 years agov3d, vc4: Disable valgrind checking of CLE inputs when NDEBUG is set.
Eric Anholt [Thu, 21 Jun 2018 22:45:30 +0000 (15:45 -0700)]
v3d, vc4: Disable valgrind checking of CLE inputs when NDEBUG is set.

For a meson -Db_ndebug=true release build on x86_64, reduces text size of
libv3d.a from 53.0k to 51.6k.  Inspired by 0d5329d626e3 ("anv: Disable
__gen_validate_value if NDEBUG is set.")

6 years agomesa: fix glGetInteger64v for arrays of integers
Marek Olšák [Wed, 20 Jun 2018 18:55:24 +0000 (14:55 -0400)]
mesa: fix glGetInteger64v for arrays of integers

Cc: 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoac/surface: disallow rotated micro tile mode
Marek Olšák [Thu, 21 Jun 2018 00:00:59 +0000 (20:00 -0400)]
ac/surface: disallow rotated micro tile mode

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradeonsi: fix occlusion queries with 16x AA without FBO attachments on Stoney
Marek Olšák [Wed, 20 Jun 2018 23:43:36 +0000 (18:43 -0500)]
radeonsi: fix occlusion queries with 16x AA without FBO attachments on Stoney

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradeonsi: handle non-clearable DCC buffers as MSAA resolve dst
Marek Olšák [Wed, 20 Jun 2018 23:15:36 +0000 (18:15 -0500)]
radeonsi: handle non-clearable DCC buffers as MSAA resolve dst

This is reproducible on Stoney, but other chips may be affected too.

Cc 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>