platform/upstream/mesa.git
3 years agoblorp: Drop trailing whitespace in blorp_clear.c
Nanley Chery [Tue, 8 Sep 2020 14:34:50 +0000 (07:34 -0700)]
blorp: Drop trailing whitespace in blorp_clear.c

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6650>

3 years agoblorp: Fix alignment test for HIZ_CCS_WT fast-clears
Nanley Chery [Tue, 8 Sep 2020 14:33:59 +0000 (07:33 -0700)]
blorp: Fix alignment test for HIZ_CCS_WT fast-clears

Remove the extra logical ORs in the ternary operation.

Fixes: 5425fcf2cb3 ("intel/blorp: Satisfy HIZ_CCS fast-clear alignments")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6650>

3 years agonir: fix lower_mediump_outputs to not require variables
Marek Olšák [Sun, 6 Sep 2020 04:25:05 +0000 (00:25 -0400)]
nir: fix lower_mediump_outputs to not require variables

If IO is lowered, NIR doesn't have to contain any IO variables
(and in fact radeonsi removes them and other drivers should too).

This makes the pass work without variables.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6621>

3 years agonir: add mediump flag to IO semantics
Marek Olšák [Sun, 6 Sep 2020 04:24:31 +0000 (00:24 -0400)]
nir: add mediump flag to IO semantics

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6621>

3 years agoglx/dri3: Implement GLX_EXT_swap_control_tear
Adam Jackson [Wed, 9 Sep 2020 19:14:30 +0000 (15:14 -0400)]
glx/dri3: Implement GLX_EXT_swap_control_tear

Not wired up for DRI2 because it would require server-side support,
which I'm not especially interested in writing.

Fixes: mesa/mesa#96
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agoglx: Implement GLX_EXT_swap_control for DRI2 and DRI3
Adam Jackson [Wed, 9 Sep 2020 18:00:35 +0000 (14:00 -0400)]
glx: Implement GLX_EXT_swap_control for DRI2 and DRI3

This is a slight generalization of the existing SGI and MESA swap
control extensions, and a prerequisite for GLX_EXT_swap_control_tear.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agoglx: Reject glXSwapIntervalMESA greater than INT_MAX
Adam Jackson [Wed, 9 Sep 2020 19:54:21 +0000 (15:54 -0400)]
glx: Reject glXSwapIntervalMESA greater than INT_MAX

It wouldn't work in any case, as the internal API only stores a signed
int, and GLX_EXT_swap_control_tear will overload the meaning of negative
values so we should avoid ambiguity.

If your application needs a swap interval in excess of ~414.25 days, I'm
very sorry.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agoglx: Collect all the non-applegl extensions in the GetProcAddress table
Adam Jackson [Wed, 9 Sep 2020 17:28:02 +0000 (13:28 -0400)]
glx: Collect all the non-applegl extensions in the GetProcAddress table

No functional change, just reducing #ifdef clutter.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agoglx: Use GLX_FUNCTION2 only for actually aliased function names
Adam Jackson [Wed, 9 Sep 2020 16:40:19 +0000 (12:40 -0400)]
glx: Use GLX_FUNCTION2 only for actually aliased function names

I find the __glX naming convention distasteful for a bunch of reasons,
not least that I expect "vi -t glXBindTexImageEXT" to take me someplace
useful. The functions we're referencing here should not be exported from
libGL (hence the static / _X_HIDDEN) but that's no reason not to name
them correctly.

This does have one possible, very minor, correct functional change,
glXGetMscRateOML now returns Bool (unsigned int) instead of GLboolean
(unsigned char); if your psABI really only writes to a single byte of
the return register when the return type is char-like, then we probably
would not have returned false when we meant to. At least for amd64 this
does not seem to be an issue; the old code wrote 0 to %eax, the new code
does a zero-extended load from %al to %eax (since the internal function
still returns GLboolean).

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agowsi/x11: Hook up VK_PRESENT_MODE_FIFO_RELAXED_KHR
Adam Jackson [Wed, 9 Sep 2020 21:03:11 +0000 (17:03 -0400)]
wsi/x11: Hook up VK_PRESENT_MODE_FIFO_RELAXED_KHR

This is just PresentOptionAsync.

Fixes: mesa/mesa#3483
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6673>

3 years agoci: do not build libdrm for vc4, reedreno and etnaviv
Christian Gmeiner [Wed, 9 Sep 2020 20:21:14 +0000 (22:21 +0200)]
ci: do not build libdrm for vc4, reedreno and etnaviv

They are using a in source tree version of the needed libdrm
functionality or are shipping all needed headers in the source tree.

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/6672>

3 years agoturnip: rework vertex buffers draw state handling
Jonathan Marek [Wed, 9 Sep 2020 13:26:59 +0000 (09:26 -0400)]
turnip: rework vertex buffers draw state handling

This exploits a HW optimization for when only the size of a draw state is
changed, to make things simpler and more optimal (assuming a well behaved
user which doesn't unecessarily call CmdBindVertexBuffers many times)

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

3 years agointel/tools: fix possible randomly increased verbosity of error2aub
Marcin Ślusarz [Wed, 9 Sep 2020 17:42:52 +0000 (19:42 +0200)]
intel/tools: fix possible randomly increased verbosity of error2aub

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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>

3 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>