platform/upstream/mesa.git
3 years agonir/lower_io: Add a mode parameter to addr_format_is_*
Jason Ekstrand [Sat, 15 Aug 2020 05:39:00 +0000 (00:39 -0500)]
nir/lower_io: Add a mode parameter to addr_format_is_*

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/lower_io: Add a mode parameter to build_addr_iadd
Jason Ekstrand [Fri, 14 Aug 2020 23:20:12 +0000 (18:20 -0500)]
nir/lower_io: Add a mode parameter to build_addr_iadd

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/opt_deref: Add an optimization for deref_mode_is
Jason Ekstrand [Sat, 15 Aug 2020 16:14:20 +0000 (11:14 -0500)]
nir/opt_deref: Add an optimization for deref_mode_is

If opt_restrict_deref_modes makes progress, we may be able to figure out
the mode well enough to turn a deref_mode_is intrinsic into a constant.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/opt_deref: Add a deref mode specialization optimization
Jason Ekstrand [Sat, 15 Aug 2020 05:29:59 +0000 (00:29 -0500)]
nir/opt_deref: Add a deref mode specialization optimization

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agospirv: Add generic pointer support
Jason Ekstrand [Sat, 15 Aug 2020 04:41:14 +0000 (23:41 -0500)]
spirv: Add generic pointer support

Most of this is fairly straightforward; we just set all the modes on any
derefs which are generic.  The one tricky bit is OpGenericCastToPtrExplicit.
Instead of adding NIR intrinsics to do the cast, we add NIR intrinsics
to do a storage class check and then bcsel based on that.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir: Add support for generic pointers
Jason Ekstrand [Sat, 15 Aug 2020 05:28:55 +0000 (00:28 -0500)]
nir: Add support for generic pointers

The way they're handled is that deref->modes is treated as a bitfield of
possible modes.  Variables are required to have a specific mode and
derefs with deref_type_var are as well.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir: Make nir_deref_instr::mode a bitfield
Jason Ekstrand [Fri, 30 Oct 2020 17:14:05 +0000 (12:14 -0500)]
nir: Make nir_deref_instr::mode a bitfield

We rename it to "modes" to make it clear that it may contain more than
one mode and adjust all the uses of nir_deref_instr::modes to attempt to
handle multiple modes.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/split_*_vars: Prepare for generic pointers
Jason Ekstrand [Sun, 1 Nov 2020 23:49:36 +0000 (17:49 -0600)]
nir/split_*_vars: Prepare for generic pointers

All three passes check the variables for complex uses and don't split
them if they have any complex uses.  Most of these checks are just early
returns to avoid chasing the deref to the variable and a hash table
lookup if we can quickly determine it has the wrong mode.  In a couple
of cases, we need to re-arrange or add other checks to ensure that it's
safe for generic pointers.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/find_array_copies: Prepare for generic pointers
Jason Ekstrand [Sun, 1 Nov 2020 23:48:49 +0000 (17:48 -0600)]
nir/find_array_copies: Prepare for generic pointers

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir: Use nir_deref_mode_may_be in deref optimizations
Jason Ekstrand [Sun, 1 Nov 2020 23:46:56 +0000 (17:46 -0600)]
nir: Use nir_deref_mode_may_be in deref optimizations

All the checks being replaced are fore potential aliasing so we want to
flush stores whenever the mode might be something that aliases.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/vec3_to_vec4: Use nir_deref_must_be
Jason Ekstrand [Sun, 1 Nov 2020 23:45:26 +0000 (17:45 -0600)]
nir/vec3_to_vec4: Use nir_deref_must_be

We use the same nir_deref_mode_is_in_set helper that we use in
nir_lower_vars_to_explicit_types for the same reason.  If there are any
generic pointers in play, we have to lower all generic pointer modes at
the same time or else we risk types getting out-of-sync.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/vars_to_ssa: Use nir_deref_must_be
Jason Ekstrand [Sun, 1 Nov 2020 23:40:34 +0000 (17:40 -0600)]
nir/vars_to_ssa: Use nir_deref_must_be

We can only lower a deref to SSA in this pass if it's guaranteed to be
nir_var_function_temp.  We already flag any variables with complex uses
(i.e. casts) as not being lowerable and refuse to lower any derefs to
them so we don't have to worry about false negatives.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir: Only force loop unrolling if we know it's a in/out/temp
Jason Ekstrand [Sun, 1 Nov 2020 23:22:19 +0000 (17:22 -0600)]
nir: Only force loop unrolling if we know it's a in/out/temp

If we don't know the actual mode then we can't get to the variable so
it's going to be a scratch or other indirect load anyway and we aren't
saving ourselves anything by unrolling the loop.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/phis_to_scalar,gcm: Use nir_deref_mode_may_be
Jason Ekstrand [Sun, 1 Nov 2020 23:15:28 +0000 (17:15 -0600)]
nir/phis_to_scalar,gcm: Use nir_deref_mode_may_be

