platform/upstream/mesa.git
23 months agovulkan/wsi: return VK_SUBOPTIMAL_KHR for sw/x11 on window resize
Mike Blumenkrantz [Tue, 19 Jul 2022 20:40:06 +0000 (16:40 -0400)]
vulkan/wsi: return VK_SUBOPTIMAL_KHR for sw/x11 on window resize

the other codepaths all end up checking geometry in one way or another
in order to validate the extents, so add a check here to do the same

fixes #6893

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

23 months agoglsl: Remove optimize_swizzles.
Emma Anholt [Tue, 19 Jul 2022 05:12:36 +0000 (22:12 -0700)]
glsl: Remove optimize_swizzles.

It will get turned into SSA and copy-propagated in NIR, no need to walk
the IR collapsing it here.

iris shader-db results appear to be noise:

total instructions in shared programs: 8932195 -> 8932147 (<.01%)
instructions in affected programs: 537 -> 489 (-8.94%)
LOST:   12
GAINED: 11

lost/gained are simd32 switches in unigine, l4d2, portal2, asphalt9.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17613>

23 months agozink: invoke descriptor_program_deinit for programs on context destroy
Mike Blumenkrantz [Wed, 20 Jul 2022 15:44:16 +0000 (11:44 -0400)]
zink: invoke descriptor_program_deinit for programs on context destroy

this should make multi-context shutdown more stable

affects:
glx@glx-visuals-depth -pixmap
glx@glx-visuals-stencil

cc: mesa-stable

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

23 months agoglsl: Use the same NIR path for shared mem lowering as SPIRV does.
Emma Anholt [Mon, 18 Jul 2022 23:59:12 +0000 (16:59 -0700)]
glsl: Use the same NIR path for shared mem lowering as SPIRV does.

Now that we have no non-NIR drivers, we can retire the old code.  We just
need to pass the variable accesses through to it.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17610>

23 months agoradv: Enable task shader feature for NV_mesh_shader.
Timur Kristóf [Mon, 7 Feb 2022 16:31:26 +0000 (17:31 +0100)]
radv: Enable task shader feature for NV_mesh_shader.

Still hidden behind RADV_PERFTEST=nv_ms but now advertises
task shader support too.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Copy BO list to ACE internal CS.
Timur Kristóf [Fri, 24 Jun 2022 21:43:05 +0000 (23:43 +0200)]
radv: Copy BO list to ACE internal CS.

This is necessary to make sure the ACE internal cmdbuf
can access the same memory as the GFX cmdbuf.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Submit internal compute cmdbuf.
Timur Kristóf [Wed, 11 May 2022 23:27:03 +0000 (01:27 +0200)]
radv: Submit internal compute cmdbuf.

Use scheduled dependencies to create two submissions:
first we submit ACE then GFX.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Workaround MEC taskmesh dispatch hang when count buffer has zero.
Timur Kristóf [Tue, 12 Jul 2022 07:06:24 +0000 (09:06 +0200)]
radv: Workaround MEC taskmesh dispatch hang when count buffer has zero.

The DISPATCH_TASKMESH_INDIRECT_MULTI_ACE packet has a firmware bug,
it hangs the GPU when the draw count is zero.

This commit adds a workaround sequence using COND_EXEC packets
which make sure that this indirect packet is never executed when
the draw count is zero.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Support task shaders in secondary cmd buffers.
Timur Kristóf [Sat, 12 Feb 2022 20:30:55 +0000 (21:30 +0100)]
radv: Support task shaders in secondary cmd buffers.

Special consideration is needed to keep ACE and GFX in sync.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Synchronization for task shaders.
Timur Kristóf [Mon, 7 Feb 2022 23:28:44 +0000 (00:28 +0100)]
radv: Synchronization for task shaders.

Add a separate flush_bits field for tracking cache
flushes in the ACE internal cmdbuf.
In barriers and image transitions we add these flush bits to ACE.

Create a semaphore in the upload BO which makes it possible
for ACE to wait for GFX for the purpose of synchronization.
This is necessary when a barrier needs to block task shaders.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Implement mesh shading draw calls with task shaders.
Timur Kristóf [Mon, 7 Feb 2022 23:28:44 +0000 (00:28 +0100)]
radv: Implement mesh shading draw calls with task shaders.

This implements NV_mesh_shader draw calls with task shaders.

- On the GFX side:
  DISPATCH_TASKMESH_GFX for all draws
- On the ACE side:
  DISPATCH_TASKMESH_DIRECT_ACE for direct draws
  DISPATCH_TASKMESH_INDIRECT_MULTI_ACE for indirect draws

