platform/upstream/mesa.git
2 years agod3d12: Compute UUIDs required by external objects extension
Jesse Natalie [Sat, 9 Jul 2022 21:47:02 +0000 (14:47 -0700)]
d3d12: Compute UUIDs required by external objects extension

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agod3d12: Store the rest of the device IDs in the screen
Jesse Natalie [Sat, 9 Jul 2022 21:46:28 +0000 (14:46 -0700)]
d3d12: Store the rest of the device IDs in the screen

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agogallium, mesa: Support setting timeline semaphore values
Jesse Natalie [Sun, 10 Jul 2022 03:29:12 +0000 (20:29 -0700)]
gallium, mesa: Support setting timeline semaphore values

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agomesa: Implement ImportSemaphoreWin32NameEXT
Jesse Natalie [Sun, 10 Jul 2022 04:15:50 +0000 (21:15 -0700)]
mesa: Implement ImportSemaphoreWin32NameEXT

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agomesa: Support importing D3D12 fences as timeline semaphores
Jesse Natalie [Sun, 10 Jul 2022 02:58:51 +0000 (19:58 -0700)]
mesa: Support importing D3D12 fences as timeline semaphores

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agogallium: Add a new fence type with a pipe cap to indicate it can be imported
Jesse Natalie [Sun, 10 Jul 2022 02:58:26 +0000 (19:58 -0700)]
gallium: Add a new fence type with a pipe cap to indicate it can be imported

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agodriver_noop: Remove infinite recursion from create_fence_win32
Jesse Natalie [Wed, 13 Jul 2022 19:33:31 +0000 (12:33 -0700)]
driver_noop: Remove infinite recursion from create_fence_win32

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agogallium: Add 'name' field to Win32 semaphore import
Jesse Natalie [Sun, 10 Jul 2022 02:44:28 +0000 (19:44 -0700)]
gallium: Add 'name' field to Win32 semaphore import

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agomesa: Implement ImportMemoryWin32NameEXT
Jesse Natalie [Sun, 10 Jul 2022 02:20:05 +0000 (19:20 -0700)]
mesa: Implement ImportMemoryWin32NameEXT

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agogallium: Add a 'name' field to winsys_handle
Jesse Natalie [Sun, 10 Jul 2022 02:19:10 +0000 (19:19 -0700)]
gallium: Add a 'name' field to winsys_handle

Win32 memory objects can be imported by name (const void *
that will be interpreted as const wchar_t *)

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agomapi: Add more EXT_external_objects_win32 functions/enums
Jesse Natalie [Sun, 10 Jul 2022 02:14:17 +0000 (19:14 -0700)]
mapi: Add more EXT_external_objects_win32 functions/enums

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agomesa: Support D3D11/D3D12 memory imports
Jesse Natalie [Sun, 10 Jul 2022 01:56:40 +0000 (18:56 -0700)]
mesa: Support D3D11/D3D12 memory imports

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

2 years agoutil: Shut down Perfetto before driver unload
Sami Kyöstilä [Mon, 11 Jul 2022 06:36:31 +0000 (16:36 +1000)]
util: Shut down Perfetto before driver unload

Shut down Perfetto before unloading the driver to fix a crash caused by
an internal Perfetto thread that kept running after dlclose() took away
its code.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4909
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17454>

2 years agosubprojects: Roll Perfetto to v27.1
Sami Kyöstilä [Wed, 13 Jul 2022 09:24:03 +0000 (19:24 +1000)]
subprojects: Roll Perfetto to v27.1

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17454>

2 years agoci: uprev vkd3d-proton to 5b73139f182d86cd58a757e4b5f0d4cfad96d319
Samuel Pitoiset [Mon, 11 Jul 2022 14:48:48 +0000 (16:48 +0200)]
ci: uprev vkd3d-proton to 5b73139f182d86cd58a757e4b5f0d4cfad96d319

This contains some Device Generated Command tests that will be
useful for an experimental RADV implementation.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17463>

2 years agozink: reject swizzled format blits
Mike Blumenkrantz [Tue, 12 Jul 2022 23:40:38 +0000 (19:40 -0400)]
zink: reject swizzled format blits

e.g., R8G8B8A8 -> B8G8R8A8 is invalid, so use u_blitter

fixes (various gl configs):
KHR-GL46.blend_equation_advanced*

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17523>

2 years agopanfrost: Use early-ZS helpers
Alyssa Rosenzweig [Fri, 8 Jul 2022 17:46:49 +0000 (13:46 -0400)]
panfrost: Use early-ZS helpers

Remove the previous compile-time early-ZS implementation and replace it with the
decoupled early-ZS implementation. This uses more efficient settings in some
cases (depth/stencil tests always passes or do not write), and fixes the
settings used in another case (alpha-to-coverage enabled with an otherwise
early-ZS shader.)

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Closes: #6206
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17428>

2 years agopanfrost: Add zsa->zs_always_passes flag
Alyssa Rosenzweig [Tue, 12 Jul 2022 21:14:31 +0000 (17:14 -0400)]
panfrost: Add zsa->zs_always_passes flag