In both cases, we're trying to determine if a load is scalarizable.  We
don't want to scalarize if it's a function_temp or shader_temp because
it might turn into something we can't scalarize.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/lower_io: Use nir_deref_mode_* helpers
Jason Ekstrand [Sun, 1 Nov 2020 22:58:27 +0000 (16:58 -0600)]
nir/lower_io: Use nir_deref_mode_* helpers

For non-explicit nir_lower_io, we use nir_deref_mode_is because there's
no way it works for generic pointers.  For nir_lower_vars_to_explicit_types,
and nir_lower_explicit_io, we use nir_deref_mode_is_in_set to ensure we
never get type confusion.  For generic pointers, this means that they
must be called with the full set of generic pointer modes.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/lower_array_deref_of_vec: Use nir_deref_mode_must_be
Jason Ekstrand [Sun, 1 Nov 2020 22:55:25 +0000 (16:55 -0600)]
nir/lower_array_deref_of_vec: Use nir_deref_mode_must_be

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir: Add and use some deref mode helpers
Jason Ekstrand [Fri, 30 Oct 2020 17:19:25 +0000 (12:19 -0500)]
nir: Add and use some deref mode helpers

NIR derefs currently have exactly one variable mode.  This is about to
change so we can handle OpenCL generic pointers.  In order to transition
safely, we need to audit every deref->mode check.  This commit adds a
set of helpers that provide more nuanced mode checks and converts most
of NIR to use them.

For simple cases, we add nir_deref_mode_is and nir_deref_mode_is_one_of
helpers.  These can be used in passes which don't have to bother with
generic pointers and just want to know what mode a thing is.  If the
pass ever encounters generic pointers in a way that this check would be
unsafe, it will assert-fail to alert developers that they need to think
harder about things and fix the pass.

For more complex passes which require a more nuanced understanding of
modes, we add nir_deref_mode_may_be and nir_deref_mode_must_be helpers
which accurately describe the compiler's best knowledge about the given
deref.  Unfortunately, we may not be able to exactly identify the mode
in a generic pointers scenario so we have to be very careful when we use
these.  Conversion of these passes is left to later commits.

For the case of mass lowering of a particular mode (nir_lower_explicit_io
is one good example), we add nir_deref_mode_is_in_set.  This is also
pretty assert-happy like nir_deref_mode_is but is for a set containment
comparison on deref modes where you expect the deref to either be all-in
or all-out.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/opt_find_array_copies: Allow copies from mem_constant
Jason Ekstrand [Fri, 30 Oct 2020 20:07:47 +0000 (15:07 -0500)]
nir/opt_find_array_copies: Allow copies from mem_constant

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir: Disallow writes to system values and mem_constant
Jason Ekstrand [Fri, 30 Oct 2020 20:03:23 +0000 (15:03 -0500)]
nir: Disallow writes to system values and mem_constant

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir: Use var->data.mode instead of deref->mode in a few cases
Jason Ekstrand [Fri, 30 Oct 2020 17:30:09 +0000 (12:30 -0500)]
nir: Use var->data.mode instead of deref->mode in a few cases

