platform/upstream/mesa.git
4 years agointel/compiler: quiet Coverity warnings
Marcin Ślusarz [Wed, 9 Sep 2020 17:01:49 +0000 (19:01 +0200)]
intel/compiler: quiet Coverity warnings

Coverity complains about possible out-of-bounds write & read, because
it thinks that "loc + i" can be bigger than sizes of the 2 used arrays.

It's not obvious from the code it cannot happen, so add asserts here.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

4 years agointel/tools: handle ftell errors
Marcin Ślusarz [Wed, 9 Sep 2020 16:48:16 +0000 (18:48 +0200)]
intel/tools: handle ftell errors

Found by Coverity, as "argument cannot be negative", referring to
fread's 2nd argument.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

4 years agointel/tools: fix possible memory leak in the error path
Marcin Ślusarz [Wed, 9 Sep 2020 16:45:08 +0000 (18:45 +0200)]
intel/tools: fix possible memory leak in the error path

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

4 years agointel/compiler: initialize remaining fields of various classes
Marcin Ślusarz [Wed, 9 Sep 2020 16:13:43 +0000 (18:13 +0200)]
intel/compiler: initialize remaining fields of various classes

These variables seem to be initialized before being used, so this
patch is not fixing any bug, but leaving them unitialized may become
a bug after some refactoring.

These classes were affected: fs_reg_alloc, fs_visitor, fs_generator,
instruction_scheduler.

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

4 years agointel/compiler: remove unused fs_validator::param_size
Marcin Ślusarz [Wed, 9 Sep 2020 16:26:56 +0000 (18:26 +0200)]
intel/compiler: remove unused fs_validator::param_size

Found by Coverity as unitialized variable.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

4 years agoanv: fix minor gen_ioctl(I915_PERF_IOCTL_CONFIG) error handling issue
Marcin Ślusarz [Wed, 9 Sep 2020 15:59:41 +0000 (17:59 +0200)]
anv: fix minor gen_ioctl(I915_PERF_IOCTL_CONFIG) error handling issue

Found by Coverity.

Fixes: 2001a80d4a8 ("anv: Implement VK_KHR_performance_query")
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

4 years agodriconf: add option to reuse GL names
Pierre-Eric Pelloux-Prayer [Mon, 17 Aug 2020 14:20:17 +0000 (16:20 +0200)]
driconf: add option to reuse GL names

Fix apps expecting name recycling.
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3144 is an example
of such issue, SPECviewperf13 has this problem too.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

4 years agomesa: use _mesa_HashFindFreeKeys for GL functions
Pierre-Eric Pelloux-Prayer [Mon, 17 Aug 2020 13:12:03 +0000 (15:12 +0200)]
mesa: use _mesa_HashFindFreeKeys for GL functions

This allows to implement name reuse if we want to.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

4 years agomesa: add _mesa_HashFindFreeKeys
Pierre-Eric Pelloux-Prayer [Mon, 17 Aug 2020 13:10:31 +0000 (15:10 +0200)]
mesa: add _mesa_HashFindFreeKeys

_mesa_HashFindFreeKeyBlock function returns a name range, so it cannot be
used to recycle non-consecutive names.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

4 years agomesa: add GL name reuse support
Pierre-Eric Pelloux-Prayer [Mon, 17 Aug 2020 14:18:50 +0000 (16:18 +0200)]
mesa: add GL name reuse support

This will allow drivers to adopt the behavior of proprietary drivers that seem
to return the lowest available name (while Mesa returns max_seen_name + 1).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

4 years agomesa: add a isGenName parameter to _mesa_HashInsert
Pierre-Eric Pelloux-Prayer [Fri, 4 Sep 2020 12:07:04 +0000 (14:07 +0200)]
mesa: add a isGenName parameter to _mesa_HashInsert

Indicates if the given name has been returned by _mesa_HashFindFreeKeyBlock.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

4 years agoutil/idalloc: add lowest_free_idx to avoid iterating from 0
Pierre-Eric Pelloux-Prayer [Mon, 7 Sep 2020 13:15:50 +0000 (15:15 +0200)]
util/idalloc: add lowest_free_idx to avoid iterating from 0

lowest_free_idx is a conservative estimation of the lowest index
where a free id can be found.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

4 years agoutil/idalloc: add util_idalloc_reserve
Pierre-Eric Pelloux-Prayer [Mon, 7 Sep 2020 12:47:47 +0000 (14:47 +0200)]
util/idalloc: add util_idalloc_reserve

Can be used to mark an id as used (if it was reclaimed without using
util_idalloc_alloc).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

4 years agomesa: move u_idalloc from gallium/aux/util to util
Pierre-Eric Pelloux-Prayer [Tue, 8 Sep 2020 18:41:14 +0000 (20:41 +0200)]
mesa: move u_idalloc from gallium/aux/util to util

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