If we know ahead-of-time that depth/stencil testing will always pass, it's
better to use weak_early than force_early. However, if depth/stencil testing
could fail (discarding pixels), we'd rather use force_early. Determine which
case we're in at CSO create time.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17428>

2 years agopanfrost: Unit test early-ZS helpers
Alyssa Rosenzweig [Fri, 10 Jun 2022 20:31:35 +0000 (16:31 -0400)]
panfrost: Unit test early-ZS helpers

The new early-ZS helpers are pure functions, leaf nodes of the call graph, and
implemented with a different algorithm from the "oracle" table of correct values
for various combinations of states. Further, incorrect settings often still pass
CTS while causing game bugs or inefficiencies. That combination makes the
helpers an excellent candidate for unit tests. Add some.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17428>

2 years agopanfrost: Add decoupled early-ZS helpers
Alyssa Rosenzweig [Fri, 10 Jun 2022 19:28:35 +0000 (15:28 -0400)]
panfrost: Add decoupled early-ZS helpers

Bifrost (and Valhall) separate early-ZS configuration into two fields: when does
the depth/stencil buffer update happen? and when are pixels killed by the
depth/stencil tests? The driver separately configures these to occur early
(before the shader executes) or late (after the ATEST instruction executes at
the end of the shader). Early tests are generally more efficient, but various
combinations of API state and fragment shader properties can require late
updates and/or late kills for correctness. Determining how to configure these
fields is nontrivial.

Our current implementation (on Bifrost) configures these fields at fragment
shader compile time and bakes the settings into the RSD. This is both wrong
(using early testing when late testing is required) and suboptimal (using late
testing when early testing would suffice). We need to defer this configuration
until draw time, when we know rasterizer and Z/S state.

Reclassifying at draw time (as we currently do on Valhall) would be expensive,
especially with the extra terms added in here. To cope, decouple the shader
classification from the draw-time configuration. Since there are only a few bits
of draw state involved, this implementation just calculates all possible states.
Then the draw time classification is just indexing into a lookup table.

The actual algorithm used to classify is written with correctness and clarity in
mind. Unlike the current classification algorithm (which tries to match what the
DDK does, poorly), this algorithm embeds its proofs of correctness.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17428>

2 years agopanfrost: Fix shader_modifies_coverage on Valhall
Alyssa Rosenzweig [Sat, 18 Jun 2022 01:15:49 +0000 (21:15 -0400)]
panfrost: Fix shader_modifies_coverage on Valhall

Alpha-to-coverage should set this flag. This is a hardware change since Bifrost.

Fixes: 26d339ef8ac ("panfrost: Generate Valhall Malloc IDVS jobs")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17428>

2 years agopan/va: Stall after ATEST
Alyssa Rosenzweig [Sat, 18 Jun 2022 01:06:24 +0000 (21:06 -0400)]
pan/va: Stall after ATEST

In theory this wait is required for correct behaviour of discarded threads with
ATEST. Mesa usually waits before the instruction after ATEST, so this wait will
get optimized out by va_merge_flow, but as our scheduler gets more sophisticated
this could become an issue.

Let's stay on the safe side and insert the recommended wait.

No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17428>

2 years agopan/bi: Require ATEST coverage mask input in R60
Alyssa Rosenzweig [Mon, 20 Jun 2022 17:23:14 +0000 (13:23 -0400)]
pan/bi: Require ATEST coverage mask input in R60

In theory, ATEST can take any combination of registers for inputs.
Experimentally, however, ATEST requires the coverage mask in R60. This avoids
regressing the following dEQP tests, which write their coverage mask with
pixel-frequency-shading but without writing to the depth/stencil buffer.

dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_pixel.*

This issue is known to affect both Mali-G52 (v7) and Mali-G57 (v9). I am unsure
if this is a silicon bug or just an obscure implementation detail.

No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17428>

2 years agopanfrost: Simplify sample_shading
Jason Ekstrand [Tue, 12 Jul 2022 18:57:08 +0000 (13:57 -0500)]
panfrost: Simplify sample_shading

Nos that glsl_to_nir is setting sample_shading_enable whenever FB fetch
is used, we don't need to duplicate it here.

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

2 years agointel/fs,anv: Rework handling of coarse and sample shading
Jason Ekstrand [Tue, 12 Jul 2022 18:53:16 +0000 (13:53 -0500)]
intel/fs,anv: Rework handling of coarse and sample shading

Now that this information is accurately gathered by spirv_to_nir, we no
longer need the hack.  We just need to fix up the way we handle some of
the key bits.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agointel/fs: Simplify persample_dispatch
Jason Ekstrand [Tue, 12 Jul 2022 18:51:10 +0000 (13:51 -0500)]
intel/fs: Simplify persample_dispatch

Thanks to the previous commit, we no longer need this check.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agoglsl/nir: Set sample_shading if a FS output ever shows up as an rvalue
Jason Ekstrand [Mon, 2 May 2022 23:19:30 +0000 (18:19 -0500)]
glsl/nir: Set sample_shading if a FS output ever shows up as an rvalue