We already have the variable so we know the mode exactly.  Just use that
instead of the deref mode.  If these paths ever have to handle variable
pointers (not likely since they're OpenGL-specific), we can fix them to
handle crazy deref modes then.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir: Handle incomplete derefs in split_struct_vars
Jason Ekstrand [Tue, 29 Sep 2020 15:30:52 +0000 (10:30 -0500)]
nir: Handle incomplete derefs in split_struct_vars

In split_var_list_structs where we initalize the splitting, we already
use get_complex_used_vars to avoid splitting any variables that have a
complex use.  However, we weren't actually handling the complex uses
properly in the case where we can't actually find the variable.

Fixes: f1cb3348f1 "nir/split_vars: Properly bail in the presence of ..."
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/phis_to_scalar: Use a deny-list for load_deref modes
Jason Ekstrand [Mon, 17 Aug 2020 17:06:56 +0000 (12:06 -0500)]
nir/phis_to_scalar: Use a deny-list for load_deref modes

I can't think of any reason why shared and output aren't in this list.
The real thing we're trying to do is avoid premature scalarization
because of a shader or function temporary variable because we might
lower it to something we don't want scalarized later.  Also fix the
version we copy+pasted into GCM.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agonir/builder: Add a nir_ieq_imm helper
Jason Ekstrand [Sat, 15 Aug 2020 05:11:27 +0000 (00:11 -0500)]
nir/builder: Add a nir_ieq_imm helper

This shows up surprisingly often.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>

3 years agolavapipe: don't advertise linear filtering on integer textures.
Dave Airlie [Tue, 3 Nov 2020 03:57:32 +0000 (13:57 +1000)]
lavapipe: don't advertise linear filtering on integer textures.

The backend doesn't support this.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agolavapipe: use clear_buffer callback
Dave Airlie [Tue, 3 Nov 2020 01:42:01 +0000 (11:42 +1000)]
lavapipe: use clear_buffer callback

llvmpipe needs the clear buffer callback for CL, make lavapipe
use it as well.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agollvmpipe: add clear_buffer callback. (v2)
Dave Airlie [Mon, 2 Nov 2020 07:13:48 +0000 (17:13 +1000)]
llvmpipe: add clear_buffer callback. (v2)

This fixes CL CTS thread dimensions test

v2: optimise for 1 and 4. (ajax)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agolavapipe: stop crashes with 3D z blits
Dave Airlie [Mon, 2 Nov 2020 01:33:36 +0000 (11:33 +1000)]
lavapipe: stop crashes with 3D z blits

This code just didn't handle 3D Z blits properly, rewrite
to handle change in direction here.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agolavapipe: fix 3d compressed texture copies.
Dave Airlie [Sun, 1 Nov 2020 23:42:59 +0000 (09:42 +1000)]
lavapipe: fix 3d compressed texture copies.

The img stride was being calculated incorrectly.

Fixes crashes in:
dEQP-VK.api.copy_and_blit.core.image_to_image.all_formats.color.3d.bc1_rgb_srgb_block.bc1_rgb_srgb_block.general_general

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agogallivm/nir: fix vulkan vertex inputs
Dave Airlie [Fri, 30 Oct 2020 03:48:55 +0000 (13:48 +1000)]
gallivm/nir: fix vulkan vertex inputs

the tgsi file max is used to determine the number of input slots,
the old code was pretty bogus for the lavapipe cases (it worked
by accident).

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agogallivm/nir: handle dvec3/4 inputs properly.
Dave Airlie [Fri, 30 Oct 2020 04:19:18 +0000 (14:19 +1000)]
gallivm/nir: handle dvec3/4 inputs properly.

This code works but isn't entirely correct, for a dvec3 it would
fetch loc 0,1 2,3 4,5 but really each loc only has 4 entries,
instead catch this and read loc 0,1 2,3 loc+1 0,1

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agolavapipe: fix dEQP-VK.info.device_properties
Dave Airlie [Wed, 30 Sep 2020 00:59:14 +0000 (10:59 +1000)]
lavapipe: fix dEQP-VK.info.device_properties

Fix bounds and widelines aren't supported for now.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agolavapipe: constify state pointers into command buffers.
Dave Airlie [Fri, 30 Oct 2020 03:33:45 +0000 (13:33 +1000)]
lavapipe: constify state pointers into command buffers.

for render pass information pointers into the command buffer are stored,
but command buffers are immutable content so make sure to use const ptrs
to avoid problems like was seen with clears.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agolavapipe: don't write to pending clear aspects in cmd buffer
Dave Airlie [Fri, 30 Oct 2020 03:31:26 +0000 (13:31 +1000)]
lavapipe: don't write to pending clear aspects in cmd buffer

When the cmd buffer is recorded, we record the attachments state
into it, however we use the pending clear aspects to keep track
of clears, but it should be kept in the state no overwrritten
in the cmd buffer.

Allocate some memory to store this hanging off the state.

This fixes gears and radialblur demos.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agogallivm: fix f16 quantize.
Dave Airlie [Fri, 23 Oct 2020 06:04:04 +0000 (16:04 +1000)]
gallivm: fix f16 quantize.

Add the correct flush to 0 behaviour.

Fixes:
dEQP-VK.spirv_assembly.instruction.compute.opquantize.flush_to_zero

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

3 years agor600: amend space check for chips older than EVERGREEN
Igor V. Kovalenko [Tue, 3 Nov 2020 06:19:06 +0000 (09:19 +0300)]
r600: amend space check for chips older than EVERGREEN

evergreen_emit_atomic_buffer_setup_count is only called if chip >= EVERGREEN
otherwise atomic_used_mask is left uninitialized when unconditionally used by
r600_need_cs_space so it might want more space than needed

fix this by always initializing atomic_used_mask

Fixes: 32529e60849 ("r600/eg: rework atomic counter emission with flushes")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7417>

3 years agozink: break up dynamic access lowering
Mike Blumenkrantz [Thu, 10 Sep 2020 14:21:42 +0000 (10:21 -0400)]
zink: break up dynamic access lowering

this is gross and slow, but to handle dominance properly, now we just load all
the ubos and bcsel away

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7199>

3 years agozink: add pass for lowering dynamic ubo/ssbo block indexing to constants
Mike Blumenkrantz [Wed, 29 Jul 2020 19:28:26 +0000 (15:28 -0400)]
zink: add pass for lowering dynamic ubo/ssbo block indexing to constants

spirv can't handle this, so instead we have to convert this into constant values
for any driver passing this sort of instruction through to vtn

eventually this will get removed in favor of using direct bo derefs

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7199>

3 years agomesa/st: Fix a use-after-free of the NIR shader stage.
Eric Anholt [Mon, 2 Nov 2020 18:11:11 +0000 (10:11 -0800)]
mesa/st: Fix a use-after-free of the NIR shader stage.

We just freed the NIR after turning it into TGSI, no using it in that last
switch statement.

Closes: #3725
Fixes: 57effa342b75 ("st/mesa: Drop the TGSI paths for PBOs and use nir-to-tgsi if needed.")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7407>

3 years agomesa/spirv: Lower variable initializers for global variables
Jason Ekstrand [Fri, 23 Oct 2020 19:00:49 +0000 (14:00 -0500)]
mesa/spirv: Lower variable initializers for global variables

We lower variable initializers for local variables higher up in the
function but we never called nir_lower_variable_initializers for
anything else.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7296>

3 years agozink: Added support for MacOS MoltenVK APIs.
Duncan Hopkins [Fri, 30 Oct 2020 10:01:42 +0000 (10:01 +0000)]
zink: Added support for MacOS MoltenVK APIs.

Detects the MoltenVK layer and extension.
If present, get the ext function pointers and use to enable full swizzeling suport.
Fixes issues with Swizzling behaviour fro MoltenVk is disabled by default and needed to be enable via this API.

This also supplied the ground work to allow IOSurfaces to be used later for surface passing.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7383>

3 years agozink: Basic framework to check for optional instance layers and instance extensions.
Duncan Hopkins [Fri, 30 Oct 2020 09:35:35 +0000 (09:35 +0000)]
zink: Basic framework to check for optional instance layers and instance extensions.

Needed for later optional instance level features.
Possible layer check are:
* device groups
* MoltenVK
* Debug validation without external hooks.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
WIP

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7383>

3 years agoradv,radv/winsys: Move RADV_MAX_IBS_PER_SUBMIT
James Park [Sun, 1 Nov 2020 07:04:42 +0000 (00:04 -0700)]
radv,radv/winsys: Move RADV_MAX_IBS_PER_SUBMIT

RADV_MAX_IBS_PER_SUBMIT needs to be defined even for the null driver.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7394>

3 years agodocs/features: add some extensions we missed
Anthoine Bourgeois [Tue, 28 Apr 2020 23:28:24 +0000 (01:28 +0200)]
docs/features: add some extensions we missed

Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4266>

3 years agodocs/features: VK_KHR_mir_surface is disabled, remove it
Anthoine Bourgeois [Tue, 28 Apr 2020 23:28:15 +0000 (01:28 +0200)]
docs/features: VK_KHR_mir_surface is disabled, remove it

Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4266>

3 years agodocs/features: Minor update extensions support
Anthoine Bourgeois [Tue, 28 Apr 2020 23:28:02 +0000 (01:28 +0200)]
docs/features: Minor update extensions support

Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4266>

3 years agonir/algebraic: better propagate constants up fadd chains
Rhys Perry [Fri, 19 Jun 2020 10:30:27 +0000 (11:30 +0100)]
nir/algebraic: better propagate constants up fadd chains

Make the optimization create more mad-friendly code if the order of the
fadd's operands is unlucky.

fossil-db (Navi):
Totals from 9259 (8.07% of 114665) affected shaders:
SGPRs: 615991 -> 616191 (+0.03%); split: -0.05%, +0.08%
VGPRs: 442184 -> 443568 (+0.31%); split: -0.10%, +0.41%
CodeSize: 32674876 -> 32625572 (-0.15%); split: -0.17%, +0.02%
MaxWaves: 108560 -> 108152 (-0.38%); split: +0.07%, -0.44%
Instrs: 6126473 -> 6120463 (-0.10%); split: -0.13%, +0.03%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5631>

3 years agospirv: reverse order in matrix multiplication
Rhys Perry [Wed, 17 Jun 2020 12:44:40 +0000 (13:44 +0100)]
spirv: reverse order in matrix multiplication

This will create code that is easier to combine into MADs/FMA when the
last component of the vector is 1.0.

nir_opt_algebraic_late has an optimization to do something similar but it
only works for inexact code, if the multiplication-by-1 optimization is
done before it and if the backend enables fuse_ffma.

fossil-db (Navi):
Totals from 4296 (3.75% of 114665) affected shaders:
SGPRs: 283468 -> 283764 (+0.10%); split: -0.02%, +0.12%
VGPRs: 172868 -> 172904 (+0.02%); split: -0.09%, +0.11%
CodeSize: 14045312 -> 14027128 (-0.13%); split: -0.15%, +0.02%
MaxWaves: 59285 -> 59282 (-0.01%); split: +0.04%, -0.05%
Instrs: 2703507 -> 2683187 (-0.75%); split: -0.76%, +0.00%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5631>

3 years agonir: scalarize fdot in reverse
Rhys Perry [Tue, 16 Jun 2020 15:04:09 +0000 (16:04 +0100)]
nir: scalarize fdot in reverse

This will create code that is easier to combine into MADs/FMA when the
last component is 1.0.

nir_opt_algebraic_late has an optimization to do something similar but it
only works for inexact code, if the multiplication-by-1 optimization is
done before it and if the backend enables fuse_ffma.

fossil-db (Navi):
Totals from 85583 (74.64% of 114665) affected shaders:
SGPRs: 4556060 -> 4558596 (+0.06%); split: -0.07%, +0.12%
VGPRs: 3315060 -> 3312984 (-0.06%); split: -0.23%, +0.17%
SpillSGPRs: 13552 -> 13553 (+0.01%)
CodeSize: 184962756 -> 184431388 (-0.29%); split: -0.32%, +0.03%
MaxWaves: 1208693 -> 1209361 (+0.06%); split: +0.17%, -0.11%
Instrs: 35678819 -> 35361617 (-0.89%); split: -0.91%, +0.02%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5631>

3 years agopanfrost: Set .array_size on Bifrost
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:23:55 +0000 (08:23 -0500)]
panfrost: Set .array_size on Bifrost