4 years agofreedreno/a6xx: Fix MSAA clear
Rob Clark [Tue, 8 Sep 2020 16:12:23 +0000 (09:12 -0700)]
freedreno/a6xx: Fix MSAA clear

We need to do MSAA clear on the 3d pipe, it seems to not work out
properly on 2d pipe (at least for 4x MSAA and heights that are not
multiple of 16).

This matches what blob and tu seem to do.  Fixes the following with
DEQP_CONFIG=rgba8888d24s8ms4

dEQP-GLES31.functional.primitive_bounding_box.depth.builtin_depth.per_primitive_bbox_equal
dEQP-GLES31.functional.primitive_bounding_box.depth.builtin_depth.per_primitive_bbox_larger
dEQP-GLES31.functional.primitive_bounding_box.depth.user_defined_depth.per_primitive_bbox_equal
dEQP-GLES31.functional.primitive_bounding_box.depth.user_defined_depth.per_primitive_bbox_larger

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

4 years agofreedreno: Clear gs/tcs/tes state for clear blits
Rob Clark [Wed, 9 Sep 2020 21:03:43 +0000 (14:03 -0700)]
freedreno: Clear gs/tcs/tes state for clear blits

Otherwise we could emit a clear blit that is trying to use some random
GS stage, which doesn't go well.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

4 years agofreedreno/a6xx: Fix fd6_draw_vbo() return
Rob Clark [Wed, 9 Sep 2020 21:03:15 +0000 (14:03 -0700)]
freedreno/a6xx: Fix fd6_draw_vbo() return

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

4 years agofreedreno/a6xx: Skip empty tile_setup
Rob Clark [Wed, 9 Sep 2020 16:08:02 +0000 (09:08 -0700)]
freedreno/a6xx: Skip empty tile_setup

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

4 years agofreedreno: Don't bypass fd_draw_vbo() in clear fallback
Rob Clark [Tue, 8 Sep 2020 23:27:54 +0000 (16:27 -0700)]
freedreno: Don't bypass fd_draw_vbo() in clear fallback

Otherwise we bypass all the resource-usage tacking.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

4 years agofreedreno: Fix rast state for multisample clear
Rob Clark [Tue, 8 Sep 2020 21:56:55 +0000 (14:56 -0700)]
freedreno: Fix rast state for multisample clear

a6xx in particular cares about the multisample bit.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

4 years agogallivm: disable brilinear for lod bias and explicit lod.
Dave Airlie [Mon, 7 Sep 2020 19:37:36 +0000 (05:37 +1000)]
gallivm: disable brilinear for lod bias and explicit lod.

This allows GL 4.5 CTS to pass in full with no flags, other than
that I'm not sure if it's a good or bad idea.

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

4 years agofreedreno/fdl: Add layout test for the Android CTS's MSAA mustpass surface.
Eric Anholt [Thu, 3 Sep 2020 20:11:37 +0000 (13:11 -0700)]
freedreno/fdl: Add layout test for the Android CTS's MSAA mustpass surface.

Rob had a question of if we were laying things out the same as the blob.
This doesn't detect any difference in our layout, though.

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

4 years agofreedreno/cffdec: Add support for texturator's 2DMS layout setup.
Eric Anholt [Thu, 3 Sep 2020 20:04:29 +0000 (13:04 -0700)]
freedreno/cffdec: Add support for texturator's 2DMS layout setup.

We can't initialize our MSAA texture with glTexImage2D(), so we have to do
a draw to get its slice's layout into the cmdstream.

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

4 years agofreedreno/cffdec: Fix up texturator parsing scripts for XML changes.
Eric Anholt [Thu, 3 Sep 2020 18:24:01 +0000 (11:24 -0700)]
freedreno/cffdec: Fix up texturator parsing scripts for XML changes.

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

4 years agofreedreno: Add another new sysmem flake.
Eric Anholt [Wed, 9 Sep 2020 20:10:05 +0000 (13:10 -0700)]
freedreno: Add another new sysmem flake.

This one blocked a marge merge a few minutes ago.

Fixes: b4317fccdd7f ("ci/bare-metal: Update the kernel to msm-next-pgtables")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6670>

4 years agospirv: Initialize spirv_test member shader.
Vinson Lee [Mon, 7 Sep 2020 23:44:07 +0000 (16:44 -0700)]
spirv: Initialize spirv_test member shader.

Fix defect reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member shader is not initialized in this
constructor nor in any functions that it calls

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6640>

4 years agosvga: Fix unused printf argument.
Vinson Lee [Tue, 8 Sep 2020 02:31:38 +0000 (19:31 -0700)]
svga: Fix unused printf argument.

Fix defect reported by Coverity Scan.

Extra argument to printf format specifier (PRINTF_ARGS)
extra_argument: This argument was not used by the format string:
info->num_outputs.

Fixes: ccb4ea5a43e8 ("svga: Add GL4.1(compatibility profile) support in svga driver")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6644>