If framebuffer fetch is used, we have to enable sample shading because
the fetched framebuffer value is per-sample.

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

2 years agonir/gather_info: Stop gathering uses_sample_shading
Jason Ekstrand [Wed, 1 Dec 2021 22:12:21 +0000 (16:12 -0600)]
nir/gather_info: Stop gathering uses_sample_shading

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agospirv/nir: Set uses_sample_shading from spirv_to_nir
Jason Ekstrand [Wed, 1 Dec 2021 21:59:48 +0000 (15:59 -0600)]
spirv/nir: Set uses_sample_shading from spirv_to_nir

We don't really want to base this on a late nir_gather_info for two
reasons:

 1) The Vulkan spec says that if a sample-qualified input, SampleID, or
    SamplePosition are in the entry-point's interface, you get
    per-sample dispatch.  This means we really should gather this
    information before dead-code has a chance to delete anything.

 2) We want to be able to add nir_intrinsic_load_sample_pos intrinsics
    as part of lowering passes without causing per-sample interpolation.
    This means nir_gather_info needs to stop gathering it.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agoglsl/nir: Set uses_sample_shading from glsl_to_nir
Jason Ekstrand [Wed, 1 Dec 2021 21:49:38 +0000 (15:49 -0600)]
glsl/nir: Set uses_sample_shading from glsl_to_nir

We don't really want to base this on a late nir_gather_info for two
reasons:

 1) The GL spec says that any static use of a sample-qualified input,
    gl_SampleID, or gl_SamplePosition causes per-sample dispatch.  This
    means we really should gather this information before dead-code has
    a chance to delete anything.

 2) We want to be able to add nir_intrinsic_load_sample_pos intrinsics
    as part of lowering passes without causing per-sample interpolation.
    This means nir_gather_info needs to stop gathering it.

For 1, this doesn't actually get us quite there as GLSL IR may have
deleted something already.  However, it does get us closer.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agointel/fs: Use nir_lower_single_sampled
Jason Ekstrand [Fri, 19 Nov 2021 19:00:09 +0000 (13:00 -0600)]
intel/fs: Use nir_lower_single_sampled

This lets us drop demote_sample_qualifiers as well as a back-end check
for key->multisample_fbo.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agonir: Add a pass for lowering shaders to single-sampled
Jason Ekstrand [Wed, 1 Dec 2021 22:30:08 +0000 (16:30 -0600)]
nir: Add a pass for lowering shaders to single-sampled

On Intel, we have to do this because we can't ask for the per-sample
barycentrics without setting the per-sample dispatch bit or the GPU will
hang.  However, nothing we're doing in this pass is Intel-specific and
it may be a useful optimization for someone else so we may as well make
it a generic NIR pass.  This version actually does a bit more than the
current brw_nir_demote_sample_qualifiers() pass as it also handles
pre-nir_lower_io interp_dref_at* as well as a couple system values which
we can easily constant-fold.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agointel/fs: Use shader_info::fs::uses_sample_shading
Jason Ekstrand [Fri, 19 Nov 2021 21:06:55 +0000 (15:06 -0600)]
intel/fs: Use shader_info::fs::uses_sample_shading

NIR constructs this information for us as part of nir_gather_info these
days so we can simplify our logic a bit.  This will also let us be more
correct once we move uses_sample_shading scraping earlier.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agoradv: Set uses_sample_shading for copy shaders
Jason Ekstrand [Wed, 13 Jul 2022 18:04:46 +0000 (13:04 -0500)]
radv: Set uses_sample_shading for copy shaders

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

2 years agointel/blorp: Set uses_sample_shading for MSAA blit shaders
Jason Ekstrand [Thu, 2 Dec 2021 05:15:09 +0000 (23:15 -0600)]
intel/blorp: Set uses_sample_shading for MSAA blit shaders

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14020>

2 years agopanfrost: Protect pandecode by a mutex
Alyssa Rosenzweig [Tue, 5 Jul 2022 19:21:53 +0000 (15:21 -0400)]
panfrost: Protect pandecode by a mutex

Pandecode is not thread-safe (for a large number of reasons) and does not even
try to be. This is a problem when tracing (or just using PAN_MESA_DEBUG=sync)
multithreaded applications. The most common symptom of the problem are assertion
failures deep in the red-black tree implementation, which is not thread-safe.

Just protect the whole thing by a "in pandecode?" mutex, since this is not
performance sensitive code and we don't really care about the extra
serialization incurred. As pandecode does not recurse into itself, we may simply
lock at the beginning and unlock at the end of each entrypoint in pandecode,
which is thread-safe regardless of how pandecode is used. A few entrypoints are
refactored to avoid early returns to keep the lock/unlock calls in obvious
visual pairs.

Fixes flakes when running the CL CTS with PAN_MESA_DEBUG=sync like we would in
CI (e.g: events.event_flush)

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Tested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17409>

2 years agopanfrost: Use implementation-specific tile size
Alyssa Rosenzweig [Thu, 7 Jul 2022 22:39:17 +0000 (18:39 -0400)]
panfrost: Use implementation-specific tile size