Additionally, the NV_mesh_shader indirect BO layout is
incompatible with AMD HW, so we add a function that copies
that into a suitable layout.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Introduce radv_before_taskmesh_draw.
Timur Kristóf [Tue, 15 Feb 2022 10:15:42 +0000 (11:15 +0100)]
radv: Introduce radv_before_taskmesh_draw.

This includes additional code that takes care of
handling the internal ACE cmdbuf.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Flush descriptors and push constants for task shaders.
Timur Kristóf [Sat, 12 Feb 2022 20:22:19 +0000 (21:22 +0100)]
radv: Flush descriptors and push constants for task shaders.

Task shaders are executed on the internal compute cmdbuf, so they
need special consideration.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Create internal cmdbuf when a graphics pipeline needs compute.
Timur Kristóf [Sat, 22 Jan 2022 09:10:41 +0000 (10:10 +0100)]
radv: Create internal cmdbuf when a graphics pipeline needs compute.

This is mainly going to be used by task shaders, because
the HW implementation mismatches the API:

- In the API, task shaders are considered graphics shaders which
  are part of a graphics pipeline and the draws are submitted to
  a graphics queue.
- The HW requires the driver to dispatch task shaders on
  an async compute queue.

When a pipeline is bound that has a task shader, create a
driver-internal ACE (async compute engine) cmdbuf which
we are going to submit to an ACE queue.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Add dispatch_initiator_task field to radv_device.
Timur Kristóf [Fri, 15 Jul 2022 10:06:11 +0000 (12:06 +0200)]
radv: Add dispatch_initiator_task field to radv_device.

This is going to be used with task shader dispatches.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Allow reusing pipeline compute state emit functions.
Timur Kristóf [Thu, 16 Jun 2022 12:42:28 +0000 (14:42 +0200)]
radv: Allow reusing pipeline compute state emit functions.

We are going to reuse them outside of radv_pipeline.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Minor cleanup of radv_queue_submit_normal.
Timur Kristóf [Wed, 13 Jul 2022 21:54:18 +0000 (23:54 +0200)]
radv: Minor cleanup of radv_queue_submit_normal.

- Move the uses_perf_counters ternary expression out of
  the loop into a variable called cs_offset.

- Constify cmd_buffer_count.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Move inline push constants to a new function.
Timur Kristóf [Tue, 12 Jul 2022 09:02:47 +0000 (11:02 +0200)]
radv: Move inline push constants to a new function.

This cleans up radv_flush_constants and also
the new function will be reused later.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Refactor view index emit to use a per-stage function.
Timur Kristóf [Fri, 15 Jul 2022 09:57:26 +0000 (11:57 +0200)]
radv: Refactor view index emit to use a per-stage function.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Refactor radv_emit_inline_push_consts to work with radeon_cmdbuf.
Timur Kristóf [Tue, 12 Jul 2022 08:10:54 +0000 (10:10 +0200)]
radv: Refactor radv_emit_inline_push_consts to work with radeon_cmdbuf.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Refactor radv_emit_descriptor_pointers to work with radeon_cmdbuf.
Timur Kristóf [Tue, 12 Jul 2022 08:06:07 +0000 (10:06 +0200)]
radv: Refactor radv_emit_descriptor_pointers to work with radeon_cmdbuf.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Refactor radv_emit_userdata_address to work with radeon_cmdbuf.
Timur Kristóf [Sat, 2 Jul 2022 10:46:32 +0000 (12:46 +0200)]
radv: Refactor radv_emit_userdata_address to work with radeon_cmdbuf.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Refactor some CP DMA functions to work with radeon_cmdbuf.
Timur Kristóf [Thu, 16 Jun 2022 12:45:01 +0000 (14:45 +0200)]
radv: Refactor some CP DMA functions to work with radeon_cmdbuf.

Allow emitting these packets without a radv_cmd_buffer object.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agoradv: Refactor predication for compute queues.
Timur Kristóf [Thu, 16 Jun 2022 14:40:45 +0000 (16:40 +0200)]
radv: Refactor predication for compute queues.

Initialize the inverted predication VA only when it is used
for the first time.

This is needed to get conditional rendering work correctly with
task shaders because the internal compute cmdbuf may not exist
yet when conditional rendering starts.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16531>

23 months agov3d/ci: update expected list
Juan A. Suarez Romero [Wed, 20 Jul 2022 16:43:43 +0000 (18:43 +0200)]
v3d/ci: update expected list

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17660>

23 months agozink: scale number of shader cache-get threads
Mike Blumenkrantz [Wed, 20 Jul 2022 16:55:52 +0000 (12:55 -0400)]
zink: scale number of shader cache-get threads

this should improve startup times for short tests

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