Fixes dEQP-GLES2.functional.texture.mipmap.cube.generate.rgba8888_nicest

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Don't emit TEXS for array textures
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:23:32 +0000 (08:23 -0500)]
pan/bi: Don't emit TEXS for array textures

No place for the extra coordinate.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Handle 3D/array coordinates
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:23:22 +0000 (08:23 -0500)]
pan/bi: Handle 3D/array coordinates

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Track tex data register swizzles
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:23:01 +0000 (08:23 -0500)]
pan/bi: Track tex data register swizzles

So we can pass through a .z component.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Add bi_emit_array_index helper
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:22:42 +0000 (08:22 -0500)]
panfrost: Add bi_emit_array_index helper

Need to handle type conversion.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Drop unused swizzles
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:21:12 +0000 (08:21 -0500)]
panfrost: Drop unused swizzles

Missed during format cleanup.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Advertise Bifrost support
Alyssa Rosenzweig [Sun, 1 Nov 2020 14:11:09 +0000 (09:11 -0500)]
panfrost: Advertise Bifrost support

Drop the PAN_MESA_DEBUG=bifrost flag. Load on Bifrost chips by default.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Disable point sprites on Bifrost
Alyssa Rosenzweig [Sat, 31 Oct 2020 14:25:07 +0000 (10:25 -0400)]
panfrost: Disable point sprites on Bifrost

