mesa.git
5 years agoglsl/nir: Inline functions in float64_funcs_to_nir
Jason Ekstrand [Mon, 4 Mar 2019 20:39:40 +0000 (14:39 -0600)]
glsl/nir: Inline functions in float64_funcs_to_nir

This doesn't really change anything as the functions will all get
inlined anyway.  However it does let us do a bit of the work earlier and
in a common place.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoglsl/nir: Add a shared helper for building float64 shaders
Jason Ekstrand [Sun, 3 Mar 2019 16:00:14 +0000 (10:00 -0600)]
glsl/nir: Add a shared helper for building float64 shaders

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/nir: Drop an unneeded lower_constant_initializers call
Jason Ekstrand [Mon, 4 Mar 2019 22:01:23 +0000 (16:01 -0600)]
intel/nir: Drop an unneeded lower_constant_initializers call

Even though this is technically a step in the function inlining process
as laid out in nir_inline_functions.c, it's not really needed.  We
already have constant initializers lowered here and no new ones are
added by appending the softfp64 functions.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/debug: Add a debug flag to force software fp64
Jason Ekstrand [Sun, 3 Mar 2019 16:10:46 +0000 (10:10 -0600)]
intel/debug: Add a debug flag to force software fp64

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoi965: Compile the fp64 program based on nir options
Jason Ekstrand [Tue, 5 Mar 2019 04:54:44 +0000 (22:54 -0600)]
i965: Compile the fp64 program based on nir options

Instead of looking the devinfo directly, look at the lowering options we
provided to NIR.  This is more accurate as it's now checking for "do we
need full software lowering" rather than a hardware bit.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agonir: Teach loop unrolling about 64-bit instruction lowering
Jason Ekstrand [Sun, 3 Mar 2019 15:24:12 +0000 (09:24 -0600)]
nir: Teach loop unrolling about 64-bit instruction lowering

The lowering we do for 64-bit instructions can cause a single NIR ALU
instruction to blow up into hundreds or thousands of instructions
potentially with control flow.  If loop unrolling isn't aware of this,
it can unroll a loop 20 times which contains a nir_op_fsqrt which we
then lower to a full software implementation based on integer math.
Those 20 invocations suddenly get a lot more expensive than NIR loop
unrolling currently expects.  By giving it an approximate estimate
function, we can prevent loop unrolling from going to town when it
shouldn't.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agonir: Expose double and int64 op_to_options_mask helpers
Jason Ekstrand [Fri, 1 Mar 2019 23:39:54 +0000 (17:39 -0600)]
nir: Expose double and int64 op_to_options_mask helpers

We already have one internally for int64 but we don't have a similar one
for doubles so we'll have to make one.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agocompiler/nir: add an is_conversion field to nir_op_info
Iago Toral Quiroga [Tue, 12 Feb 2019 11:55:28 +0000 (12:55 +0100)]
compiler/nir: add an is_conversion field to nir_op_info

This is set to True only for numeric conversion opcodes.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/fs: Fix extract_u8 of an odd byte from a 64-bit integer
Ian Romanick [Wed, 27 Feb 2019 23:53:55 +0000 (15:53 -0800)]
intel/fs: Fix extract_u8 of an odd byte from a 64-bit integer

In the old code, we would generate the exact same instruction for
extract_u8(some_u64, 0) and extract_u8(some_u64, 1).  The mask-a-word
trick only works for even numbered bytes.

This fixes the (new) piglit test
tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask.shader_test.

v2: Use a SHR instead of an AND.  This saves an instruction compared to
using two moves.  Suggested by Jason.

Fixes: 6ac2d169019 ("i965/fs: Fix extract_i8/u8 to a 64-bit destination")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/fs: nir_op_extract_i8 extracts a byte, not a word
Ian Romanick [Wed, 27 Feb 2019 23:52:18 +0000 (15:52 -0800)]
intel/fs: nir_op_extract_i8 extracts a byte, not a word

Fixes: 6ac2d169019 ("i965/fs: Fix extract_i8/u8 to a 64-bit destination")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/compiler: Silence unused parameter warning in brw_interpolation_map.c
Ian Romanick [Tue, 26 Feb 2019 19:24:56 +0000 (11:24 -0800)]
intel/compiler: Silence unused parameter warning in brw_interpolation_map.c

The parameter is never used, and it's not part of a common interface
idiom.  Remove it.

src/intel/compiler/brw_interpolation_map.c: In function ‘brw_setup_vue_interpolation’:
src/intel/compiler/brw_interpolation_map.c:62:59: warning: unused parameter ‘devinfo’ [-Wunused-parameter]
                             const struct gen_device_info *devinfo)
                                                           ^~~~~~~

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/compiler: Silence many unused parameter warnings in brw_eu.h
Ian Romanick [Tue, 26 Feb 2019 19:18:49 +0000 (11:18 -0800)]
intel/compiler: Silence many unused parameter warnings in brw_eu.h