23 months agozink: handle null samplerview/image rebinds more gracefully
Mike Blumenkrantz [Wed, 20 Jul 2022 14:41:53 +0000 (10:41 -0400)]
zink: handle null samplerview/image rebinds more gracefully

fixes a crash in nine

cc: mesa-stable

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

23 months agozink: move layout-setting for dynamic render attachments after no-op case
Mike Blumenkrantz [Fri, 15 Jul 2022 02:13:41 +0000 (22:13 -0400)]
zink: move layout-setting for dynamic render attachments after no-op case

this avoids unnecessarily terminating a renderpass to insert unnecessary barriers

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

23 months agozink: allow no-op renderpass updates in zink_batch_rp()
Mike Blumenkrantz [Thu, 14 Jul 2022 22:02:39 +0000 (18:02 -0400)]
zink: allow no-op renderpass updates in zink_batch_rp()

in some cases it becomes desirable to "maybe" stop and start the current
renderpass, such as when updates MAY result in layout changes for attachments

for such cases, avoid splitting the renderpass unless it actually needs to
be split

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

23 months agozink: improve granularity of renderpass switching
Mike Blumenkrantz [Fri, 15 Jul 2022 20:53:33 +0000 (16:53 -0400)]
zink: improve granularity of renderpass switching

this should ensure that (future) renderpass recalcs will never split
a renderpass unnecessarily

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

23 months agozink: add a bits union for zink_render_pass_state comparisons
Mike Blumenkrantz [Fri, 15 Jul 2022 21:11:49 +0000 (17:11 -0400)]
zink: add a bits union for zink_render_pass_state comparisons

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

23 months agozink: reuse rt layout functions to refactor zink_render_pass_attachment_get_barrier_i...
Mike Blumenkrantz [Fri, 15 Jul 2022 20:45:14 +0000 (16:45 -0400)]
zink: reuse rt layout functions to refactor zink_render_pass_attachment_get_barrier_info()

maybe slightly easier to read?

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

23 months agozink: break out color rt layout calc
Mike Blumenkrantz [Fri, 15 Jul 2022 20:41:28 +0000 (16:41 -0400)]
zink: break out color rt layout calc

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

23 months agozink: break out zs renderpass layout calc
Mike Blumenkrantz [Fri, 15 Jul 2022 20:40:09 +0000 (16:40 -0400)]
zink: break out zs renderpass layout calc

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

23 months agozink: break out renderpass attachment load op calc
Mike Blumenkrantz [Fri, 15 Jul 2022 20:35:22 +0000 (16:35 -0400)]
zink: break out renderpass attachment load op calc

no functional changes

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

23 months agozink: split out rp_changed to be more granular for dynamic render
Mike Blumenkrantz [Fri, 15 Jul 2022 13:47:26 +0000 (09:47 -0400)]
zink: split out rp_changed to be more granular for dynamic render

sometimes a state change MAY require a renderpass change, but this change
will not require splitting the current renderpass

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

23 months agozink: add an assert to verify that deferred clears aren't added in renderpass
Mike Blumenkrantz [Fri, 15 Jul 2022 13:27:06 +0000 (09:27 -0400)]
zink: add an assert to verify that deferred clears aren't added in renderpass

this would be very, very broken

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

23 months agozink: remove redundant renderpass update check for clears
Mike Blumenkrantz [Fri, 15 Jul 2022 13:25:07 +0000 (09:25 -0400)]
zink: remove redundant renderpass update check for clears

this should be handled already in the clear code

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

23 months agozink: unflag ctx->rp_changed after dynamic render update
Mike Blumenkrantz [Fri, 15 Jul 2022 01:51:41 +0000 (21:51 -0400)]
zink: unflag ctx->rp_changed after dynamic render update

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

23 months agozink: do dynamic render implicit clear updates on rp_changed
Mike Blumenkrantz [Thu, 14 Jul 2022 22:17:30 +0000 (18:17 -0400)]
zink: do dynamic render implicit clear updates on rp_changed

this should be flagged correctly now

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

23 months agozink: flag renderpass change if renderpass clears change
Mike Blumenkrantz [Thu, 14 Jul 2022 22:16:36 +0000 (18:16 -0400)]
zink: flag renderpass change if renderpass clears change

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

23 months agozink: don't flag renderpass change on depth write change as often
Mike Blumenkrantz [Thu, 14 Jul 2022 22:04:46 +0000 (18:04 -0400)]
zink: don't flag renderpass change on depth write change as often

this is only "sometimes" required and only if dynamic render isn't being
used

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

23 months agozink: don't try to start a renderpass before CmdClearAttachments
Mike Blumenkrantz [Fri, 15 Jul 2022 14:07:52 +0000 (10:07 -0400)]
zink: don't try to start a renderpass before CmdClearAttachments

it should be impossible to reach this point if a renderpass is not active

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