It doesn't look like the lowering in !6473 will land before the branch
point. Let's nop out point sprites in the backend to avoid MMU faults
from creating invalid Midgard-style varyings.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Lower +CUBEFACE2
Alyssa Rosenzweig [Mon, 2 Nov 2020 19:02:06 +0000 (14:02 -0500)]
pan/bi: Lower +CUBEFACE2

We need to inject a *CUBEFACE1 at pack-time so everything works out.
This is a pretty ugly hack but it'll hold us over until we have a real
scheduler, at which point it won't be necessary at all.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Suppress disassembly for internal shaders
Alyssa Rosenzweig [Mon, 2 Nov 2020 18:41:13 +0000 (13:41 -0500)]
pan/bi: Suppress disassembly for internal shaders

Backport of 756441b2979c2664aaa13a67dbdaf5b7e853286e for bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Lower cube map coordinates
Boris Brezillon [Mon, 2 Nov 2020 18:33:55 +0000 (13:33 -0500)]
pan/bi: Lower cube map coordinates

We need to do the transform specified in the OpenGL spec ourselves, with
some assistance from the hardware.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Hook up cube instructions packing
Boris Brezillon [Wed, 28 Oct 2020 12:27:38 +0000 (13:27 +0100)]
pan/bi: Hook up cube instructions packing

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Split special class in two
Boris Brezillon [Wed, 28 Oct 2020 12:27:07 +0000 (13:27 +0100)]
pan/bi: Split special class in two

Some special instructions are scheduled on the FMA unit, let's add a
new class for this case and rename the old one accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Move special instruction packing to a separate helper
Boris Brezillon [Wed, 28 Oct 2020 07:56:20 +0000 (08:56 +0100)]
pan/bi: Move special instruction packing to a separate helper

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: s/t0/t1/ in bi_disasm_dest_add()
Boris Brezillon [Wed, 28 Oct 2020 08:21:05 +0000 (09:21 +0100)]
pan/bi: s/t0/t1/ in bi_disasm_dest_add()

The ADD unit stores its result in t1 not t0.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Implement v7 texture payloads
Boris Brezillon [Mon, 2 Nov 2020 18:19:23 +0000 (13:19 -0500)]
panfrost: Implement v7 texture payloads

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Add array size to XML
Boris Brezillon [Mon, 2 Nov 2020 18:19:02 +0000 (13:19 -0500)]
panfrost: Add array size to XML

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Suppress Bifrost prefetching
Boris Brezillon [Mon, 2 Nov 2020 18:16:37 +0000 (13:16 -0500)]
panfrost: Suppress Bifrost prefetching

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Leave push_constants pointer to NULL if there's no uniform
Boris Brezillon [Wed, 28 Oct 2020 08:09:06 +0000 (09:09 +0100)]
panfrost: Leave push_constants pointer to NULL if there's no uniform

This removes a warning in pandecode.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agomesa: do not throw _mesa_problem when invalid enum is used
Tapani Pälli [Mon, 2 Nov 2020 09:17:56 +0000 (11:17 +0200)]
mesa: do not throw _mesa_problem when invalid enum is used