The physical tile buffer size (and hence the maximum available tilebuffer size)
are implementation-defined. Track this information on the device so we can
correctly select tile sizes, instead of hardcoding the value for Midgard.

Implementation values are pulled from the "Tile bits/pixel" row of the public
Mali data sheet [1]. That row lists the maximum number of bits available for a
pixel given the maximum tile size and pipelining. For currently supported
hardware (v9 and older), that maximum tile size is 16x16. So those values should
be multiplied by (16 * 16 * 2) / 8 to get the physical size in bytes.

This may improve Bifrost/Valhall performance on workloads using multiple render
targets. It also gets us ready for the dazzling array of tile sizes available
with v10.

[1] https://developer.arm.com/documentation/102849/latest/

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17432>

2 years agopanfrost: Make pan_select_max_tile_size O(1)
Alyssa Rosenzweig [Tue, 12 Jul 2022 20:45:09 +0000 (16:45 -0400)]
panfrost: Make pan_select_max_tile_size O(1)

Separate out "calculating the size of each pixel", "selecting a tile size", and
"calculating the colour buffer allocation". Then implement the middle (selecting
a tile size) with a simple constant time expression, rather than a loop. There's
a bit of related clean up in here.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17432>

2 years agopan/va: Handle BIFROST_MESA_DEBUG=nosb
Alyssa Rosenzweig [Wed, 22 Jun 2022 15:35:32 +0000 (11:35 -0400)]
pan/va: Handle BIFROST_MESA_DEBUG=nosb

For debugging flakes that might be caused due to wrong scoreboarding.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17223>

2 years agoir3: Fix the no-emitted-vertex condition emission in geom lowering.
Emma Anholt [Tue, 12 Jul 2022 23:10:17 +0000 (16:10 -0700)]
ir3: Fix the no-emitted-vertex condition emission in geom lowering.

The if statement we insert would insert a new block before the end block
(and remove the old pre-end-block).  If the new block ended up later in
the HT due to its pointer's hash value, you'd emit another copy of the if
statement after the last one.  I saw this happen up to 4 times in testing.
The worst case would be if all those additions and removals ended up
reallocating the HT, at which point we might use-after-free.

Fixes inconsistent shader-db results with geometry shaders.

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

2 years agopan/va: Print instructions with pack assert fails
Alyssa Rosenzweig [Fri, 8 Jul 2022 15:46:11 +0000 (11:46 -0400)]
pan/va: Print instructions with pack assert fails

va_pack asserts a large number of invariants about the instruction being packed.
If one of these fails (due to an invalid instruction), it's helpful to inspect
the failing instruction, as it may not be apparent in a large shader. Pass the
instruction through with all the assertions in va_pack for easier debugging.

Now assertion failures when packing are easier to debug:

   Invalid invariant lo.type == hi.type:
       = STORE.i32.flow2.wls br5, br2, wls_ptr[1], byte_offset:0

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17224>

2 years agopan/va: Use invalid_instruction in more places
Alyssa Rosenzweig [Fri, 8 Jul 2022 15:39:21 +0000 (11:39 -0400)]
pan/va: Use invalid_instruction in more places

By passing the instruction pointer through the packer, we can get better error
messages with invalid_instruction.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17224>

2 years agopan/va: Dump unencodable instructions
Alyssa Rosenzweig [Wed, 22 Jun 2022 21:01:02 +0000 (17:01 -0400)]
pan/va: Dump unencodable instructions

When we assert out due to certain invalid encoding, it's helpful to know what
instruction is causing the failure, since it may not be obvious from the
assembly for large shaders. Now we get nice errors when failing:

   Invalid opcode:
      br0 = VAR_TEX.f32.flow8.store.skip.lod_mode.center , texture_index:0, varying_index:0

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17224>

2 years agopanfrost: Only key points to point coord origin
Alyssa Rosenzweig [Mon, 20 Jun 2022 23:44:28 +0000 (19:44 -0400)]
panfrost: Only key points to point coord origin