4 years agofreedreno: Fix file descriptor leak.
Vinson Lee [Tue, 8 Sep 2020 00:23:35 +0000 (17:23 -0700)]
freedreno: Fix file descriptor leak.

Fix defects reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_handle: Handle variable fd going out of scope leaks the handle.

Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: fd is passed to a parameter that cannot be negative.

Fixes: 1ea4ef0d3be8 ("freedreno: slurp in decode tools")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6642>

4 years agopan/mdg: Fix spilling of non-32-bit types
Icecream95 [Wed, 9 Sep 2020 06:22:00 +0000 (18:22 +1200)]
pan/mdg: Fix spilling of non-32-bit types

The source argument for mov has index 1, not 0.

Fixes a vertex shader in SuperTuxKart.

Fixes: b4de9e035ac ("pan/mdg: Mask spills from texture write")
Reported-by: macc24
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>~
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6659>

4 years agonir: More NIR_MAX_VEC_COMPONENTS fixes
Jesse Natalie [Wed, 9 Sep 2020 00:56:54 +0000 (17:56 -0700)]
nir: More NIR_MAX_VEC_COMPONENTS fixes

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6655>

4 years agonir/idiv_const: Use the modern nir_src_as_* constant helpers
Jason Ekstrand [Tue, 8 Sep 2020 23:37:05 +0000 (18:37 -0500)]
nir/idiv_const: Use the modern nir_src_as_* constant helpers

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

4 years agonir: More NIR_MAX_VEC_COMPONENTS fixes
Jason Ekstrand [Tue, 8 Sep 2020 23:36:47 +0000 (18:36 -0500)]
nir: More NIR_MAX_VEC_COMPONENTS fixes

A couple of these probably aren't strictly necessary but they won't
hurt.  The one that's particularly tricky is a fixed-length array in
nir_search.h.  However, to avoid blowing up the binary size of
nir_opt_algebraic by about 2x, we just assert that only small ops are
used.

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

4 years agoiris: Support I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS
Nanley Chery [Mon, 9 Sep 2019 23:01:13 +0000 (16:01 -0700)]
iris: Support I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agoiris: Support MC modifier in plane count queries
Nanley Chery [Wed, 15 Apr 2020 23:47:46 +0000 (16:47 -0700)]
iris: Support MC modifier in plane count queries

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agointel/common: Drop unused gen_aux_map_add_image
Nanley Chery [Mon, 27 Jul 2020 18:52:59 +0000 (11:52 -0700)]
intel/common: Drop unused gen_aux_map_add_image

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agoiris: Support planar resource imports for MC
Nanley Chery [Thu, 23 Jul 2020 15:52:46 +0000 (08:52 -0700)]
iris: Support planar resource imports for MC

Support importing and mapping multiple planes of aux data for
I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agointel/common: Add get_aux_map_format_bits()
Nanley Chery [Wed, 20 Nov 2019 00:05:38 +0000 (16:05 -0800)]
intel/common: Add get_aux_map_format_bits()

Add a function suitable for planar YUV surfaces. For these surfaces,
drivers remap each plane to an RGB-formatted surface. Enable drivers to
pass the plane index and the original YUV format to get the right
aux-map format bits.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agost/mesa: Don't map all P01X DRM formats to P016
Nanley Chery [Fri, 31 Jul 2020 00:39:26 +0000 (17:39 -0700)]
st/mesa: Don't map all P01X DRM formats to P016

Allow gallium drivers to distinguish between the P010, P012, and P016
DRM formats.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agointel/isl: Add YUV format info for the aux-map
Nanley Chery [Thu, 23 Jul 2020 23:09:59 +0000 (16:09 -0700)]
intel/isl: Add YUV format info for the aux-map

* Define ISL equivalents for the P010, P012, and P016 formats.
* Add aux-map encodings for the YUV formats iris will soon support.

v2. Replace &&'s with ||'s in isl_format_is_planar() (Lionel)

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agointel/isl: Support ISL_AUX_USAGE_MC in surface states
Nanley Chery [Mon, 9 Sep 2019 23:11:13 +0000 (16:11 -0700)]
intel/isl: Support ISL_AUX_USAGE_MC in surface states

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agointel/isl: Describe I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS
Nanley Chery [Tue, 19 Mar 2019 21:11:34 +0000 (14:11 -0700)]
intel/isl: Describe I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agogallium/dri2: Support I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS import
Nanley Chery [Wed, 15 Apr 2020 23:30:24 +0000 (16:30 -0700)]
gallium/dri2: Support I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS import

Add support for up to four planes being imported via the
I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS modifier. In the four plane
scenario, two planes are used for the compressed surface and two planes
are used for the compression metadata.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agogallium/dri2: Report I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS num_planes
Nanley Chery [Wed, 11 Sep 2019 22:34:46 +0000 (15:34 -0700)]
gallium/dri2: Report I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS num_planes

Return the expected number of planes in a DMA buffer that has the
I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS modifier.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>