Like with other getters, invalid enum is dealt in find_value by setting
error to GL_INVALID_ENUM and returning INVALID_TYPE which makes
get_value_size return 0.

Fixes false 'implementation errors' seen with Piglit test:
   ext_external_objects-memory-object-api-errors

   "Mesa 20.3.0-devel implementation error: invalid value type in GetUnsignedBytei_vEXT()
   Please report at https://gitlab.freedesktop.org/mesa/mesa/-/issues"

v2: add assert to get_value_size() (Lionel)

Fixes: e064d660205 ("mesa: implement glGetUnsignedByte{v|i_v}")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7403>

3 years agomesa/st: call memobj_destroy only if there is memory imported
Tapani Pälli [Mon, 26 Oct 2020 18:51:25 +0000 (20:51 +0200)]
mesa/st: call memobj_destroy only if there is memory imported

Something may go wrong during import which leaves pointer to null and
when ctx and it's shared state gets destroyed we will attempt to call
memobj_destroy. Instead of forcing every driver to handle it, add check
here.

Fixes crashes with Piglit test:
   ext_external_objects_fd-memory-object-api-errors

Fixes: 99cf9108340 ("mesa/st: Actually free the driver part of memory objects on destruction.")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7403>

3 years agoaco: select v_mul_{hi}_u32_u24 for 24-bit multiplications
Samuel Pitoiset [Mon, 2 Nov 2020 13:29:26 +0000 (14:29 +0100)]
aco: select v_mul_{hi}_u32_u24 for 24-bit multiplications

This is based on the NIR range analysis. v_mul_u32_u24 is VOP2, while
v_mul_lo_u32 is VOP3, so that should reduce codesize.

fossils-db (Vega10):
Totals from 12590 (9.22% of 136546) affected shaders:
SGPRs: 680207 -> 677271 (-0.43%); split: -0.47%, +0.04%
VGPRs: 620840 -> 620856 (+0.00%); split: -0.02%, +0.02%
CodeSize: 37930200 -> 37774088 (-0.41%); split: -0.41%, +0.00%
Instrs: 7463550 -> 7458120 (-0.07%); split: -0.07%, +0.00%
Cycles: 133487628 -> 133427532 (-0.05%); split: -0.05%, +0.00%
VMEM: 2514729 -> 2513426 (-0.05%); split: +0.02%, -0.08%
SMEM: 1533579 -> 1532795 (-0.05%); split: +0.05%, -0.10%
VClause: 231391 -> 231389 (-0.00%); split: -0.01%, +0.00%
SClause: 255352 -> 255294 (-0.02%); split: -0.04%, +0.02%
Copies: 605821 -> 600352 (-0.90%); split: -0.92%, +0.02%
Branches: 133739 -> 133743 (+0.00%); split: -0.00%, +0.00%
PreSGPRs: 351092 -> 348048 (-0.87%)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7405>

3 years agoaco: store NIR range analysis data to the isel context
Samuel Pitoiset [Mon, 2 Nov 2020 13:01:38 +0000 (14:01 +0100)]
aco: store NIR range analysis data to the isel context

It will be used to optimize some ALU instructions.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7405>

3 years agozink: clamped maxPerStageDescriptorUniformBuffers limits to INT_MAX when stored as...
Duncan Hopkins [Tue, 9 Apr 2019 16:22:53 +0000 (17:22 +0100)]
zink: clamped maxPerStageDescriptorUniformBuffers limits to INT_MAX when stored as uint32_t.

This stops issues if a driver returns a value that is greater than a signed int.
Also make it match many of the other limit versions conversions.
Seen on Radeon drivers, IIRC. gpuinfo.org also reports many GPUs returning 4GB values.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Erik Faye-Lund <erik.faye-lund@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7402>

3 years agoradv: fix shader caching with NaN fixup workaround
Rhys Perry [Tue, 3 Nov 2020 10:55:14 +0000 (10:55 +0000)]
radv: fix shader caching with NaN fixup workaround

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 6f21995f986 ("radv: add new drirc option radv_enable_mrt_output_nan_fixup")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7423>

3 years agoradv: fix shader caching with discard->demote workaround
Rhys Perry [Tue, 3 Nov 2020 10:54:59 +0000 (10:54 +0000)]
radv: fix shader caching with discard->demote workaround

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: bdd75874144 ("radv: use nir_lower_discard_to_demote to work around game bugs")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7423>

3 years agoradv: add some missing radv_{start,stop}_feedback
Rhys Perry [Tue, 27 Oct 2020 14:26:40 +0000 (14:26 +0000)]
radv: add some missing radv_{start,stop}_feedback

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7339>

3 years agoandroid: freedreno: Add freedreno_dev_info.[ch] to Makefile.sources
Marijn Suijten [Mon, 2 Nov 2020 22:13:24 +0000 (23:13 +0100)]
android: freedreno: Add freedreno_dev_info.[ch] to Makefile.sources