Apparently, the point coord origin within a batch can change with Gallium
(seemingly even with GLES? where that's impossible at an API level?) but that
doesn't matter if we're not drawing points. This might have to do with internal
Gallium CSOs (e.g. u_blitter). Issue noticed in SuperTuxKart, which was getting
state change flushes. Performance on one level on a Valhall GPU improved from
26fps to 29fps.

Fixes: 3641dfe4367 ("panfrost: Flip point coords in hardware")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17430>

2 years agopanfrost: Revert provoking vertex assertion
Alyssa Rosenzweig [Tue, 12 Jul 2022 19:08:39 +0000 (15:08 -0400)]
panfrost: Revert provoking vertex assertion

b6a30b72ab3 ("panfrost: Implement provoking vertices on Valhall") added an
assertion that every draw selects a particular provoking vertex. The intent was
to ensure provoking vertex selection actually happened. Unfortunately, the
assertion is too strong, as the provoking vertex is irrelevant for some (most)
draws. For those, we don't *want* to commit to a particular provoking vertex for
those to avoid flushing.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17430>

2 years agoglx: Fix drawable refcounting for naked Windows
Adam Jackson [Mon, 11 Jul 2022 23:30:05 +0000 (19:30 -0400)]
glx: Fix drawable refcounting for naked Windows

driFetchDrawable is only ever called from the MakeCurrent path, which
means it has to handle the case of pre-GLX-1.3 Windows being named as
the drawable. When it finds the drawable in the hash, it increments its
refcount before returning it, so for a GLXWindow it would be 2 on first
return, one from glXCreateWindow and one from glXMakeCurrent. But when
it does not find the drawable and creates one for the naked Window, the
reference count on first return would only be 1. As a result, if this
context was then ever bound to a different drawable, the old Window's
DRI drawable state (like the back buffer) would be destroyed.

Fixes piglit's glx-multi-window-single-context and glx-make-current for
a variety of drivers.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6713
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17479>

2 years agointel/compiler: print shaders after nir_remove_unused_varyings
Marcin Ślusarz [Wed, 13 Jul 2022 11:52:52 +0000 (13:52 +0200)]
intel/compiler: print shaders after nir_remove_unused_varyings

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

2 years agoetnaviv: tex_desc: remove descriptor patch TODO comment
Lucas Stach [Sun, 10 Jul 2022 14:37:25 +0000 (16:37 +0200)]
etnaviv: tex_desc: remove descriptor patch TODO comment

There is nothing more TODO here. With softpin, which is available on all
GPUs using texture descriptors, there is no need for the kernel to patch
the descriptor, as the proper GPU virtual address is filled in by userspace.

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

2 years agoetnaviv: tex_desc: make error handling more consistent
Lucas Stach [Sun, 10 Jul 2022 14:21:02 +0000 (16:21 +0200)]
etnaviv: tex_desc: make error handling more consistent

There already is a error handling label to free the sampler view
struct and return failure. Consistently use this label to make
error handling more uniform.

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

2 years agoetnaviv: add texture descriptor suballocator
Lucas Stach [Sun, 10 Jul 2022 14:03:45 +0000 (16:03 +0200)]
etnaviv: add texture descriptor suballocator

Texture descriptors currently waste a massive ammount of memory, as every
one is allocated via a separate BO. As the allocation granularity of the
kernel is 4KB and the descriptor is only 256B, 93.75% of the allocated
memory is wasted.

Add a simple suballocator for the texture descriptors, to allocate multiple
ones out of a single kernel BO. This isn't perfect, as freed slots in the
suballocated resource are not reused, but worst-case we end up with the
same waste as we had before. This also potentially improves efficiency at
the kernel side, as this reduces the number of BOs needed for the sampler
views in each submit.

As the BO is now used by multiple descriptors, avoid syncing with the GPU
via the cpu_prep/fini calls, as to not introduce stalls between pending
rendering and new descriptors being filled. This is safe, as each
suballocation slot is only used once, so newly filled slots are certainly
not in use by the GPU.

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

2 years agoetnaviv: move dummy BOs to screen
Lucas Stach [Sun, 10 Jul 2022 13:21:00 +0000 (15:21 +0200)]
etnaviv: move dummy BOs to screen

The dummy texture descriptor and the dummy render target relocs are not ever
changed by a context operation, so we can save some space by moving them to
the screen and potentially share them and the BOs backing them between
multiple contexts.

Also don't hold two pointers to the same BO, one in the reloc and one raw,
but always just use the reloc one.

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

2 years agozink: add missing guards around `have_{ext}`
Eric Engestrom [Mon, 11 Jul 2022 22:33:37 +0000 (23:33 +0100)]
zink: add missing guards around `have_{ext}`

Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17466>

2 years agozink: drop unused VkPhysicalDevicePortabilitySubsetPropertiesKHR
Eric Engestrom [Mon, 11 Jul 2022 22:31:25 +0000 (23:31 +0100)]
zink: drop unused VkPhysicalDevicePortabilitySubsetPropertiesKHR

Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17466>

2 years agozink: fix portability_subset usage after rename from EXTX to KHR
Eric Engestrom [Mon, 11 Jul 2022 17:40:04 +0000 (18:40 +0100)]
zink: fix portability_subset usage after rename from EXTX to KHR

Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17466>

2 years agor600/sfn: emulate pmr::monotonic_buffer_resource if needed
Gert Wollny [Mon, 11 Jul 2022 06:58:48 +0000 (08:58 +0200)]
r600/sfn: emulate pmr::monotonic_buffer_resource if needed

libc++ does not yet implement the c++17 monotonic_buffer_resource,
so emulate it by doing normal allocations that are cleaned up
when the resource is destroyed.

v2: - Use C include and version without namespace aligned_alloc
    - add include for sstream needed with clang++ (maurossi)

Closes: #6836
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17452>

2 years agor600/sfn: lower CLIPVERTEX to clip planes
Gert Wollny [Sun, 3 Jul 2022 17:04:05 +0000 (19:04 +0200)]
r600/sfn: lower CLIPVERTEX to clip planes

With that most piglits for compatibility contexts are
passing, so enable higher compatibility profile support.

v2: fix formatting ahd fallthrough tag (Filip)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17484>

2 years agor600/sfn: Add support for fdph
Gert Wollny [Tue, 12 Jul 2022 09:45:58 +0000 (11:45 +0200)]
r600/sfn: Add support for fdph

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17484>

2 years agor600/sfn: Never consider an op with register dest as dead
Gert Wollny [Mon, 11 Jul 2022 18:09:59 +0000 (20:09 +0200)]
r600/sfn: Never consider an op with register dest as dead

Another hot-fix: when a local register is written to, it is
actually unlikely that the value is never used, so just make
sure that this is never done.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17484>

2 years agor600: limit loops when trying to merge alu groups
Gert Wollny [Mon, 11 Jul 2022 17:34:05 +0000 (19:34 +0200)]
r600: limit loops when trying to merge alu groups

On Cayman bank_swizzle[4] is never counted up, so add an
additional condition to make sure the loop is finished
at one point. This is a hot-fix, the logic below should be
improved.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17484>

2 years agopvr: Implicitly assert that the correct sub-command type is present
Matt Coster [Mon, 4 Jul 2022 11:51:12 +0000 (12:51 +0100)]
pvr: Implicitly assert that the correct sub-command type is present

Now that we have separate C types for the different sub-command types,
we can require a pointer to that type to be passed into functions
which expect the current sub-command to be of a specific type.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17458>

2 years agopvr: Split out unioned structs from struct pvr_sub_cmd
Matt Coster [Wed, 29 Jun 2022 10:34:09 +0000 (11:34 +0100)]
pvr: Split out unioned structs from struct pvr_sub_cmd

This is a simple optimization to make type-specific uses of struct
pvr_sub_cmd slightly less verbose.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17458>

2 years agopvr: Implement vkCmdDraw API.
Rajnesh Kanwal [Wed, 29 Jun 2022 11:16:44 +0000 (12:16 +0100)]
pvr: Implement vkCmdDraw API.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17487>

2 years agov3d,v3dv: stop copying and pasting the translate_swizzle helper
Iago Toral Quiroga [Wed, 13 Jul 2022 07:24:18 +0000 (09:24 +0200)]
v3d,v3dv: stop copying and pasting the translate_swizzle helper

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

2 years agov3d: stop using a smaller texture limit in OpenGL
Iago Toral Quiroga [Wed, 13 Jul 2022 07:05:01 +0000 (09:05 +0200)]
v3d: stop using a smaller texture limit in OpenGL

The compiler has improved significantly since we found this issue
and this is no longer required.

Notice that because we are increasing the number of samplers
supported beyond what we can loop unroll (currently capped at 16),
some piglit tests that test the maximum number of samplers supported
start to fail because they use indirect indexing on a sampler array
and we don't support that (previously the indirect indexing was
removed by loop unrolling). This is a bug in tests which the
GLSL linker detects, failing to compile the shaders.

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