23 months agollvmpipe: ignore multisample state for alpha_to_one
Mike Blumenkrantz [Tue, 19 Jul 2022 13:28:38 +0000 (09:28 -0400)]
llvmpipe: ignore multisample state for alpha_to_one

this is more accurate and fixes usage with lavapipe

cc: mesa-stable

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17627>

23 months agovulkan/wsi: fix multiple acquires for sw without mit-shm
Mike Blumenkrantz [Mon, 18 Jul 2022 01:45:32 +0000 (21:45 -0400)]
vulkan/wsi: fix multiple acquires for sw without mit-shm

in this case, lying about having multiple images and then returning the
same image every time doesn't work, so use the busy flag
and return an available image when possible

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

23 months agoradv, aco: Don't lower 16bit isign.
Georg Lehmann [Sat, 9 Jul 2022 12:04:16 +0000 (14:04 +0200)]
radv, aco: Don't lower 16bit isign.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17440>

23 months agoradv: Remove ineg from lower_bit_size_callback callback.
Georg Lehmann [Sat, 9 Jul 2022 11:58:55 +0000 (13:58 +0200)]
radv: Remove ineg from lower_bit_size_callback callback.

It's always lowered to isub.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17440>

23 months agoradv,aco: Don't lower and vectorize 16bit iabs.
Georg Lehmann [Sat, 9 Jul 2022 11:32:28 +0000 (13:32 +0200)]
radv,aco: Don't lower and vectorize 16bit iabs.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17440>

23 months agoaco: remove unnecessary exp_cnt increments
Rhys Perry [Mon, 27 Jun 2022 14:44:38 +0000 (15:44 +0100)]
aco: remove unnecessary exp_cnt increments

update_counters() already does this.

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

23 months agoaco: Initialize spill_ctx members in constructor.
Vinson Lee [Sun, 17 Jul 2022 21:15:57 +0000 (14:15 -0700)]
aco: Initialize spill_ctx members in constructor.

Fix defects reported by Coverity Scan.

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

Fixes: 7d340449086 ("aco: refactor VGPR spill/reload lowering")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17583>

23 months agozink: use gfx_barrier for synchronization when binding buffer descriptors
Mike Blumenkrantz [Tue, 19 Jul 2022 16:29:15 +0000 (12:29 -0400)]
zink: use gfx_barrier for synchronization when binding buffer descriptors

this will preserve existing shader stages in the access mask and avoid desync
later on

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

23 months agozink: fix viewport count tracking
Mike Blumenkrantz [Mon, 18 Jul 2022 16:18:47 +0000 (12:18 -0400)]
zink: fix viewport count tracking

the number of viewports in use is based on the outputs of the last vertex
stage, not the viewports passed by the state tracker

cc: mesa-stable

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

23 months agozink: call bind_last_vertex_stage() when binding vs
Mike Blumenkrantz [Mon, 18 Jul 2022 16:32:04 +0000 (12:32 -0400)]
zink: call bind_last_vertex_stage() when binding vs

ensure all the necessary updates are flagged

cc: mesa-stable

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

23 months agozink: improve oom error message
Mike Blumenkrantz [Fri, 15 Jul 2022 15:22:07 +0000 (11:22 -0400)]
zink: improve oom error message

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

23 months agozink: fix crashing on bo allocation failure
Mike Blumenkrantz [Fri, 15 Jul 2022 15:21:34 +0000 (11:21 -0400)]
zink: fix crashing on bo allocation failure

list init occurs after mem allocation, so check this first

cc: mesa-stable

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

23 months agozink: handle null samplerview in get_imageview_for_binding()
Mike Blumenkrantz [Mon, 11 Jul 2022 17:06:06 +0000 (13:06 -0400)]
zink: handle null samplerview in get_imageview_for_binding()

this is legal

cc: mesa-stable

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

23 months agozink: handle max_vertices=0 in geometry shader
Mike Blumenkrantz [Mon, 11 Jul 2022 16:04:22 +0000 (12:04 -0400)]
zink: handle max_vertices=0 in geometry shader

this is a weird corner case where glsl permits a zero value, so clamp to 1
and then don't emit any vertices to avoid driver hangs

affects:
dEQP-GL45-ES31.functional.geometry_shading.emit.points_emit_0_end_0

cc: mesa-stable

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