Addresses the following linker error when building for Android:

    ld.lld: error: undefined symbol: freedreno_dev_info_init
    >>> referenced by freedreno_screen.c:1001 (external/mesa3d/src/gallium/drivers/freedreno/freedreno_screen.c:1001)
    >>>               freedreno_screen.o:(fd_screen_create) in archive [..]/libmesa_pipe_freedreno_intermediates/libmesa_pipe_freedreno.a

These functions were introduced in a file that was not included in the
Android build yet.  Also sort the list of files alphabetically as
requested in an earlier MR.

Fixes: 4a0bdf47e43 ("freedreno: Introduce common device info struct")
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7411>

3 years agobroadcom/compiler: remove v3d_fs_key depth_enabled field.
Alejandro Piñeiro [Mon, 2 Nov 2020 22:37:54 +0000 (23:37 +0100)]
broadcom/compiler: remove v3d_fs_key depth_enabled field.

It is not used right now, so keeping it adds some noise/confusion.

So far configuring Z test are done through the CFG_BITS. See
v3dX(emit_state) at v3dx_emit.c for v3d, and pack_cfg_bits at
v3dv_pipeline.c for v3dv. There flags like z_updates_enable and others
are filled up.

That key field seems like a leftover coming from using vc4 as
reference, as that driver defines and uses a field with name name.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7421>

3 years agointel/compiler: remove branch weight heuristic
Marcin Ślusarz [Wed, 14 Oct 2020 14:32:55 +0000 (16:32 +0200)]
intel/compiler: remove branch weight heuristic

As a result of this patch, compiler chooses SIMD32 shaders more
frequently.

Current logic is designed to avoid regressions from enabling SIMD32 at
all cost, even though the cases where regression can happen are probably
for smaller draw calls (far away from the camera and though smaller).

In Intel perf CI this patch improves FPS in:
- gfxbench5 alu2:      21.92% (gen9), 23.7%  (gen11)
- synmark OglShMapVsm:  3.26% (gen9),  4.52% (gen11)
- gfxbench5 car chase:  1.34% (gen9),  1.32% (gen11)
No observed regressions there.

In my testing, it also improves FPS in:
- The Talos Principle:   2.9% (gen9)

The other 16 games I tested had very minor changes in performance
(2/3 positive, but not significant enough to list here).

Note: this patch harms synmark OglDrvState (which is not in Intel perf
CI) by ~2.9%, but this benchmark renders multiple scenes from other
workloads (including OglShMapVsm, which is helped in standalone mode)
in tiny rectangles. Rendering so small drastically changes branching
statistics, which favors smaller SIMD modes. I assume this matters
only in micro-benchmarks, as in real workloads more expensive (with
more uniform branching behavior) draw calls dominate.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Acked-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7137>

3 years agointel/compiler: use C++ template instead of preprocessor
Marcin Ślusarz [Thu, 29 Oct 2020 19:13:50 +0000 (20:13 +0100)]
intel/compiler: use C++ template instead of preprocessor

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7382>

3 years agoRevert "gallium/dri: fix dri2_from_planar for multiplanar images"
Lucas Stach [Sat, 31 Oct 2020 07:21:15 +0000 (08:21 +0100)]
Revert "gallium/dri: fix dri2_from_planar for multiplanar images"

It breaks some assumptions in the iris driver, leading to crashes.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7391>

3 years agotu: Support rasterizerDiscardEnable and RasterizationStreamSelect
Connor Abbott [Wed, 23 Sep 2020 11:36:58 +0000 (13:36 +0200)]
tu: Support rasterizerDiscardEnable and RasterizationStreamSelect

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>

3 years agotu: Support geometryStreams
Connor Abbott [Wed, 23 Sep 2020 11:08:37 +0000 (13:08 +0200)]
tu: Support geometryStreams

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>

3 years agoutil/bitset: Add a range iterator helper
Connor Abbott [Wed, 23 Sep 2020 11:06:04 +0000 (13:06 +0200)]
util/bitset: Add a range iterator helper

I need this for emitting the SO program for turnip, where we want to
skip over unused slots by manually advancing the counter. freedreno will
also want to use it when it supports multistream streamout.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>

3 years agoir3: Support geometry streams
Connor Abbott [Wed, 23 Sep 2020 09:29:28 +0000 (11:29 +0200)]
ir3: Support geometry streams

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>

3 years agofreedreno/a6xx: Update SO registers for streams
Connor Abbott [Wed, 23 Sep 2020 08:51:48 +0000 (10:51 +0200)]
freedreno/a6xx: Update SO registers for streams

These seem to be unchanged from a5xx, so a5xx could probably be updated
too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>

3 years agozink: add VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA for WSI allocations
Iago Toral Quiroga [Fri, 30 Oct 2020 09:44:17 +0000 (10:44 +0100)]
zink: add VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA for WSI allocations

Since Zink doesn't use swapchains to create presentable images, drivers
lose the capacity to identify memory allocations for them, which is a problem
when the underlying platform has special requirements for these, such as
needing to allocate them on a particular device. Including this struct in the
pNext chain, which is the same thing that the Mesa Vulkan WSI code does when
allocating memory for swapchain images, gives drivers a chance to identify
and handle these memory allocations properly.