In file included from src/intel/compiler/brw_eu_util.c:34:0:
src/intel/compiler/brw_eu.h: In function ‘brw_message_desc_header_present’:
src/intel/compiler/brw_eu.h:288:63: warning: unused parameter ‘devinfo’ [-Wunused-parameter]
 brw_message_desc_header_present(const struct gen_device_info *devinfo,
                                                               ^~~~~~~
src/intel/compiler/brw_eu.h: In function ‘brw_message_ex_desc’:
src/intel/compiler/brw_eu.h:296:51: warning: unused parameter ‘devinfo’ [-Wunused-parameter]
 brw_message_ex_desc(const struct gen_device_info *devinfo,
                                                   ^~~~~~~
src/intel/compiler/brw_eu.h: In function ‘brw_message_ex_desc_ex_mlen’:
src/intel/compiler/brw_eu.h:303:59: warning: unused parameter ‘devinfo’ [-Wunused-parameter]
 brw_message_ex_desc_ex_mlen(const struct gen_device_info *devinfo,
                                                           ^~~~~~~
src/intel/compiler/brw_eu.h: In function ‘brw_sampler_desc_binding_table_index’:
src/intel/compiler/brw_eu.h:337:68: warning: unused parameter ‘devinfo’ [-Wunused-parameter]
 brw_sampler_desc_binding_table_index(const struct gen_device_info *devinfo,
                                                                    ^~~~~~~
src/intel/compiler/brw_eu.h: In function ‘brw_sampler_desc_sampler’:
src/intel/compiler/brw_eu.h:344:56: warning: unused parameter ‘devinfo’ [-Wunused-parameter]
 brw_sampler_desc_sampler(const struct gen_device_info *devinfo, uint32_t desc)
                                                        ^~~~~~~
src/intel/compiler/brw_eu.h: In function ‘brw_sampler_desc_return_format’:
src/intel/compiler/brw_eu.h:371:62: warning: unused parameter ‘devinfo’ [-Wunused-parameter]
 brw_sampler_desc_return_format(const struct gen_device_info *devinfo,
                                                              ^~~~~~~
src/intel/compiler/brw_eu.h: In function ‘brw_dp_desc_binding_table_index’:
src/intel/compiler/brw_eu.h:405:63: warning: unused parameter ‘devinfo’ [-Wunused-parameter]
 brw_dp_desc_binding_table_index(const struct gen_device_info *devinfo,
                                                               ^~~~~~~
src/intel/compiler/brw_eu.h: In function ‘brw_dp_a64_untyped_atomic_desc’:
src/intel/compiler/brw_eu.h:754:41: warning: unused parameter ‘exec_size’ [-Wunused-parameter]
                                unsigned exec_size, /**< 0 for SIMD4x2 */
                                         ^~~~~~~~~
src/intel/compiler/brw_eu.h: In function ‘brw_dp_a64_untyped_atomic_float_desc’:
src/intel/compiler/brw_eu.h:775:47: warning: unused parameter ‘exec_size’ [-Wunused-parameter]
                                      unsigned exec_size,
                                               ^~~~~~~~~

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agomeson: remove unused include_directories(vulkan)
Eric Engestrom [Tue, 20 Nov 2018 13:36:17 +0000 (13:36 +0000)]
meson: remove unused include_directories(vulkan)

The correct include path is "vulkan/…".

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agomeson: fix with_dri2 definition for GNU Hurd
Eric Engestrom [Tue, 5 Mar 2019 12:32:13 +0000 (12:32 +0000)]
meson: fix with_dri2 definition for GNU Hurd

Suggested-by: Dylan Baker <dylan@pnwbakers.com>
Cc: Timo Aaltonen <tjaalton@debian.org>
Cc: James Clarke <jrtc27@debian.org>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agoradv: set num_components on vulkan_resource_index intrinsic
Lionel Landwerlin [Wed, 6 Mar 2019 11:43:56 +0000 (11:43 +0000)]
radv: set num_components on vulkan_resource_index intrinsic

In 61e009d2c4e4df we changed the number of components in the
vulkan_resource_index intrinsic and forgot the update Radv's code for
it.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 61e009d2c4e4df ("spirv: Use the same types for resource indices as pointers")
Reviewed-by: Samuel Pitoiset samuel.pitoiset@gmail.com
5 years agonir: rename glsl_type_is_struct() -> glsl_type_is_struct_or_ifc()
Timothy Arceri [Tue, 5 Mar 2019 05:07:12 +0000 (16:07 +1100)]
nir: rename glsl_type_is_struct() -> glsl_type_is_struct_or_ifc()

Replace done using:
find ./src -type f -exec sed -i -- \
's/glsl_type_is_struct(/glsl_type_is_struct_or_ifc(/g' {} \;

Acked-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoglsl: rename record_types -> struct_types
Timothy Arceri [Tue, 5 Mar 2019 04:58:49 +0000 (15:58 +1100)]
glsl: rename record_types -> struct_types

Acked-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoglsl: rename record_location_offset() -> struct_location_offset()
Timothy Arceri [Tue, 5 Mar 2019 04:55:57 +0000 (15:55 +1100)]
glsl: rename record_location_offset() -> struct_location_offset()

Replace done using:
find ./src -type f -exec sed -i -- \
's/record_location_offset(/struct_location_offset(/g' {} \;

Acked-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoglsl: rename get_record_instance() -> get_struct_instance()
Timothy Arceri [Tue, 5 Mar 2019 04:46:14 +0000 (15:46 +1100)]
glsl: rename get_record_instance() -> get_struct_instance()

Replace done using:
find ./src -type f -exec sed -i -- \
's/get_record_instance(/get_struct_instance(/g' {} \;

Acked-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoglsl: rename is_record() -> is_struct()
Timothy Arceri [Tue, 5 Mar 2019 04:05:52 +0000 (15:05 +1100)]
glsl: rename is_record() -> is_struct()

Replace was done using:
find ./src -type f -exec sed -i -- \
's/is_record(/is_struct(/g' {} \;

Acked-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agonir/spirv: initial handling of OpenCL.std extension opcodes
Karol Herbst [Thu, 12 Jul 2018 13:02:27 +0000 (15:02 +0200)]
nir/spirv: initial handling of OpenCL.std extension opcodes

Not complete, mostly just adding things as I encounter them in CTS. But
not getting far enough yet to hit most of the OpenCL.std instructions.

Anyway, this is better than nothing and covers the most common builtins.

v2: add hadd proof from Jason
    move some of the lowering into opt_algebraic and create new nir opcodes
    simplify nextafter lowering
    fix normalize lowering for inf
    rework upsample to use nir_pack_bits
    add missing files to build systems
v3: split lines of iadd/sub_sat expressions

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/vtn: add support for SpvBuiltInGlobalLinearId
Karol Herbst [Mon, 14 Jan 2019 17:36:37 +0000 (18:36 +0100)]
nir/vtn: add support for SpvBuiltInGlobalLinearId

v2: use formula with fewer operations

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agonir: add support for address bit sized system values
Karol Herbst [Thu, 19 Jul 2018 14:39:58 +0000 (16:39 +0200)]
nir: add support for address bit sized system values

v2: add assert in else clause
    make local group intrinsics 32 bit wide
v3: always use 32 bit constant for local_size
v4: add comment by Jason

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/spirv: improve parsing of the memory model
Karol Herbst [Thu, 19 Jul 2018 11:04:14 +0000 (13:04 +0200)]
nir/spirv: improve parsing of the memory model

v2: add some vtn_fail_ifs

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: replace magic numbers with M_PI
Karol Herbst [Mon, 4 Mar 2019 18:11:12 +0000 (19:11 +0100)]
nir: replace magic numbers with M_PI

we define it inside 'include/c99_math.h' so it is safe to use.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: Implement VK_EXT_external_memory_host
Caio Marcelo de Oliveira Filho [Fri, 1 Mar 2019 21:15:31 +0000 (13:15 -0800)]
anv: Implement VK_EXT_external_memory_host

v2: Ignore the import if handleType == 0. (Jason)

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agov3d: Drop the V3D 3.x vpm read dead code elimination.
Eric Anholt [Wed, 27 Feb 2019 05:37:47 +0000 (21:37 -0800)]
v3d: Drop the V3D 3.x vpm read dead code elimination.

We now have NIR dead code eliminating our VPM reads, so this shouldn't be
necessary.

5 years agov3d: Eliminate the TLB and TLBU files.
Eric Anholt [Wed, 27 Feb 2019 05:34:22 +0000 (21:34 -0800)]
v3d: Eliminate the TLB and TLBU files.

We can just use the magic register file like we do for other magic waddrs.

5 years agov3d: Use ldunif instructions for uniforms.
Eric Anholt [Tue, 26 Feb 2019 18:17:59 +0000 (10:17 -0800)]
v3d: Use ldunif instructions for uniforms.

The idea is that for repeated use of the same uniform, we could avoid
loading it on each consumer.  The results look pretty good.

total instructions in shared programs: 6413571 -> 6521464 (1.68%)
total threads in shared programs: 154214 -> 154000 (-0.14%)
total uniforms in shared programs: 2393604 -> 2119629 (-11.45%)
total spills in shared programs: 4960 -> 4984 (0.48%)
total fills in shared programs: 6350 -> 6418 (1.07%)

Once we do scheduling at the NIR level, the register pressure (and thus
also instructions) issues we see here will drop back down.

5 years agov3d: Add support for register-allocating a ldunif to a QFILE_TEMP.
Eric Anholt [Tue, 26 Feb 2019 17:19:40 +0000 (09:19 -0800)]
v3d: Add support for register-allocating a ldunif to a QFILE_TEMP.

On V3D 4.x, we can use ldunifrf to load uniforms to any register, and this
will let us schedule the ldunif wherever we want in the program.

5 years agov3d: Drop the old class bits splitting up the accumulators.
Eric Anholt [Tue, 26 Feb 2019 17:13:43 +0000 (09:13 -0800)]
v3d: Drop the old class bits splitting up the accumulators.

This seems to be left over from vc4, and I don't use them any more.

5 years agov3d: Add support for vir-to-qpu of ldunif instructions to a temp.
Eric Anholt [Tue, 26 Feb 2019 17:05:05 +0000 (09:05 -0800)]
v3d: Add support for vir-to-qpu of ldunif instructions to a temp.

We can load a uniform to any register, so add support for non-ALU
instructions with sig.ldunif to a temp.

5 years agov3d: Switch implicit uniforms over to being any qinst->uniform != ~0.
Eric Anholt [Wed, 27 Feb 2019 02:36:05 +0000 (18:36 -0800)]
v3d: Switch implicit uniforms over to being any qinst->uniform != ~0.

I'm not sure why I didn't do this before -- it's clearly much simpler to
add dumping of the extra thing than to have it as another implicit source.

5 years agov3d: Do uniform rematerialization spilling before dropping threadcount
Eric Anholt [Tue, 26 Feb 2019 18:49:25 +0000 (10:49 -0800)]
v3d: Do uniform rematerialization spilling before dropping threadcount

This feels like the right tradeoff for threads vs uniforms, particularly
given that we often have very short thread segments right now:

total instructions in shared programs: 6411504 -> 6413571 (0.03%)
total threads in shared programs: 153946 -> 154214 (0.17%)
total uniforms in shared programs: 2387665 -> 2393604 (0.25%)

5 years agov3d: Fix temporary leaks of temp_registers and when spilling.
Eric Anholt [Tue, 26 Feb 2019 18:46:36 +0000 (10:46 -0800)]
v3d: Fix temporary leaks of temp_registers and when spilling.

On each iteration of successfully spilling a reg, we'd allocate another
copy of temp_registers, and when decrementing thread conut we'd allocate
another copy of the graph.  These all got cleaned up on freeing the
compile.

5 years agogitlab-ci: drop job prefixes
Eric Engestrom [Tue, 26 Feb 2019 14:40:29 +0000 (14:40 +0000)]
gitlab-ci: drop job prefixes

It is already obvious whether the job is building a container or running
a mesa build, so let's drop that prefix so that we can see more
information on the screen (eg. in the jobs list on a pipeline page).

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
5 years agotgsi_to_nir: Set correct location for uniforms.
Timur Kristóf [Mon, 4 Mar 2019 14:10:55 +0000 (15:10 +0100)]
tgsi_to_nir: Set correct location for uniforms.

Previously, only the driver_location was set for all variables,
but constants need to use the location field instead. This change
is necessary because the nine state tracker can produce non-packed
constants whose location needs to be explicitly set.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agotgsi_to_nir: Improve interpolation modes.
Timur Kristóf [Tue, 19 Feb 2019 09:11:36 +0000 (10:11 +0100)]
tgsi_to_nir: Improve interpolation modes.

This patch extracts the interpolation mode translation
into a separate function called ttn_translate_interp_mode,
adds support for TGSI_INTERPOLATE_COLOR which was missing,
and also sets the proper interpolation mode to output
variables, which were not set previously.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agotgsi_to_nir: use sampler variables and derefs
Kenneth Graunke [Wed, 6 Feb 2019 11:04:15 +0000 (03:04 -0800)]
tgsi_to_nir: use sampler variables and derefs

v2: fix is_shadow, is_array and txq

Some drivers (eg. iris) need the presence of sampler variables and derefs
so that they can count them to determine the number of samplers used.
This change also makes the output NIR closer to what glsl_to_nir outputs.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agotgsi_to_nir: Support FACE and POSITION properly.
Timur Kristóf [Fri, 8 Feb 2019 21:19:14 +0000 (22:19 +0100)]
tgsi_to_nir: Support FACE and POSITION properly.

Previously, FACE was hard-coded as a sysval, but TTN emulated
it incorrectly. Also, POSITION was not supported when it was
a sysval. This patch fixes these by allowing both of them to
be sysvals or inputs, based on driver capabilities. It also
fixes the TGSI FACE emulation based on the TGSI spec.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agotgsi_to_nir: Extract ttn_emulate_tgsi_front_face into its own function.
Timur Kristóf [Fri, 8 Feb 2019 21:11:08 +0000 (22:11 +0100)]
tgsi_to_nir: Extract ttn_emulate_tgsi_front_face into its own function.

We'll need to use the same logic in other places, so it makes sense to
have a separate function for this.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agotgsi_to_nir: Restructure system value loads.
Timur Kristóf [Fri, 8 Feb 2019 21:15:56 +0000 (22:15 +0100)]
tgsi_to_nir: Restructure system value loads.

Minor cleanup to the way system value loads work in tgsi_to_nir.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agotgsi_to_nir: Produce optimized NIR for a given pipe_screen.
Timur Kristóf [Tue, 5 Mar 2019 17:59:47 +0000 (18:59 +0100)]
tgsi_to_nir: Produce optimized NIR for a given pipe_screen.

With this patch, tgsi_to_nir will output NIR that is tailored to
the given pipe, by reading its capabilities and adjusting the NIR code
to those capabilities similarly to how glsl_to_nir works.

It also adds an optimization loop that brings the output NIR in line
with what glsl_to_nir outputs. This is necessary for the same reason
why glsl_to_nir has its own optimization loop: currently not every
driver does these optimizations yet.

For uses which cannot pass a pipe_screen we also keep a variant
called tgsi_to_nir_noscreen which keeps the old behavior.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Acked-By: Eric Anholt <eric@anholt.net>
5 years agofreedreno: Plumb pipe_screen through to irX_tgsi_to_nir.
Timur Kristóf [Mon, 4 Mar 2019 12:54:10 +0000 (13:54 +0100)]
freedreno: Plumb pipe_screen through to irX_tgsi_to_nir.

This patch makes it possible for freedreno to pass a pipe_screen
to tgsi_to_nir. This will be needed when tgsi_to_nir supports reading
pipe capabilities.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agonir: Add multiplier argument to nir_lower_uniforms_to_ubo.
Timur Kristóf [Thu, 28 Feb 2019 09:53:11 +0000 (10:53 +0100)]
nir: Add multiplier argument to nir_lower_uniforms_to_ubo.

Note that locations can be set in different units, and the multiplier
argument caters to supporting these different units. For example,
st_glsl_to_nir uses dwords (4 bytes) so the multiplier should be 4,
while tgsi_to_nir uses bytes, so the multiplier should be 16.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir: Move nir_lower_uniforms_to_ubo to compiler/nir.
Timur Kristóf [Fri, 8 Feb 2019 21:36:37 +0000 (22:36 +0100)]
nir: Move nir_lower_uniforms_to_ubo to compiler/nir.

The nir_lower_uniforms_to_ubo function is useful outside of
mesa/state_tracker, and in fact is needed to produce NIR for
drivers that have the PIPE_CAP_PACKED_UNIFORMS capability.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agotgsi_to_nir: Split to smaller functions.
Timur Kristóf [Fri, 8 Feb 2019 08:59:58 +0000 (09:59 +0100)]
tgsi_to_nir: Split to smaller functions.

Previously, tgsi_to_nir was a single big function, and this patch
intends to make the code easier to understand by splitting it up
to multiple smaller pieces.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-By: Tested-by: Rob Clark <robdclark@gmail.com>
5 years agotgsi_to_nir: Make the TGSI IF translation code more readable.
Timur Kristóf [Wed, 13 Feb 2019 23:01:04 +0000 (01:01 +0200)]
tgsi_to_nir: Make the TGSI IF translation code more readable.

This patch is a minor cleanup that only intends to make the
TGSI IF translation a bit easier to read.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agotgsi_to_nir: Fix TGSI LIT translation by using flt.
Timur Kristóf [Wed, 13 Feb 2019 22:45:47 +0000 (00:45 +0200)]
tgsi_to_nir: Fix TGSI LIT translation by using flt.

TGSI spec says LIT needs a "greater than" comparison. NIR doesn't have that,
so let's use "less than" and swap the arguments. Previously "greater than or equal"
was used by tgsi_to_nir which is incorrect.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agotgsi_to_nir: Fix the TGSI ARR translation by converting the result to int.
Timur Kristóf [Thu, 7 Feb 2019 17:01:24 +0000 (18:01 +0100)]
tgsi_to_nir: Fix the TGSI ARR translation by converting the result to int.

According to the TGSI spec, ARR needs to do a rounding and then
a float-to-integer conversion which was missing. This patch also
makes the rounding a bit more efficient by using nir_fround_even
instead of the previous nir_ffloor+nir_fadd trick.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agonir: Add ability for shaders to use window space coordinates.
Timur Kristóf [Tue, 5 Feb 2019 17:08:24 +0000 (18:08 +0100)]
nir: Add ability for shaders to use window space coordinates.

This patch adds a shader_info field that tells the driver to use window
space coordinates for a given vertex shader. It also enables this feature
in radeonsi (the only NIR-capable driver that supported it in TGSI),
and makes tgsi_to_nir aware of it.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: Move the stores for fixed function VS output reads into NIR.
Eric Anholt [Fri, 22 Feb 2019 22:26:26 +0000 (14:26 -0800)]
v3d: Move the stores for fixed function VS output reads into NIR.

This lets us emit the VPM_WRITEs directly from
nir_intrinsic_store_output() (useful once NIR scheduling is in place so
that we can reduce register pressure), and lets future NIR scheduling
schedule the math to generate them.  Even in the meantime, it looks like
this lets NIR DCE some more code and make better decisions.

total instructions in shared programs: 6429246 -> 6412976 (-0.25%)
total threads in shared programs: 153924 -> 153934 (<.01%)
total loops in shared programs: 486 -> 483 (-0.62%)
total uniforms in shared programs: 2385436 -> 2388195 (0.12%)

Acked-by: Ian Romanick <ian.d.romanick@intel.com> (nir)
5 years agov3d: Translate f2i(fround_even) as FTOIN.
Eric Anholt [Sat, 23 Feb 2019 19:21:26 +0000 (11:21 -0800)]
v3d: Translate f2i(fround_even) as FTOIN.

This appears to be just what the opcode does.  Needed for equivalence when
moving FF VPM stores into NIR.

5 years agonir: Improve printing of load_input/store_output variable names.
Eric Anholt [Sun, 24 Feb 2019 00:17:02 +0000 (16:17 -0800)]
nir: Improve printing of load_input/store_output variable names.

We were printing only when the channel was exactly the start channel, so
scalarized loads/stores would be missing the name on the rest.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agoanv: Implement VK_EXT_inline_uniform_block
Jason Ekstrand [Tue, 12 Feb 2019 22:56:24 +0000 (16:56 -0600)]
anv: Implement VK_EXT_inline_uniform_block

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agospirv: Use the same types for resource indices as pointers
Jason Ekstrand [Sat, 12 Jan 2019 16:58:33 +0000 (10:58 -0600)]
spirv: Use the same types for resource indices as pointers

We need more space than just a 32-bit scalar and we have to burn all
that space anyway so we may as well expose it to the driver.  This also
fixes a subtle bug when UBOs and SSBOs have different pointer types.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agospirv: Use the generic dereference function for OpArrayLength
Jason Ekstrand [Sat, 12 Jan 2019 16:57:28 +0000 (10:57 -0600)]
spirv: Use the generic dereference function for OpArrayLength

With the new deref changes, the old pointer_offset version may not be
the right one to call.  Just call the generic one and let it sort it
out.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agospirv: Pull offset/stride from the pointer for OpArrayLength
Jason Ekstrand [Sat, 12 Jan 2019 16:32:13 +0000 (10:32 -0600)]
spirv: Pull offset/stride from the pointer for OpArrayLength

We can't pull it from the variable type because it might be an array of
blocks and not just the one block.  While we're here, throw in some
error checking.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable@lists.freedesktop.org
5 years agoanv: Add a concept of a descriptor buffer
Jason Ekstrand [Mon, 19 Nov 2018 20:28:39 +0000 (14:28 -0600)]
anv: Add a concept of a descriptor buffer

This buffer goes along side the CPU data structure and may contain
pointers, bindless handles, or any other descriptor information.
Currently, all descriptors are size zero and nothing goes in the buffer
but this commit sets up the framework we will need later.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Take references to push descriptor set layouts
Jason Ekstrand [Tue, 12 Feb 2019 21:19:57 +0000 (15:19 -0600)]
anv: Take references to push descriptor set layouts

Technically, descriptor set layouts aren't required to survive past the
function they're passed into so we need to reference them.

Cc: "19.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Refactor descriptor pushing a bit
Jason Ekstrand [Tue, 12 Feb 2019 21:29:19 +0000 (15:29 -0600)]
anv: Refactor descriptor pushing a bit

Pull the common code out of the two entrypoints into the helper which
fetches the push descriptor set for us.  Now that it does more than just
get a thing, call it anv_cmd_buffer_push_descriptor_set.

Cc: "19.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: drop add_var_binding from anv_nir_apply_pipeline_layout.c
Jason Ekstrand [Tue, 12 Feb 2019 20:02:09 +0000 (14:02 -0600)]
anv: drop add_var_binding from anv_nir_apply_pipeline_layout.c

It has exactly one caller.  Just inline it.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Clean up descriptor set layouts
Jason Ekstrand [Sat, 24 Nov 2018 18:42:39 +0000 (12:42 -0600)]
anv: Clean up descriptor set layouts

The descriptor set layout code in our driver has undergone many changes
over the years.  Some of the fields which were once essential are now
useless or nearly so.  The has_dynamic_offsets field was completely
unused accept for the code to set and hash it.  The per-stage indices
were only being used to determine if a particular binding had images,
samplers, etc.  The fact that it's per-stage also doesn't matter because
that binding should never be accessed by a shader of the wrong stage.

This commit deletes a pile of cruft and replaces it all with a
descriptive bitfield which states what a particular descriptor contains.
This merely describes the data available and doesn't necessarily dictate
how it will be lowered in anv_nir_apply_pipeline_layout.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Count image param entries rather than images
Jason Ekstrand [Thu, 7 Feb 2019 00:02:30 +0000 (18:02 -0600)]
anv: Count image param entries rather than images

This is what we're actually storing in the descriptor set and consuming
when we bind surface states.  This commit renames image_count to
image_param_count a few places and moves the decision to not count image
params on gen9+ into anv_descriptor_set.c when we build the layout.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Stop allocating buffer views for dynamic buffers
Jason Ekstrand [Wed, 6 Feb 2019 23:16:34 +0000 (17:16 -0600)]
anv: Stop allocating buffer views for dynamic buffers

We emit the surface states for those on-the-fly so we don't need the
buffer view.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Rework arguments to anv_descriptor_set_write_*
Jason Ekstrand [Thu, 22 Nov 2018 00:00:56 +0000 (18:00 -0600)]
anv: Rework arguments to anv_descriptor_set_write_*

Make them all take a device followed by a set.  This is consistent
with how the actual Vulkan entrypoint parameters are laid out.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv/descriptor_set: Refactor alloc/free of descriptor sets
Jason Ekstrand [Mon, 19 Nov 2018 21:15:56 +0000 (15:15 -0600)]
anv/descriptor_set: Refactor alloc/free of descriptor sets

This commit just puts the free list code together as part of the pool
instead of having it inlined into the descriptor set create code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agov3d: Stop treating exec masking specially.
Eric Anholt [Tue, 5 Mar 2019 06:11:15 +0000 (22:11 -0800)]
v3d: Stop treating exec masking specially.

In our backend, the successor edges from the blocks only point to where
QPU control flow goes, not where the notional control flow goes from a
"break" or "continue" modifying the execution mask to resume writing to
some channels later.  As a result, this attempt at restricting live ranges
ended up missing the live range of a value where a conditional
break/continue was present in a loop before the later def of a variable.
The previous commit ended up fixing the problem that the flag tried to
solve.

Fixes glsl-vs-loop-continue.shader_test and/or
glsl-vs-loop-redundant-condition.shader_test based on register allocation
results.

5 years agov3d: Restrict live intervals to the blocks reachable from any def.
Eric Anholt [Tue, 5 Mar 2019 06:10:33 +0000 (22:10 -0800)]
v3d: Restrict live intervals to the blocks reachable from any def.

In the backend, we often have condition codes on writes to variables, such
that there's no screening def anywhere and the previous live ranges
algorithm would conclude that the start of the range extends to the start
of the program.  However, we do know that the live range can only extend
as early as you can reach from all blocks writing to the variable.

The motivation was that, while we have a couple of hacks to try to promote
conditional writes up to being a def within the block, the exec_mask one
was broken and needed a replacement.

Based on c3c1aa5aeb92 ("intel/fs: Restrict live intervals to the subset
possibly reachable from any definition.").

5 years agogitlab-ci: install distro's ninja
Andres Gomez [Tue, 5 Mar 2019 11:55:17 +0000 (13:55 +0200)]
gitlab-ci: install distro's ninja

Ubuntu Bionic is shipping ninja 1.8.2. Therefore, we do not need to
download v1.6.0 manually any more.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoradv: properly align the fence and EOP bug VA on GFX9
Samuel Pitoiset [Mon, 4 Mar 2019 13:25:08 +0000 (14:25 +0100)]
radv: properly align the fence and EOP bug VA on GFX9

If alignement is 0, offets returned by
radv_cmd_buffer_upload_alloc() are always 0. These two
virtual addresses were pointing at the same location.

Cc: 18.3 19.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: allocate enough space in cmdbuf when starting a subpass
Samuel Pitoiset [Tue, 5 Mar 2019 09:45:00 +0000 (10:45 +0100)]
radv: allocate enough space in cmdbuf when starting a subpass

This fixes some CTS crashes with:
dEQP-VK.renderpass2.suballocation.attachment_write_mask.attachment_count_8.start_index_*

Ideally, we should check cmd_buffer->cs->max_dw because there is
likely enough space (the internal clear draws allocate space), but
keep that way for consistency.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agovulkan: import vk_layer.h from Khronos
Eric Engestrom [Tue, 5 Mar 2019 13:18:28 +0000 (13:18 +0000)]
vulkan: import vk_layer.h from Khronos

Instead of relying on the system having it (and the right version).

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoegl: fix libdrm-less builds
Eric Engestrom [Wed, 27 Feb 2019 15:26:08 +0000 (15:26 +0000)]
egl: fix libdrm-less builds

This function was never used, and isn't properly guarded by HAVE_LIBDRM,
breaking the build on systems that don't have libdrm.

Let's just remove it.

Fixes: 7552fcb7b9b98392e6a8 "egl: add base EGL_EXT_device_base implementation"
Reported-by: Timo Aaltonen <tjaalton@debian.org>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
5 years agovulkan: import missing file from Khronos
Eric Engestrom [Tue, 5 Mar 2019 12:20:53 +0000 (12:20 +0000)]
vulkan: import missing file from Khronos

Fixes: 114c4aa0c84fc6d00407 "vulkan: update headers/registry to 1.1.102"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoutil: #define PATH_MAX when undefined (eg. Hurd)
Eric Engestrom [Wed, 27 Feb 2019 15:08:56 +0000 (15:08 +0000)]
util: #define PATH_MAX when undefined (eg. Hurd)

Cc: Timo Aaltonen <tjaalton@debian.org>
Cc: James Clarke <jrtc27@debian.org>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoradv: use the platform defines in vk.xml instead of hard-coding them
Eric Engestrom [Wed, 27 Feb 2019 12:20:56 +0000 (12:20 +0000)]
radv: use the platform defines in vk.xml instead of hard-coding them

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: use the platform defines in vk.xml instead of hard-coding them
Eric Engestrom [Wed, 27 Feb 2019 12:20:31 +0000 (12:20 +0000)]
anv: use the platform defines in vk.xml instead of hard-coding them

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: update supported patch version
Lionel Landwerlin [Mon, 4 Mar 2019 17:36:10 +0000 (17:36 +0000)]
anv: update supported patch version

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agoanv: toggle on support for VK_EXT_ycbcr_image_arrays
Tapani Pälli [Fri, 22 Feb 2019 06:54:13 +0000 (08:54 +0200)]
anv: toggle on support for VK_EXT_ycbcr_image_arrays

We already propagate coord_components correctly and did not have
layer restrictions for ycbcr formats.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agovulkan: update headers/registry to 1.1.102
Lionel Landwerlin [Mon, 4 Mar 2019 17:40:08 +0000 (17:40 +0000)]
vulkan: update headers/registry to 1.1.102

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agoanv: retain the is_array state in create_plane_tex_instr_implicit
Tapani Pälli [Wed, 20 Feb 2019 07:18:39 +0000 (09:18 +0200)]
anv: retain the is_array state in create_plane_tex_instr_implicit

This does not seem to fix anything ATM but is the right thing todo.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Fixes: f3e91e78a33775 ("anv: add nir lowering pass for ycbcr textures")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agomeson: avoid going back up the tree with include_directories()
Eric Engestrom [Thu, 14 Feb 2019 17:22:00 +0000 (17:22 +0000)]
meson: avoid going back up the tree with include_directories()

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agoi965: Implement threaded GL support.
Kenneth Graunke [Mon, 10 Jul 2017 06:03:44 +0000 (23:03 -0700)]
i965: Implement threaded GL support.

Now i965 supports mesa_glthread=true like Gallium drivers do.

According to Markus (degasus), the Citra emulator now runs ~30% faster.
Emmanuel (linkmauve) also reported that the Dolphin emulator improved
by 2.8x on one game.  (Both of those still need to be added to drirc.)

An Intel Mesa CI run with mesa_glthread=true appears to be happy.

Bioshock Infinite's benchmark mode seems to be around 15-20% faster
on my Skylake GT4 at 1920x1080.

Tested-by: Markus Wick <markus@selfnet.de>
Tested-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agoanv/pipeline: Drop anv_fill_binding_table
Jason Ekstrand [Sat, 2 Mar 2019 07:33:39 +0000 (01:33 -0600)]
anv/pipeline: Drop anv_fill_binding_table

We zero out the prog data anyway and, now that bias is always zero, this
function is accomplishing nothing.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoanv: Use an actual binding for gl_NumWorkgroups
Jason Ekstrand [Sat, 23 Feb 2019 19:34:11 +0000 (13:34 -0600)]
anv: Use an actual binding for gl_NumWorkgroups

This commit moves our handling of gl_NumWorkgroups over to work like our
handling of other special bindings in the Vulkan driver.  We give it a
magic descriptor set number and teach emit_binding_tables to handle it.
This is better than the bias mechanism we were using because it allows
us to do proper accounting through the bind map mechanism.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel,nir: Lower TXD with min_lod when the sampler index is not < 16
Jason Ekstrand [Fri, 8 Feb 2019 23:51:24 +0000 (17:51 -0600)]
intel,nir: Lower TXD with min_lod when the sampler index is not < 16

When we have a larger sampler index, we get into the "high sampler"
scenario and need an instruction header.  Even in SIMD8, this pushes the
instruction over the sampler message size maximum of 11 registers.
Instead, we have to lower TXD to TXL.

Fixes: cb98e0755f8d "intel/fs: Support min_lod parameters on texture..."
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agospirv: OpImageQueryLod requires a sampler
Jason Ekstrand [Wed, 27 Feb 2019 06:12:01 +0000 (00:12 -0600)]
spirv: OpImageQueryLod requires a sampler

No idea how this fell through the cracks besides the fact that the
sampler bound at 0 almost always works and the CTS isn't amazing.  In
any case, this appears to have been broken for almost forever.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable@lists.freedesktop.org
5 years agoanv: Count surfaces for non-YCbCr images in GetDescriptorSetLayoutSupport
Jason Ekstrand [Fri, 1 Mar 2019 20:01:08 +0000 (14:01 -0600)]
anv: Count surfaces for non-YCbCr images in GetDescriptorSetLayoutSupport

We were accidentally not counting those surfaces

Fixes: ddc4069122 "anv: Implement VK_KHR_maintenance3"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agospirv: Allow [i/u]mulExtended to use new nir opcode
Sagar Ghuge [Mon, 25 Feb 2019 22:56:29 +0000 (14:56 -0800)]
spirv: Allow [i/u]mulExtended to use new nir opcode

Use new nir opcode nir_[i/u]mul_2x32_64 and extract lower and higher 32
bits as needed instead of emitting mul and mul_high.

v2: Surround the switch case with curly braces (Jason Ekstrand)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/algebraic: Optimize low 32 bit extraction
Sagar Ghuge [Mon, 25 Feb 2019 19:43:53 +0000 (11:43 -0800)]
nir/algebraic: Optimize low 32 bit extraction

Optimize a situation where we only need lower 32 bits from 64 bit
result.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Suggested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoglsl: [u/i]mulExtended optimization for GLSL
Sagar Ghuge [Wed, 27 Feb 2019 22:02:54 +0000 (14:02 -0800)]
glsl: [u/i]mulExtended optimization for GLSL

Optimize mulExtended to use 32x32->64 multiplication.

Drivers which are not based on NIR, they can set the
MUL64_TO_MUL_AND_MUL_HIGH lowering flag in order to have same old
behavior.

v2: Add missing condition check (Jason Ekstrand)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Suggested-by: Matt Turner <Matt Turner <mattst88@gmail.com>
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/glsl: Add another way of doing lower_imul64 for gen8+
Sagar Ghuge [Fri, 15 Feb 2019 07:08:39 +0000 (23:08 -0800)]
nir/glsl: Add another way of doing lower_imul64 for gen8+

On Gen 8 and 9, "mul" instruction supports 64 bit destination type. We
can reduce our 64x64 int multiplication from 4 instructions to 3.

Also instead of emitting two mul instructions, we can emit single mul
instuction and extract low/high 32 bits from 64 bit result for
[i/u]mulExtended

v2: 1) Allow lower_mul_high64 to use new opcode (Jason Ekstrand)
    2) Add lower_mul_2x32_64 flag (Matt Turner)
    3) Remove associative property as bit size is different (Connor
       Abbott)

v3: Fix indentation and variable naming convention (Jason Ekstrand)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agost/nine: Ignore multisample quality level if no ms
Axel Davy [Fri, 22 Feb 2019 19:45:51 +0000 (20:45 +0100)]
st/nine: Ignore multisample quality level if no ms

Apparently instead of returning error when passing
a quality level different than 0 for
D3DMULTISAMPLE_NONE, we should pass.

Fixes: https://github.com/iXit/Mesa-3D/issues/340
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Ignore window size if error
Axel Davy [Wed, 2 Jan 2019 21:13:12 +0000 (22:13 +0100)]
st/nine: Ignore window size if error

Check GetWindowInfo and ignore the computed sizes
if there is an error.

Fixes a regression caused by earlier commit when
using old wine gallium nine patches.

Should also address a crash at window destruction.

Related issues:
 https://github.com/iXit/Mesa-3D/issues/331
 https://github.com/iXit/Mesa-3D/issues/332

Cc: mesa-stable@lists.freedesktop.org
Fixes: 2318ca68bbe ("st/nine: Handle window resize when a presentation
buffer is used")

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agoandroid: anv: fix libexpat shared dependency
Mauro Rossi [Sat, 2 Mar 2019 22:38:27 +0000 (23:38 +0100)]
android: anv: fix libexpat shared dependency

Fixes undefined reference building errors for XML_* functions

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "19.0" <mesa-stable@lists.freedesktop.org>
5 years agoandroid: anv: fix generated files depedencies (v2)
Mauro Rossi [Mon, 4 Mar 2019 09:34:08 +0000 (10:34 +0100)]
android: anv: fix generated files depedencies (v2)

Fix anv_extrypoints.{c,h} and anv_extensions.{c,h} missing dependencies
Rename the variable labels according to targets and python scripts
Align the building rules as per Automake for simplification

Fixes building errors during rebuils due to missing dependencies

(v2) Fixed a missing $(VULKAN_API_XML) reference

Fixes: 9a508b7 ("android: anv/extensions: fix generated sources build")
Fixes: dd088d4bec7 ("anv/extensions: Generate a header file with extension tables")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Cc: "19.0" <mesa-stable@lists.freedesktop.org>
5 years agost/wgl: init a variable to silence MinGW warning
Brian Paul [Sat, 2 Mar 2019 18:26:44 +0000 (11:26 -0700)]
st/wgl: init a variable to silence MinGW warning

MinGW release build says 'value' may be used before being initialized.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
5 years agosvga: silence array out of bounds warning
Brian Paul [Fri, 1 Mar 2019 20:56:18 +0000 (13:56 -0700)]
svga: silence array out of bounds warning

MinGW release build complains about a possible out-of-bounds
array access.  Test i < 4 to silence it.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
5 years agosvga: init fill variable to avoid compiler warning
Brian Paul [Fri, 1 Mar 2019 20:55:30 +0000 (13:55 -0700)]
svga: init fill variable to avoid compiler warning

MinGW release builds warns about use of a possbily uninitialized
variable here.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>