2 years agov3d,v3dv: stop hardcoding various image limits
Iago Toral Quiroga [Wed, 13 Jul 2022 06:41:10 +0000 (08:41 +0200)]
v3d,v3dv: stop hardcoding various image limits

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

2 years agov3dv: clean up get_internal_type_bpp_for_image_aspects
Iago Toral Quiroga [Wed, 13 Jul 2022 06:15:59 +0000 (08:15 +0200)]
v3dv: clean up get_internal_type_bpp_for_image_aspects

Also, remove the FIXME to pre-compute this in images. We only use
this helper from copy/clear operations where we may be working
with a compatible framebuffer format instead of the original image.

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

2 years agonine: replace ulimit with sysconf call
newbluemoon [Mon, 11 Jul 2022 19:21:35 +0000 (21:21 +0200)]
nine: replace ulimit with sysconf call

__UL_GETOPENMAX seems to be glibc specific and not portable.
In glibc’s sysdeps/posix/ulimit.c it is assigned the return
value of sysconf(_SC_OPEN_MAX). So use the latter in the first place.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5176
CC: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17471>

2 years agoiris,anv: correct the max thread number for DG2+
Chuansheng Liu [Fri, 24 Jun 2022 02:19:03 +0000 (10:19 +0800)]
iris,anv: correct the max thread number for DG2+

Correct the max thread number for DG2+ platforms according
to below bspec.

Ref: Bspec: 47202

Cc: mesa-stable
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chuansheng Liu <chuansheng.liu@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17506>

2 years agonir/opt_algebraic: Optimize [ui](add|sub)_sat with 0.
Georg Lehmann [Mon, 11 Jul 2022 18:55:37 +0000 (20:55 +0200)]
nir/opt_algebraic: Optimize [ui](add|sub)_sat with 0.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17468>

2 years agonir/lower_io: Fix array length of buffers larger than INT32_MAX.
Georg Lehmann [Mon, 11 Jul 2022 18:43:52 +0000 (20:43 +0200)]
nir/lower_io: Fix array length of buffers larger than INT32_MAX.

Before, if the ssbo is too large this would always return 0.
Also, this code is easier to optimize, so the common case of offset 0
and pot stride results in one ushr instead of 5+ instructions.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17468>