4 years agonir_dominance: Use uint32_t instead of int16_t for dominance counters
Jesse Natalie [Wed, 9 Sep 2020 00:50:23 +0000 (17:50 -0700)]
nir_dominance: Use uint32_t instead of int16_t for dominance counters

We're seeing OpenCL kernels that can hit this INT16_MAX block count.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6657>

4 years agost/nir: Call st_glsl_to_nir_post_opts before interface unification
Danylo Piliaiev [Tue, 8 Sep 2020 10:22:12 +0000 (13:22 +0300)]
st/nir: Call st_glsl_to_nir_post_opts before interface unification

Since 95415a54c007a909f0fb9d1b2567beecbd73d403 st_finalize_nir_before_variants
calls to nir_shader_gather_info, so finalization should be moved
before interface unification.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3482
Fixes: 95415a54c007a909f0fb9d1b2567beecbd73d403
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6647>

4 years agomesa: Generate more errors from GetSamplerParameter
Adam Jackson [Thu, 14 Nov 2019 18:09:32 +0000 (13:09 -0500)]
mesa: Generate more errors from GetSamplerParameter

Not all of the corresponding extensions are enabled unconditionally, and
we should throw INVALID_ENUM in those cases.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6653>

4 years agomesa: Fix GL_CLAMP handling in glSamplerParameter
Adam Jackson [Thu, 14 Nov 2019 16:10:05 +0000 (11:10 -0500)]
mesa: Fix GL_CLAMP handling in glSamplerParameter

GL_CLAMP is only a thing in compat contexts.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6653>

4 years agoci/bare-metal: Allow wget of the kernel/dtb for kernel development.
Eric Anholt [Fri, 1 May 2020 16:35:16 +0000 (09:35 -0700)]
ci/bare-metal: Allow wget of the kernel/dtb for kernel development.

It's useful for kernel dev to be able throw all of our testing
infrastructure at a risky kernel change, but it's expensive (time and
bandwidth) to roll new containers every time your rev your kernel.  Make
it so you can just point the env vars to your personal build you've
uploaded.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>

4 years agoci/bare-metal: Update the kernel to msm-next-pgtables
Eric Anholt [Wed, 2 Sep 2020 17:49:44 +0000 (10:49 -0700)]
ci/bare-metal: Update the kernel to msm-next-pgtables

I'd like to see this new non-UAPI feature bake in CI.  More importantly,
it may prevent some classes of flakes on cheza by isolating the processes
on the GPU so that a fault in one doesn't stomp over memory in another.
I've also pulled in a fix that etnaviv needed for their upcoming CI.

We add a few more kernel options while uprevving:

- More interconnect drivers for getting good GPU perf
- PRNG so that we don't get late-in-boot complaints about randomness.
- db820c's power domains and ethernet so hopefully we can switch to this
  upstream kernel

This seems to slightly change the flakes happening in bypass mode, so add
them to the list.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>

4 years agoturnip: Fix truncation of iovas to 32 bits in queries.
Eric Anholt [Thu, 3 Sep 2020 18:56:45 +0000 (11:56 -0700)]
turnip: Fix truncation of iovas to 32 bits in queries.

Fixes regression when switching to msm-next-pgtables.