23 months agov3d/v3dv: use NIR_PASS(_
Alejandro Piñeiro [Mon, 18 Jul 2022 11:10:24 +0000 (13:10 +0200)]
v3d/v3dv: use NIR_PASS(_

Instead of NIR_PASS_V, when possible.

This was done recently on anv (see commit ce60195ec and MR#17014)

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

23 months agobroadcom/compiler: make several passes to return a progress
Alejandro Piñeiro [Tue, 19 Jul 2022 11:28:55 +0000 (13:28 +0200)]
broadcom/compiler: make several passes to return a progress

Two advantages:
   * When using NIR_DEBUG=nir_print_xx, will print outcome only if
     there is a change
   * We can use NIR_PASS(_, ...) instead of NIR_PASS_V, that has
     slightly more validation checks.

This includes:
  * v3d_nir_lower_image_load_store
  * v3d_nir_lower_io
  * v3d_nir_lower_line_smooth
  * v3d_nir_lower_load_store_bitsize
  * v3d_nir_lower_robust_buffer_access
  * v3d_nir_lower_scratch
  * v3d_nir_lower_txf_ms

As we are here we also simplify some of them by using the
nir_shader_instructions_pass helper.

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

23 months agobroadcom/compiler: removed unused function
Alejandro Piñeiro [Tue, 19 Jul 2022 11:19:43 +0000 (13:19 +0200)]
broadcom/compiler: removed unused function

It is not even implemented.

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

23 months agov3dv/pipeline: use nir_shader_instructions_pass when lowering layout
Alejandro Piñeiro [Mon, 18 Jul 2022 12:31:21 +0000 (14:31 +0200)]
v3dv/pipeline: use nir_shader_instructions_pass when lowering layout

The trigger for this commit was when we found that we were not calling
nir_metadata_preserve when lowering the layout code. But then I found
that it would be better to just update the code to use
nir_shader_instructions_pass, so we can avoid to manually:
   * Initialize the nir_builder
   * Call nir_foreach functions (we pass the callback)
   * Call nir_metadata_preserve functions (that as mentioned we were not calling)

We also get a nice cleanup of several functions by reducing the number
of parameters (we pass a state struct).

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

23 months agonir: call nir_metadata_preserve at nir_remove_unused_io_vars
Alejandro Piñeiro [Mon, 18 Jul 2022 13:28:16 +0000 (15:28 +0200)]
nir: call nir_metadata_preserve at nir_remove_unused_io_vars

Without it we got a metadata assert:
deqp-vk: ../src/compiler/nir/nir_metadata.c:108: nir_metadata_check_validation_flag: Assertion `!(function->impl->valid_metadata & nir_metadata_not_properly_reset)' failed

if we try to use NIR_PASS(_, instead of NIR_PASS_V (that among other
things, do more validations).

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>

23 months agobroadcom/compiler: use NIR_PASS for nir_lower_vars_to_ssa at v3d_optimize_nir
Alejandro Piñeiro [Mon, 18 Jul 2022 10:52:21 +0000 (12:52 +0200)]
broadcom/compiler: use NIR_PASS for nir_lower_vars_to_ssa at v3d_optimize_nir

There's no reason to not take into account progress at that point.

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

23 months agobroadcom/compiler: wrap nir_convert_to_lcssa with NIR_PASS_V
Alejandro Piñeiro [Wed, 13 Jul 2022 10:53:14 +0000 (12:53 +0200)]
broadcom/compiler: wrap nir_convert_to_lcssa with NIR_PASS_V

So we get it included with the NIR_DEBUG=print_xx debug options.

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

23 months agobroadcom: document which debug options are specific for a given driver
Alejandro Piñeiro [Tue, 5 Jul 2022 11:10:52 +0000 (13:10 +0200)]
broadcom: document which debug options are specific for a given driver

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

23 months agobroadcom: add no_merge_jobs debug option
Alejandro Piñeiro [Tue, 5 Jul 2022 11:04:59 +0000 (13:04 +0200)]
broadcom: add no_merge_jobs debug option

To avoid having a custom getenv on v3dv.

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

23 months agov3dv/device: add comment on depthClamp feature
Alejandro Piñeiro [Mon, 4 Jul 2022 12:49:53 +0000 (14:49 +0200)]
v3dv/device: add comment on depthClamp feature

As we can't support it, and I need to recheck now and then when I read
that code.

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

23 months agovulkan: allow null descriptor set layouts in pipeline layouts
Ricardo Garcia [Wed, 20 Jul 2022 10:13:53 +0000 (12:13 +0200)]
vulkan: allow null descriptor set layouts in pipeline layouts

VK_NULL_HANDLE descriptor set layouts are allowed when creating pipeline
layouts without VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT.

From VUID-VkPipelineLayoutCreateInfo-graphicsPipelineLibrary-06753:

> If graphicsPipelineLibrary is not enabled, elements of pSetLayouts
> must be valid VkDescriptorSetLayout objects

From VUID-VkPipelineLayoutCreateInfo-pSetLayouts-parameter:

> If setLayoutCount is not 0, pSetLayouts must be a valid pointer to an
> array of setLayoutCount valid or VK_NULL_HANDLE VkDescriptorSetLayout
> handles

Signed-off-by: Ricardo Garcia <rgarcia@igalia.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17629>

23 months agov3dv: fix offset reported by vkGetImageSubresourceLayout
Iago Toral Quiroga [Wed, 20 Jul 2022 08:35:18 +0000 (10:35 +0200)]
v3dv: fix offset reported by vkGetImageSubresourceLayout

This represents an offset from the actual start of the image data,
not from the start of the memory allocation bound to the image.

Fixes:
dEQP-VK.image.subresource_layout.*

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

23 months agov3dv: remove assert that poolSizeCount must be larger than 0
Iago Toral Quiroga [Wed, 20 Jul 2022 07:56:30 +0000 (09:56 +0200)]
v3dv: remove assert that poolSizeCount must be larger than 0

From the Vulkan spec:

   "If poolSizeCount is not 0, pPoolSizes must be a valid pointer to an
    array of poolSizeCount valid VkDescriptorPoolSize structures"

So 0 is actually allowed and there is a CTS to check it is handled gracefully.

Fixes:
dEQP-VK.api.descriptor_pool.zero_pool_size_count

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

23 months agov3dv: handle VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT
Iago Toral Quiroga [Tue, 19 Jul 2022 07:05:09 +0000 (09:05 +0200)]
v3dv: handle VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT

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

23 months agonir: convert unused mesh outputs to shared memory
Marcin Ślusarz [Wed, 13 Jul 2022 11:55:32 +0000 (13:55 +0200)]
nir: convert unused mesh outputs to shared memory

Otherwise reads from output in one subgroup may not see
writes from other subgroups. Temp variables are later converted
to scratch, so even within one subgroup we may not see correct values.

Test case in https://gitlab.freedesktop.org/mesa/crucible/-/merge_requests/115

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17517>

23 months agoci: wine-apitrace bump to 11.1
David Heidelberg [Mon, 18 Jul 2022 15:05:33 +0000 (17:05 +0200)]
ci: wine-apitrace bump to 11.1

In the future, bump will be needed to update non-VK tags as wine traces get
used elsewhere.

Reviewed-by: Andres Gomez <agomez@igalia.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17623>

23 months agov3d/ci: (partially) revert expected list
Juan A. Suarez Romero [Wed, 20 Jul 2022 07:36:52 +0000 (09:36 +0200)]
v3d/ci: (partially) revert expected list

This reverts the traces expected list changed in f3579a62e9b
("v3d/v3dv/ci: update expected results").

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17647>

23 months agozink: default to lazy/templated descriptors
Mike Blumenkrantz [Tue, 19 Jul 2022 14:12:33 +0000 (10:12 -0400)]
zink: default to lazy/templated descriptors

cached mode was great 2 years ago when template support was less widespread,
but now that templates are everywhere, caching is less performant in
every scenario

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

23 months agozink: add an explicit ZINK_DESCRIPTOR_MODE_CACHED
Mike Blumenkrantz [Tue, 19 Jul 2022 14:08:07 +0000 (10:08 -0400)]
zink: add an explicit ZINK_DESCRIPTOR_MODE_CACHED

no functional changes, but now AUTO is no longer a mode that gets used

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

23 months agozink: delete ZINK_DESCRIPTOR_MODE_NOFALLBACK
Mike Blumenkrantz [Tue, 19 Jul 2022 14:02:46 +0000 (10:02 -0400)]
zink: delete ZINK_DESCRIPTOR_MODE_NOFALLBACK

this was useful for testing but is going to be less useful soon

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

23 months agozink: move descriptor_mode to be a global
Mike Blumenkrantz [Tue, 19 Jul 2022 13:58:03 +0000 (09:58 -0400)]
zink: move descriptor_mode to be a global

this can't change once it's been set, so having it per-object is pointless

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

23 months agonir/loop_unroll: clean up after complex_unroll_single_terminator()
Timothy Arceri [Mon, 18 Jul 2022 09:18:15 +0000 (19:18 +1000)]
nir/loop_unroll: clean up after complex_unroll_single_terminator()

Previously we would just unroll the loop one extra iteration and let
other optimisation passes clean up the mess. This worked to a degree
but if the loop happened to be nested inside another loop we would
end up with phi chains that would block other passes from being able
to do the cleanup.

With this commit we explicitly clone the variables create by lcsaa
and insert them directly in the last continue branch after we are done
unrolling. With this optimisation passes can recognise both sides
of the if output the same values and can progress further.

Help with the issues described in:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/6051

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

23 months agolavapipe: state latest conformance tests passed
Dave Airlie [Tue, 28 Sep 2021 23:45:07 +0000 (09:45 +1000)]
lavapipe: state latest conformance tests passed

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Cc: mesa-stable "22.1"
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17643>

23 months agoturnip: Disable LRZ fast-clear for gen1 and gen2
Danylo Piliaiev [Mon, 18 Jul 2022 15:59:32 +0000 (18:59 +0300)]
turnip: Disable LRZ fast-clear for gen1 and gen2

LRZ fast-clear works on all gens, however blob disables it on
gen1 and gen2. We also elect to disable fast-clear on these gens
because for close to none gains it adds complexity and seem to work
a bit differently from gen3+. Which creates at least one edge case:
if first draw which uses LRZ fast-clear doesn't lock LRZ direction
the fast-clear value is undefined.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6829

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

23 months agoci/freedreno: Switch a630 to manual/disabled for lab maintenance.
Emma Anholt [Tue, 19 Jul 2022 22:29:34 +0000 (15:29 -0700)]
ci/freedreno: Switch a630 to manual/disabled for lab maintenance.

We're getting several more 630s in the lab, but need a bit of time to swap
out some broken old ones and stabilize the new ones.  Fritz thinks this
should be done in an hour or so, but I want to turn off the CI for main so
that we don't block anyone else.

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

23 months agovenus: reenable VK_EXT_extended_dynamic_state2
Yiwei Zhang [Sat, 16 Jul 2022 16:48:25 +0000 (16:48 +0000)]
venus: reenable VK_EXT_extended_dynamic_state2

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

23 months agovenus: check dynamic state for raster enablement
Yiwei Zhang [Sat, 16 Jul 2022 16:20:48 +0000 (16:20 +0000)]
venus: check dynamic state for raster enablement

We should not scrub raster dedicated states when dynamic state includes
VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE.

Test:
- dEQP-VK.pipeline.extended_dynamic_state.*_raster
- dEQP-VK.api.pipeline.pipeline_invalid_pointers_unused_structs.graphics

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

23 months agocrocus: fail query begin if upload allocation fails.
Dave Airlie [Tue, 19 Jul 2022 05:46:14 +0000 (15:46 +1000)]
crocus: fail query begin if upload allocation fails.

This is the only place I think I can see this crashing.

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

23 months agoZink: Fix clear being missed when using emulated draws in zink_blit
SoroushIMG [Tue, 19 Jul 2022 13:50:11 +0000 (14:50 +0100)]
Zink: Fix clear being missed when using emulated draws in zink_blit

zink_kopper_acquire_readback will flush any outstanding clears, this means that
the current clears need to be applied first before calling zink_kopper_acquire_readback.
This was already done for native_blit and native_resolve, also do this for the emulated draw path.
Seen as intermittent failures in cts case GTF-GL33.gtf21.GL2FixedTests.buffer_clear.buffer_clear.

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

23 months agozink: Fix spirv stream 0 vertex emit for multistream shaders
SoroushIMG [Wed, 13 Jul 2022 10:59:05 +0000 (11:59 +0100)]
zink: Fix spirv stream 0 vertex emit for multistream shaders

Spirv spec does not allow the use of OpEmitVertex or OpEndPrimitive when there are multiple streams.
Instead emit the multi-stream version of these with stream set to 0.
This issue was seen when testing cts case KHR-GL46.transform_feedback.draw_xfb_stream_test

Fixes: 35e346f4280 ("zink: handle vertex streams")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17513>

23 months agoanv: Do depth/stencil optimization for dynamic depth/stencil
Jason Ekstrand [Fri, 15 Jul 2022 02:02:35 +0000 (21:02 -0500)]
anv: Do depth/stencil optimization for dynamic depth/stencil

When we made depth/stencil dynamic, we lost the optimization.  This is
particularly important for cases where the stencil test is enabled but
never writes anything as certain combinations with discard can cause
the stencil write (which doesn't do anything) to get moved late which
can be a measurable perf hit.  According to 028e1137e67b ("anv/pipeline:
Be smarter about depth/stencil state", it was a couple percent for DOTA2
on Broadwell back in the day.  No idea how it affects current titles.

This may also improve the depth/stncil PMA workarounds on Gen8 and Gen9
since they're now looking at optimized depth/stencil state.

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

23 months agovulkan/graphics_state: Improve the depth/stencil optimization code
Jason Ekstrand [Fri, 15 Jul 2022 01:59:38 +0000 (20:59 -0500)]
vulkan/graphics_state: Improve the depth/stencil optimization code

We now disable stencil writes when the stencil test is disabled or when
both stencil write masks are zero.

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

23 months agoanv: Switch to using common dynamic state tracking
Jason Ekstrand [Thu, 14 Jul 2022 20:09:46 +0000 (15:09 -0500)]
anv: Switch to using common dynamic state tracking

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

23 months agoanv: Stop merging DEPTH_STENCIL state
Jason Ekstrand [Thu, 14 Jul 2022 16:55:04 +0000 (11:55 -0500)]
anv: Stop merging DEPTH_STENCIL state

Now that we've stopped trying to do dynamic stuff up-front, we're only
merging in one bit: DoubleSidedStencilEnable.  There's no point in all
the merging code for one bit which is a constant anyway.

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

23 months agoanv: Rework setting primitive topology
Jason Ekstrand [Thu, 14 Jul 2022 16:41:17 +0000 (11:41 -0500)]
anv: Rework setting primitive topology

For one thing, we were deceptively setting it wrong in genX_cmd_buffer.c
and then overwriting it in each of of gfx7_cmd_buffer.c and
gfx8_cmd_buffer.c.  Pull it all into genX_cmd_buffer.c so it's no longer
duplicated.  Also, stop doing the PATCHLIST conversion in anv_pipeline.c
and just store the number of patch vertices.

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

23 months agoanv: Convert to using vk_graphics_pipeline_state
Jason Ekstrand [Tue, 12 Jul 2022 21:16:55 +0000 (16:16 -0500)]
anv: Convert to using vk_graphics_pipeline_state

This attempts to be a pretty minimal refactor.  We just switch all the
state emit code to use the new graphics pipeline state object.

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

23 months agoanv: remove pipeline setting dynamic state
Lionel Landwerlin [Sat, 2 Jul 2022 11:35:10 +0000 (14:35 +0300)]
anv: remove pipeline setting dynamic state

Following our rule that anything that can be dynamic should be set
(and is this case is already) in the following files :

   - genX_cmd_buffer.c
   - gfx8_cmd_buffer.c
   - gfx7_cmd_buffer.c

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17564>

23 months agoanv: Stop recording sample locations per-sample-count
Jason Ekstrand [Tue, 12 Jul 2022 21:30:46 +0000 (16:30 -0500)]
anv: Stop recording sample locations per-sample-count

The only reason why we recorded them per-sample-count is because Intel
hardware is weird starting with Broadwell.  The API, requires that the
dynamic sample pattern be reset every time the sample count changes so
we only need to record the pattern for the current sample count.

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

23 months agoanv: Handle vertex buffer sizes in anv_CmdBindVertexBuffers2
Jason Ekstrand [Tue, 5 Jul 2022 10:06:27 +0000 (05:06 -0500)]
anv: Handle vertex buffer sizes in anv_CmdBindVertexBuffers2

There's no good reason to defer figuring out the size until we emit the
packet.  We know everything when the bind happens.

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

23 months agoanv: Add an instance multiplier to anv_pipeline
Jason Ekstrand [Thu, 7 Jul 2022 16:43:12 +0000 (11:43 -0500)]
anv: Add an instance multiplier to anv_pipeline

This lets us get rid of the view_mask and pipeline replication logic
repeated all over everywhere.

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

23 months agospirv: handle phis decorated with RelaxedPrecision
Daniel Schürmann [Fri, 3 Jun 2022 12:00:11 +0000 (14:00 +0200)]
spirv: handle phis decorated with RelaxedPrecision

If the driver can do 16-bit ALU ops, then store RelaxedPrecision phi
values into 16-bit NIR variables with downconverts/upconverts on the way
in/out.

This has no impact on shader-db on freedreno (not that we have a ton of
GLES content there), but it does cause an ANGLE-translated CTS shader on
vulkan to get consistent conversions between two copies of a value, and
avoid a test bug.

Reviewed-by: Emma Anholt <emma@anholt.net>
Closes: #6585
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14018>

23 months agoci/bare-metal: Add timeouts to the shell commands called in fastboot.
Emma Anholt [Mon, 18 Jul 2022 21:16:05 +0000 (14:16 -0700)]
ci/bare-metal: Add timeouts to the shell commands called in fastboot.

It seems that we sometimes stall out executing "fastboot boot", and if
that happens we want to reboot the board and try again.

Fixes: #6682
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17607>

23 months agoradv: don't update misaligned_mask in CmdBindVertexBuffers2
Rhys Perry [Wed, 13 Jul 2022 15:43:44 +0000 (16:43 +0100)]
radv: don't update misaligned_mask in CmdBindVertexBuffers2

This can't do it in the loop because it doesn't easily know what
attributes use a binding.

We could do it in a separate loop, but there's no point, especially since
zink does CmdSetVertexInputEXT() after CmdBindVertexBuffers2().

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fixes: c335a4d70ed ("radv: dynamically calculate misaligned_mask for dynamic vertex input")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17521>