2 years agoir3: Implement [iu]sub_sat.
Georg Lehmann [Tue, 12 Jul 2022 18:33:49 +0000 (20:33 +0200)]
ir3: Implement [iu]sub_sat.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17468>

2 years agor600: Lower uadd_sat/usub_sat.
Georg Lehmann [Tue, 12 Jul 2022 18:32:00 +0000 (20:32 +0200)]
r600: Lower uadd_sat/usub_sat.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17468>

2 years agozink: Lower uadd_sat/usub_sat.
Georg Lehmann [Tue, 12 Jul 2022 18:29:00 +0000 (20:29 +0200)]
zink: Lower uadd_sat/usub_sat.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17468>

2 years agonir_to_tgsi: Lower uadd_sat/usub_sat.
Georg Lehmann [Tue, 12 Jul 2022 18:27:12 +0000 (20:27 +0200)]
nir_to_tgsi: Lower uadd_sat/usub_sat.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17468>

2 years agoutil: Don't block SIGSEGV for new threads
Panagiotis Apostolou [Tue, 28 Jun 2022 06:47:19 +0000 (08:47 +0200)]
util: Don't block SIGSEGV for new threads

SIGSEGV is used by Vulkan API trace layers to track user changes in
device memory mapped to user space. Now with drivers such as Zink, GLES
applications are translated into Vulkan API calls and therefore it is
possible to be tracked by Vulkan api trace layers.
Blocking SIGSEGV hinders one of the memory tracking mechanisms used by
such layers.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17273>

2 years agov3dv: fix comment for point_sprite_mask filed in shader key
Iago Toral Quiroga [Tue, 12 Jul 2022 10:30:00 +0000 (12:30 +0200)]
v3dv: fix comment for point_sprite_mask filed in shader key

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

2 years agoanv: skip flush/invalidate faster
Lionel Landwerlin [Tue, 12 Jul 2022 08:21:57 +0000 (11:21 +0300)]
anv: skip flush/invalidate faster

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

2 years agointel: protect against empty invalidate ranges
Lionel Landwerlin [Tue, 12 Jul 2022 08:20:10 +0000 (11:20 +0300)]
intel: protect against empty invalidate ranges

It's legal for an application to call vkInvalidateMappedMemoryRanges()
/ vkFlushMappedMemoryRanges() with zero sized ranges.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: b91971c240d3 ("anv: use the right helper to invalidate memory")
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6852
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17481>

2 years agoradv: add a dynamic vertex format cache.
Dave Airlie [Mon, 11 Apr 2022 05:37:01 +0000 (15:37 +1000)]
radv: add a dynamic vertex format cache.

With dynamic vertex bindings the vertex format lookups are a lot
more frequent (vs being baked in the pipeline). Add a simple lookup
cache using a dynamic array to keep track of the hw values, and
avoid repeated translation.

This also reduces the memset to just the bitfields since all
the others will be overwritten.

Seen in perf traces gputest gimark with zink on radv.

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

2 years agoanv: add a comment about handling buffer view swizzles on gfx7
Lionel Landwerlin [Tue, 12 Jul 2022 20:07:00 +0000 (23:07 +0300)]
anv: add a comment about handling buffer view swizzles on gfx7

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17385>

2 years agoanv: validate image view lowered storage formats for storage
Lionel Landwerlin [Tue, 12 Jul 2022 15:33:47 +0000 (18:33 +0300)]
anv: validate image view lowered storage formats for storage

Ensure that if we have swizzle on the initial format, that the
component bits are identical with the lowered format.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17385>

2 years agoanv: deal with isl format swizzles for buffer views
Lionel Landwerlin [Wed, 6 Jul 2022 14:48:27 +0000 (17:48 +0300)]
anv: deal with isl format swizzles for buffer views

For some formats like VK_FORMAT_B5G6R5_UNORM_PACK16, we have no direct
matching HW format. We can support it by swizzling.

We already apply those swizzles for image views. We just forgot to
deal with buffer views.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6235
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17385>

2 years agodocs/u_trace: Add documentation for *_GPU_TRACEPOINT envvars
Danylo Piliaiev [Tue, 31 May 2022 11:04:27 +0000 (14:04 +0300)]
docs/u_trace: Add documentation for *_GPU_TRACEPOINT envvars

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16781>

2 years agofreedreno: Add FD_GPU_TRACEPOINT envvar to toggle tracepoints
Danylo Piliaiev [Tue, 31 May 2022 09:51:13 +0000 (12:51 +0300)]
freedreno: Add FD_GPU_TRACEPOINT envvar to toggle tracepoints

All tracepoints are enabled by default.

Example:
 FD_GPU_TRACEPOINT=-flush_batch

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16781>

2 years agofreedreno: Refactor tracepoints generation to reduce duplication
Danylo Piliaiev [Mon, 30 May 2022 18:42:55 +0000 (21:42 +0300)]
freedreno: Refactor tracepoints generation to reduce duplication

This way we will not need to repeat arguments for "start" and "end"
tracepoints.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16781>