Fixes: e34b0d65f971 ("turnip: Implement and enable VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>

4 years agoturnip: Fix truncation of CS shader iovas to 32 bits.
Eric Anholt [Thu, 3 Sep 2020 17:30:31 +0000 (10:30 -0700)]
turnip: Fix truncation of CS shader iovas to 32 bits.

This was invalid, and makes VK break consistently with the
msm-next-pgtbables branch.

Fixes: 13525a9c706b ("turnip: pipeline program state refactor")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>

4 years agofreedreno: Make the pack struct have a .qword for wide addresses.
Eric Anholt [Thu, 3 Sep 2020 21:46:24 +0000 (14:46 -0700)]
freedreno: Make the pack struct have a .qword for wide addresses.

Storing a precomputed iova in reg packing wasn't possible because you'd
truncate to 32 bits.  Making it be .qword makes it possible.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>

4 years agoturnip: Fix a compiler warning in release builds of the query code.
Eric Anholt [Thu, 3 Sep 2020 20:42:17 +0000 (13:42 -0700)]
turnip: Fix a compiler warning in release builds of the query code.

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

4 years agoturnip: remove some unnecessary regs init
Jonathan Marek [Thu, 30 Jul 2020 12:58:16 +0000 (08:58 -0400)]
turnip: remove some unnecessary regs init

The removed registers are all set elsewhere when they are relevant, so
there is no need to initialize them in init_hw().

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>

4 years agoturnip: delete unused "tu_cmd_buffer_upload"
Jonathan Marek [Wed, 9 Sep 2020 13:50:47 +0000 (09:50 -0400)]
turnip: delete unused "tu_cmd_buffer_upload"

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>

4 years agoturnip: fix the type of tu_shader_module code field, delete unused sha1
Jonathan Marek [Wed, 9 Sep 2020 13:49:22 +0000 (09:49 -0400)]
turnip: fix the type of tu_shader_module code field, delete unused sha1

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>

4 years agoturnip: delete unused tu_image fields
Jonathan Marek [Wed, 9 Sep 2020 13:45:28 +0000 (09:45 -0400)]
turnip: delete unused tu_image fields

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>

4 years agoturnip: delete tu_physical_device path field
Jonathan Marek [Thu, 13 Aug 2020 17:50:46 +0000 (13:50 -0400)]
turnip: delete tu_physical_device path field

Resolves a "strncpy specified bound 20 equals destination size" warning.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>

4 years agoaco: fix validation of sub-dword parallel-copies
Rhys Perry [Mon, 7 Sep 2020 19:45:25 +0000 (20:45 +0100)]
aco: fix validation of sub-dword parallel-copies

Only the operands with a sub-dword definition need to be checked.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6662>

4 years agoaco: fix value numbering of reductions
Rhys Perry [Mon, 7 Sep 2020 19:44:54 +0000 (20:44 +0100)]
aco: fix value numbering of reductions

Non-ssa definitions caused an assertion in value numbering.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6662>

4 years agoaco: don't apply constant to SDWA on GFX8
Rhys Perry [Mon, 7 Sep 2020 19:21:37 +0000 (20:21 +0100)]
aco: don't apply constant to SDWA on GFX8

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Cc: 20.2 <mesa-stable>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6662>

4 years agoaco: workaround disassembler bug of v_writelane_b32 with literal
Rhys Perry [Mon, 7 Sep 2020 19:20:50 +0000 (20:20 +0100)]
aco: workaround disassembler bug of v_writelane_b32 with literal

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6662>

4 years agoaco: fix v_writelane_b32 with two sgprs
Rhys Perry [Mon, 7 Sep 2020 19:20:34 +0000 (20:20 +0100)]
aco: fix v_writelane_b32 with two sgprs

v_writelane_b32 can take two sgprs but only if one is m0.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Cc: 20.2 <mesa-stable>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6662>

4 years agonir/opt_loop_unroll: fix is_access_out_of_bounds with vectors
Rhys Perry [Mon, 17 Aug 2020 12:19:43 +0000 (13:19 +0100)]
nir/opt_loop_unroll: fix is_access_out_of_bounds with vectors

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsquueze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6347>

4 years agopanfrost: AFBC to linear layout conversion
Icecream95 [Fri, 4 Sep 2020 22:21:40 +0000 (10:21 +1200)]
panfrost: AFBC to linear layout conversion

Similar to the conversion that is already done for tiled to linear.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6608>

4 years agopanfrost: Move tiled-linear conversion checking to a new function
Icecream95 [Fri, 4 Sep 2020 22:18:33 +0000 (10:18 +1200)]
panfrost: Move tiled-linear conversion checking to a new function

AFBC-linear conversion will also use this function.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6608>

4 years agopanfrost: Seperate resource setup and bo creation
Icecream95 [Fri, 4 Sep 2020 22:16:04 +0000 (10:16 +1200)]
panfrost: Seperate resource setup and bo creation

This will make it easier to convert between modifiers without
unnecessarily creating a new bo.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6608>

4 years agopanfrost: Correctly set modifier_constant
Icecream95 [Fri, 4 Sep 2020 22:11:41 +0000 (10:11 +1200)]
panfrost: Correctly set modifier_constant

This fixes the tiled-linear conversion optimisation.

Fixes: 56f9cc99487 ("panfrost: Account for modifiers when creating BO")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6608>

4 years agopanfrost: Remove old comment on broken depth reload
Icecream95 [Mon, 7 Sep 2020 05:32:15 +0000 (17:32 +1200)]
panfrost: Remove old comment on broken depth reload

Depth reload works now, so now the optimisation is just for
performance and isn't a workaround any more.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6609>

4 years agopanfrost: Cleanup panfrost_get_param
Icecream95 [Sat, 5 Sep 2020 00:02:10 +0000 (12:02 +1200)]
panfrost: Cleanup panfrost_get_param

Move DEPTH_CLIP_DISABLE_SEPARATE back next to DEPTH_CLIP_DISABLE, and
remove a dead return statement.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6609>

4 years agodocs/features: Add missing Panfrost extensions
Icecream95 [Sat, 5 Sep 2020 00:00:40 +0000 (12:00 +1200)]
docs/features: Add missing Panfrost extensions

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6609>

4 years agoradv,gallium: Add driconf option to reduce advertised VRAM size.
Bas Nieuwenhuizen [Tue, 8 Sep 2020 00:02:09 +0000 (02:02 +0200)]
radv,gallium: Add driconf option to reduce advertised VRAM size.

To help debugging games that actually do active memory budget
management.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6641>

4 years agoiris: Add missing range_base/range to our nir_load_ubos.
Eric Anholt [Tue, 8 Sep 2020 22:35:19 +0000 (15:35 -0700)]
iris: Add missing range_base/range to our nir_load_ubos.

Fixes: f3b33a5a35e6 ("nir: Add a range_base+range to nir_intrinsic_load_ubo().")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Clayton Craft <clayton.a.craft@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6654>

4 years agollvmpipe: include gallivm perf flags in shader cache.
Dave Airlie [Mon, 7 Sep 2020 06:30:15 +0000 (16:30 +1000)]
llvmpipe: include gallivm perf flags in shader cache.

Otherwise if you set perf flags, then don't set them,
they won't take affect.

Fixes: 6c0c61cb48e8 ("llvmpipe: add infrastructure for disk cache support")
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6630>

4 years agoaco/isel: Compile all helper functions with static linkage
Tony Wasserka [Thu, 3 Sep 2020 12:29:58 +0000 (14:29 +0200)]
aco/isel: Compile all helper functions with static linkage

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agoaco/isel: Move add_startpgm to aco_instruction_selection.cpp
Tony Wasserka [Thu, 3 Sep 2020 12:28:56 +0000 (14:28 +0200)]
aco/isel: Move add_startpgm to aco_instruction_selection.cpp

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agoaco/isel: Move context initialization code to a dedicated file
Tony Wasserka [Thu, 3 Sep 2020 10:36:58 +0000 (12:36 +0200)]
aco/isel: Move context initialization code to a dedicated file

aco_instruction_selection_setup.cpp (previously used as a header) has
been split into a header and an implementation file. The latter "only"
implements init_context and setup_isel_context, but since these files
carry a long trail of helper functions, this cleans up the isel header
a lot.

Reduces library size by 3.1% due to more functions being compiled with
static linkage. Makes aco_instruction_selection.cpp compile 3% faster.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agoaco/isel: Remove unused definitions
Tony Wasserka [Sat, 29 Aug 2020 13:39:33 +0000 (15:39 +0200)]
aco/isel: Remove unused definitions

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agoaco/isel: Consistently use references for input parameters in emit_load
Tony Wasserka [Sat, 29 Aug 2020 13:51:07 +0000 (15:51 +0200)]
aco/isel: Consistently use references for input parameters in emit_load

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agoaco/isel: Simplify nested branching code
Tony Wasserka [Sat, 29 Aug 2020 11:14:23 +0000 (13:14 +0200)]
aco/isel: Simplify nested branching code

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agoaco/isel: Turn the function template emit_load into a proper function
Tony Wasserka [Mon, 17 Aug 2020 15:07:53 +0000 (17:07 +0200)]
aco/isel: Turn the function template emit_load into a proper function

Statically known values were encoded using template parameters previously,
causing specializations for each of the 5 sets of template arguments to be
generated. Since emit_load is not performance critical (the inner loop
never runs more often than twice), it's better for build time to use
runtime arguments everywhere.

Reduces build time of this file by 9% (17.3s -> 15.7s on my machine) and
reduces libaco's size by 2.6%.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agointel/nir: Call validate_ssa_dominance at both ends of the NIR compile
Jason Ekstrand [Mon, 1 Jun 2020 20:43:53 +0000 (15:43 -0500)]
intel/nir: Call validate_ssa_dominance at both ends of the NIR compile

This invokes it before we go into the optimization/lowering pass and
then right before we go out of SSA.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5288>

4 years agospirv: Run repair_ssa if there are discard instructions
Jason Ekstrand [Mon, 1 Jun 2020 23:01:05 +0000 (18:01 -0500)]
spirv: Run repair_ssa if there are discard instructions

SPIR-V's OpKill is a control-flow instruction but NIR's discard is not.
Therefore, it can be valid SPIR-V to have

    if (...) {
        foo = /* something */
    } else {
        discard;
    }
    use(foo);

without any phi between the definition of foo and its use.  This is not
true in NIR, however, because NIR's discard isn't considered
control-flow.  Arguably, this is a NIR bug but making discard control-
flow is a very deep change that can have serious ans subtle
side-effects.   The easier thing to do is just fix up the SSA in case we
have an OpKill which might have gotten us into the above case.

Fixes dEQP-VK.graphicsfuzz.vectors-and-discard-in-function with the new
NIR dominance validation pass enabled.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5288>

4 years agonir: Add a dominance validation pass
Jason Ekstrand [Mon, 1 Jun 2020 20:39:31 +0000 (15:39 -0500)]
nir: Add a dominance validation pass

We don't do full dominance validation of SSA values in nir_validate
because it requires generating valid dominance information and, while
that's not extremely expensive, it's probably more than we want to do on
every pass.  Also, dominance information is generated through the
metadata system so if we ran it by default in nir_validate, we would get
different beavior of the metadata system based on whether or not you
have a debug build and metadata bugs would be very hard to find.

However, having a pass for it that can be run occasionally, should help
detect and expose bugs.  For ease of use, we add a NIR_VALIDATE_SSA_DOMINANCE
environment variable which can be set to manually enable dominance
validation as a standard part of nir_validate.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5288>

4 years agonir/opt_if: fix opt_if_merge when destination branch has a jump
Rhys Perry [Mon, 7 Sep 2020 10:33:44 +0000 (11:33 +0100)]
nir/opt_if: fix opt_if_merge when destination branch has a jump

Fixes a case where opt_if_merge created code like:
if (...) {
   break;
   loop {
      ...
   }
}
which caused opt_peel_loop_initial_if to complain that the loop pre-header
wasn't a predecessor of the loop header. This patch prevents this
(invalid, I think) unreachable code from being created.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3496
Fixes: 4d3f6cb9739 ('nir: merge some basic consecutive ifs')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6633>

4 years agonir: Use explicit deref information to provide real UBO ranges.
Eric Anholt [Fri, 4 Sep 2020 20:25:05 +0000 (13:25 -0700)]
nir: Use explicit deref information to provide real UBO ranges.

freedreno results (note that cat6 is loads from memory as opposed to
pushed constants from the constant file):

total instructions in shared programs: 8044344 -> 8022085 (-0.28%)
total constlen in shared programs: 1411384 -> 1461964 (3.58%)
total cat6 in shared programs: 89983 -> 87065 (-3.24%)

Over the last 3 commits, we increased Manhattan31 performance by ~10%

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>

4 years agofreedreno/ir3: Apply the max upload limit to initial range setup
Eric Anholt [Fri, 4 Sep 2020 17:59:37 +0000 (10:59 -0700)]
freedreno/ir3: Apply the max upload limit to initial range setup

There's no sense in planning out an upload that we won't be able to
actually upload due to the limit.  This means that we can keep making
other loads pushable, even after we find one that wouldn't be, and we
don't fill the const file with UBO data for a load we couldn't promote.

total instructions in shared programs: 8096655 -> 8044344 (-0.65%)
total constlen in shared programs: 1447824 -> 1411384 (-2.52%)
total cat6 in shared programs: 97824 -> 89983 (-8.02%)

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

4 years agofreedreno/ir3: Use the new NIR UBO ranges in UBO analysis.
Eric Anholt [Fri, 14 Aug 2020 23:11:06 +0000 (16:11 -0700)]
freedreno/ir3: Use the new NIR UBO ranges in UBO analysis.

Now that NIR doesn't lose the original base/range on the
nir_lower_uniforms_to_ubo() path, we get a lot more indirect arrays
uploaded in shader-db.

total instructions in shared programs: 8125988 -> 8103788 (-0.27%)
total constlen in shared programs: 1313096 -> 1448864 (10.34%)
total cat6 in shared programs: 104089 -> 97824 (-6.02%)

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

4 years agonir: Add a range_base+range to nir_intrinsic_load_ubo().
Eric Anholt [Fri, 14 Aug 2020 20:10:02 +0000 (13:10 -0700)]
nir: Add a range_base+range to nir_intrinsic_load_ubo().

For UBO accesses to be the same performance as classic GL default uniform
block uniforms, we need to be able to push them through the same path.  On
freedreno, we haven't been uploading UBOs as push constants when they're
used for indirect array access, because we don't know what range of the
UBO is needed for an access.

I believe we won't be able to calculate the range in general in spirv
given casts that can happen, so we define a [0, ~0] range to be "We don't
know anything".  We use that at the moment for all UBO loads except for
nir_lower_uniforms_to_ubo, where we now avoid losing the range information
that default uniform block loads come with.

In a departure from other NIR intrinsics with a "base", I didn't make the
base an be something you have to add to the src[1] offset.  This keeps us
from needing to modify all drivers (particularly since the base+offset
thing can mean needing to do addition in the backend), makes backend
tracking of ranges easy, and makes the range calculations in
load_store_vectorizer reasonable.  However, this could definitely cause
some confusion for people used to the normal NIR base.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>

4 years agonir: Update the comment about nir_lower_uniforms_to_ubo()'s multiplier.
Eric Anholt [Fri, 14 Aug 2020 20:22:27 +0000 (13:22 -0700)]
nir: Update the comment about nir_lower_uniforms_to_ubo()'s multiplier.

I remembered doing this analysis and was arguing in another MR that this
pass didn't have any driver dependency, but it actually does based on
PIPE_CAP_PACKED_UNIFORMS.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>

4 years agoradeonsi: inline trivial PS functions
Marek Olšák [Sun, 6 Sep 2020 14:54:53 +0000 (10:54 -0400)]
radeonsi: inline trivial PS functions

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6623>

4 years agoac,radeonsi: lower 64-bit IO to 32 bits and remove all dead code
Marek Olšák [Tue, 1 Sep 2020 21:02:52 +0000 (17:02 -0400)]
ac,radeonsi: lower 64-bit IO to 32 bits and remove all dead code

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6623>

4 years agoradeonsi: remove swizzle == ~0 dead code in si_llvm_load_input_gs
Marek Olšák [Tue, 1 Sep 2020 21:04:24 +0000 (17:04 -0400)]
radeonsi: remove swizzle == ~0 dead code in si_llvm_load_input_gs

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6623>

4 years agoradeonsi: eliminate unused shader outputs for separate NGG geometry shaders
Marek Olšák [Mon, 7 Sep 2020 10:29:45 +0000 (06:29 -0400)]
radeonsi: eliminate unused shader outputs for separate NGG geometry shaders

This just works because the same output export code is used for VS too.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6634>

4 years agoradeonsi: set outputs_written_before_ps for geometry shaders too
Marek Olšák [Mon, 7 Sep 2020 10:23:33 +0000 (06:23 -0400)]
radeonsi: set outputs_written_before_ps for geometry shaders too

it will be used in following commit

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6634>

4 years agoaco/isel: refactor emit_vop3a_instruction() to handle 2 operand instructions
Daniel Schürmann [Fri, 4 Sep 2020 23:47:30 +0000 (00:47 +0100)]
aco/isel: refactor emit_vop3a_instruction() to handle 2 operand instructions

Only AC:O has been affected.

Totals from 4 (0.00% of 136546) affected shaders (RAVEN):
CodeSize: 16428 -> 16420 (-0.05%)
Instrs: 3294 -> 3292 (-0.06%)
Cycles: 14208 -> 14200 (-0.06%)
VMEM: 936 -> 978 (+4.49%)
VClause: 80 -> 77 (-3.75%)
Copies: 211 -> 209 (-0.95%)
PreVGPRs: 127 -> 126 (-0.79%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6635>

4 years agoaco/isel: refactor code and remove unnecessary v_mov
Daniel Schürmann [Fri, 4 Sep 2020 21:01:26 +0000 (22:01 +0100)]
aco/isel: refactor code and remove unnecessary v_mov

Changes mainly due to avoided v_movs for fmin/fmax/fadd/fmul.

Totals from 12783 (9.36% of 136546) affected shaders (RAVEN):
SGPRs: 1097752 -> 1098264 (+0.05%); split: -0.09%, +0.14%
VGPRs: 856920 -> 850800 (-0.71%); split: -0.82%, +0.11%
SpillSGPRs: 49494 -> 49496 (+0.00%); split: -0.00%, +0.01%
CodeSize: 99997916 -> 99989948 (-0.01%); split: -0.04%, +0.03%
MaxWaves: 53895 -> 54448 (+1.03%)
Instrs: 19634960 -> 19632626 (-0.01%); split: -0.05%, +0.04%
Cycles: 1620601696 -> 1620900712 (+0.02%); split: -0.02%, +0.04%
VMEM: 3334181 -> 3299626 (-1.04%); split: +1.62%, -2.66%
SMEM: 865573 -> 865876 (+0.04%); split: +0.84%, -0.81%
VClause: 337100 -> 335224 (-0.56%); split: -0.88%, +0.32%
SClause: 696813 -> 697267 (+0.07%); split: -0.14%, +0.21%
Copies: 1549897 -> 1548023 (-0.12%); split: -0.52%, +0.40%
Branches: 682118 -> 682108 (-0.00%); split: -0.01%, +0.00%
PreSGPRs: 893524 -> 895129 (+0.18%); split: -0.00%, +0.18%
PreVGPRs: 790180 -> 783036 (-0.90%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6635>

4 years agoswr: Use ElemenCount constructor for LLVM 11
jzielins [Mon, 7 Sep 2020 14:49:35 +0000 (16:49 +0200)]
swr: Use ElemenCount constructor for LLVM 11

In LLVM 12 ElementCount constructor is private
and instead of using it explicitly, ::get function
should be used, but in LLVM 11, the constructor
is still the way to go.

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Closes: #3490
Fixes: 639605e5ba947bb947313a6584ef7fbb8619e9c2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6648>

4 years agoaco: improve fsign selection
Rhys Perry [Thu, 3 Sep 2020 13:56:26 +0000 (14:56 +0100)]
aco: improve fsign selection

Idea from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284

fossil-db (Navi):
Totals from 4053 (2.95% of 137413) affected shaders:
SGPRs: 305810 -> 305906 (+0.03%); split: -0.01%, +0.04%
VGPRs: 249000 -> 249144 (+0.06%); split: -0.01%, +0.07%
CodeSize: 29967092 -> 29885768 (-0.27%); split: -0.27%, +0.00%
Instrs: 5749494 -> 5737971 (-0.20%); split: -0.20%, +0.00%
Cycles: 255028584 -> 254955444 (-0.03%); split: -0.04%, +0.01%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6583>

4 years agoaco: fix one-off error in Operand(uint16_t)
Rhys Perry [Thu, 3 Sep 2020 14:41:32 +0000 (15:41 +0100)]
aco: fix one-off error in Operand(uint16_t)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 3d6f67950d9 ('aco: improve 8/16-bit constants')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6583>