v2: follow Zink's conventions for pNext chains (Mike)
v3: add scanout parameter for VkImage creation (Daniel)
v4: don't add a dependency on vulkan util (Erik)
v5: include vulkan directory for Zink builds

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> (v2)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7378>

3 years agoetnaviv: move etna_destroy_shader(..) to generic location
Christian Gmeiner [Fri, 30 Oct 2020 18:31:54 +0000 (19:31 +0100)]
etnaviv: move etna_destroy_shader(..) to generic location

Before this change we had two identical etna_destroy_shader
functions - one for tgsi and one for nir.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7397>

3 years agoetnaviv: move etna_dump_shader(..) to generic location
Christian Gmeiner [Fri, 30 Oct 2020 18:26:00 +0000 (19:26 +0100)]
etnaviv: move etna_dump_shader(..) to generic location

Before this change we had two identical etna_dump_shader
functions - one for tgsi and one for nir.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7397>

3 years agoetnaviv: convert from tgsi semantic/index to varying-slot
Christian Gmeiner [Fri, 30 Oct 2020 18:19:31 +0000 (19:19 +0100)]
etnaviv: convert from tgsi semantic/index to varying-slot

Prep work to unify some tgsi and nir compiler functions.
No deqp and piglit regressions.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7397>

3 years agonir: make tgsi_varying_semantic_to_slot(..) public
Christian Gmeiner [Mon, 2 Nov 2020 12:12:11 +0000 (13:12 +0100)]
nir: make tgsi_varying_semantic_to_slot(..) public

I want to use this function for etnaviv's TGSI compiler.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7397>

3 years agoamd/llvm,aco: Replace VLA with alloca
James Park [Tue, 11 Aug 2020 04:00:51 +0000 (21:00 -0700)]
amd/llvm,aco: Replace VLA with alloca

MSVC will never support VLA, so use alloca instead.

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7157>

3 years agozink: require Vulkan timestamp queries for time query caps
Iago Toral Quiroga [Thu, 29 Oct 2020 10:54:28 +0000 (11:54 +0100)]
zink: require Vulkan timestamp queries for time query caps

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7374>

3 years agotgsi: Initialize tgsi_declaration_dimension padding.
Vinson Lee [Sat, 24 Oct 2020 00:51:47 +0000 (17:51 -0700)]
tgsi: Initialize tgsi_declaration_dimension padding.

Silence this Coverity defect.

Uninitialized scalar variable (UNINIT)
uninit_use: Using uninitialized value dim. Field dim.Padding is uninitialized.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7300>

3 years agogallium: Remove duplicate resource variable.
Vinson Lee [Tue, 27 Oct 2020 02:55:07 +0000 (19:55 -0700)]
gallium: Remove duplicate resource variable.

Fix defect reported by Coverity Scan.

Evaluation order violation (EVALUATION_ORDER)
write_write_typo: In resource = resource =
ntt_ureg_src_indirect(c, ureg_src_register(TGSI_FILE_IMAGE, 0U),
instr->src[0]), resource is written twice with the same value.

Fixes: 34cc6a804ec9 ("gallium: Add a nir-to-TGSI pass.")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7326>

3 years agonir/validate: Explain why we don't use nir_foreach_block
Jason Ekstrand [Mon, 2 Nov 2020 20:28:01 +0000 (14:28 -0600)]
nir/validate: Explain why we don't use nir_foreach_block

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7409>

3 years agozink: always reset query pools on next query begin
Mike Blumenkrantz [Thu, 10 Sep 2020 20:07:45 +0000 (16:07 -0400)]
zink: always reset query pools on next query begin

this ensures we pull in any flushes that are about to happen if we're
ending the query during a batch flush, which helps us roll over our pending
results

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7195>

3 years agozink: always use query->type for starting/stopping xfb queries
Mike Blumenkrantz [Thu, 20 Aug 2020 14:26:57 +0000 (10:26 -0400)]
zink: always use query->type for starting/stopping xfb queries

we're going to be seeing some overlap here

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7195>

3 years agozink: rework query overflow handling
Mike Blumenkrantz [Tue, 18 Aug 2020 13:07:37 +0000 (09:07 -0400)]
zink: rework query overflow handling

this adds a query field to denote the last point at which a query was api started,
which is then used every time we call in to get_query_result as the starting point

this is important when we want to be able to return the same result set multiple
times

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7195>

3 years agozink: fixup gs/xfb tracking for primitives generated queries
Mike Blumenkrantz [Mon, 17 Aug 2020 17:53:31 +0000 (13:53 -0400)]
zink: fixup gs/xfb tracking for primitives generated queries

need to index by query id here to ensure correct usage

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7195>

3 years agozink: store batch id onto query object at time of start
Mike Blumenkrantz [Mon, 17 Aug 2020 14:58:08 +0000 (10:58 -0400)]
zink: store batch id onto query object at time of start

this is useful for knowing immediately whether a query has results available

for time queries, this ends up being end_query() since that's when the timestamp
is written

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7195>