2 years agofreedreno: Add the rest of tracepoints with start/end to perfetto
Danylo Piliaiev [Tue, 31 May 2022 09:37:01 +0000 (12:37 +0300)]
freedreno: Add the rest of tracepoints with start/end to perfetto

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16781>

2 years agoturnip: Add TU_GPU_TRACEPOINT envvar to toggle tracepoints
Danylo Piliaiev [Tue, 31 May 2022 09:54:27 +0000 (12:54 +0300)]
turnip: Add TU_GPU_TRACEPOINT envvar to toggle tracepoints

All tracepoints are enabled by default.

Example:
 TU_GPU_TRACEPOINT=-sysmem_clear

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16781>

2 years agoturnip: Refactor tracepoints generation to reduce duplication
Danylo Piliaiev [Mon, 30 May 2022 17:49:16 +0000 (20:49 +0300)]
turnip: Refactor tracepoints generation to reduce duplication

This way we will not need to repeat arguments for "start" and "end"
tracepoints.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16781>

2 years agoutil/u_trace: Fix iteration over config_control
Danylo Piliaiev [Mon, 30 May 2022 18:40:47 +0000 (21:40 +0300)]
util/u_trace: Fix iteration over config_control

Fixes: e1811af75d5b9385f9811724557a81570d0ef98e
("util/perf: add options to enable/disable tracepoints")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16781>

2 years agoci/freedreno: Mark an occasional flake pass that happens on a530.
Emma Anholt [Tue, 12 Jul 2022 21:23:51 +0000 (14:23 -0700)]
ci/freedreno: Mark an occasional flake pass that happens on a530.

This MR just saw it happen for the second time I've noticed.

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

2 years agoloader: Just include driconf.h instead of redefining its values.
Emma Anholt [Mon, 11 Jul 2022 19:37:51 +0000 (12:37 -0700)]
loader: Just include driconf.h instead of redefining its values.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17470>

2 years agoegl: Just include driconf.h instead of redefining its values.
Emma Anholt [Mon, 11 Jul 2022 19:37:38 +0000 (12:37 -0700)]
egl: Just include driconf.h instead of redefining its values.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17470>

2 years agokopper: Respect the vblank_mode env var.
Emma Anholt [Thu, 7 Jul 2022 00:13:37 +0000 (17:13 -0700)]
kopper: Respect the vblank_mode env var.

We were defaulting to a swap interval of 1, but we can follow dri2/dri3's
lead and respect the driconf var.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17470>

2 years agoglx: Unify dri2/dri3 vblank_mode logic.
Emma Anholt [Mon, 11 Jul 2022 19:01:27 +0000 (12:01 -0700)]
glx: Unify dri2/dri3 vblank_mode logic.

We need it from kopper, as well.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17470>

2 years agokopper: Use the swap interval that was set at swapchain creation time.
Emma Anholt [Mon, 11 Jul 2022 19:24:17 +0000 (12:24 -0700)]
kopper: Use the swap interval that was set at swapchain creation time.

We need to track what the caller has given us for swap interval, and use
that to set the present mode at startup.

Fixes incorrect vblank syncing in apitrace's glretrace, which sets the
swap interval to 0 before the swapchain is made.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17470>

2 years agokopper: Fix the return value of kopperSetSwapInterval().
Emma Anholt [Mon, 11 Jul 2022 18:51:54 +0000 (11:51 -0700)]
kopper: Fix the return value of kopperSetSwapInterval().

Compare to dri2SetSwapInterval() and dri3_set_swap_interval()
implementations of the same method.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17470>

2 years agoetnaviv: Implement TXD
Marek Vasut [Sat, 23 Apr 2022 13:41:13 +0000 (15:41 +0200)]
etnaviv: Implement TXD

Fill in support for TXD instruction which emits shader TEXLDD opcode.

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

2 years agoetnaviv: Rename etna_emit_tex() args
Marek Vasut [Mon, 25 Apr 2022 21:35:26 +0000 (23:35 +0200)]
etnaviv: Rename etna_emit_tex() args

Rename the args from low_bias/compare to src1/src2, since they
are used for different purposes depending on the texture load
type. No functional change.

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

2 years agovenus: GetPhysicalDeviceSparseImageFormatProperties to match sparse support
Yiwei Zhang [Mon, 11 Jul 2022 22:36:02 +0000 (22:36 +0000)]
venus: GetPhysicalDeviceSparseImageFormatProperties to match sparse support

Test: dEQP-VK.api.info.sparse_image_format_properties2.*

Fixes: 1a7632e54b4 ("venus: add NO_FENCE_FEEDBACK perf option and disable sparse resource")

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17476>

2 years agomicrosoft/spirv_to_dxil: Fix discard to demote + return pass
Enrico Galli [Mon, 11 Jul 2022 21:15:40 +0000 (14:15 -0700)]
microsoft/spirv_to_dxil: Fix discard to demote + return pass

While SPIR-V's OpKill is block terminating, the converted discard
intrinsic is not block terminating. This can lead to issues where
instruction could be placed after discard.

This patch adds an extra pass that drops all instructions after discard
before we convert discards.

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