Commit Graph

1341 Commits

Author SHA1 Message Date
Jason Ekstrand 0c764afac1 turnip: Set supported_sync_types before wsi_init
The WSI code is about to start querying for available semaphore handle
types via GetPhysicalDeviceExternalSemaphoreProperties in wsi_init().
For drivers that use vk_sync, supported_sync_types needs to be
initialized before GetPhysicalDeviceExternalSemaphoreProperties is
called.  Really, wsi_init() should be the very last step of physical
device setup.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4037>
2022-06-10 01:33:12 +00:00
Jason Ekstrand 4c95b574d1 turnip: Use the common QueuePresent implementation
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4037>
2022-06-10 01:33:12 +00:00
Jason Ekstrand 513d73b160 turnip: Use the common AcquireNextImage implementation
The only reason for the wrapper was so that we could dummy signal the
semaphore and fence.  Now that the WSI code always dos this for us, we
can drop our wrapper.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4037>
2022-06-10 01:33:12 +00:00
Emma Anholt c426e21ff1 turnip: Reverse the order of walking pipes or tiles on odd rows.
This improves the cache locality compared to raster order.  Improves
gfxbench vk-5-normal perf by 3.3009% +/- 0.105934% (n=3).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16917>
2022-06-09 20:36:42 +00:00
Chia-I Wu 5c17a04282 turnip: consider render pass costs in autotune
To be able to sum drawcall cost and render pass cost, the units of costs
are changed to bytes.  With that, tu_autotune_use_bypass can make
decisions by comparing the costs of sysmem rendering and gmem rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16733>
2022-06-08 12:48:08 +00:00
Chia-I Wu ce118a7002 turnip: estimate render pass costs
They will be used by autotuner.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16733>
2022-06-08 12:48:08 +00:00
Chia-I Wu fe9a2374e6 turnip: include stencil test for drawcall costs
Stencil test reads from and writes to the stencil buffer.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16733>
2022-06-08 12:48:08 +00:00
Chia-I Wu 2dc10165a1 turnip: base pipeline draw costs on colorWriteMask
drawcall_base_cost estimates the memory bandwidth per sample.
colorWriteMask should be more accurate than fs outputs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16733>
2022-06-08 12:48:08 +00:00
Chia-I Wu 6fe7b92114 turnip: if-checks autotune debug macros
This avoids bitrot while the compiler can easily optimize away those
checks.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16733>
2022-06-08 12:48:08 +00:00
Emma Anholt 7af5929b54 turnip: Move tile loads back into the draw CS.
Now that we don't need to know if HW binning actually will get used or
not, we can just emit the tile loads into the start of the draw CS.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Danylo Piliaiev ecabd3b5a9 turnip: Allow nested CP_COND_REG_EXEC
This ends up being needed for moving tile loads into the draw cs.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Emma Anholt a92fad45e9 turnip: Allow load/store skipping in vkCmdClearAttachments().
We have to use a 3D draw to make it possible (so it goes through the
binner's visibility calcs), but hopefully the increased overhead for apps
with non-skippable rendering balances against skipping in others.

The real motivation is to get draw-time state out of tile load setup.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Emma Anholt b8619ef343 turnip: Refactor a bit of subpass attachment processing.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Emma Anholt 83ae4a5ed4 turnip: Include 3d-based CmdClearAttachments() in binning visibility.
It means the clear's draw can get skipped when it doesn't intersect with
the tile.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Emma Anholt 48403628a2 turnip: Refactor a bit of repeated code for subpass setup.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Emma Anholt 046438b7a4 turnip: Use fb->binning_possible to decide on conditional tile load/stores.
When !fb->binning but fb->binning_possible, we can just set the VSC
per-tile visibility reg to all visible in the "whoops, we'd rather not bin
but we had to anyway for XFB" case.  This gets that EndRenderPass state out
of tile_load_cs/store_cs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Emma Anholt 6c37b4ded1 turnip: Move binning decisions from FB usage time to FB creation time.
This is mostly about helping me understand which choices are constant for the object as opposed to runtime decisions.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Emma Anholt ceeaac340a turnip: Refactor a bit of tu6_emit_tile_select().
Reduce redundant code, make the used SET_VISIBILITY_OVERRIDE value clearer.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Emma Anholt 2cad0dd03b turnip: Don't bother creating tile_load/store_cs for sysmem rendering.
They won't get called, so don't bother.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>
2022-06-07 00:00:28 +00:00
Erik Faye-Lund 08f8ccfc60 turnip: do not do STATIC_ASSERT on a variable
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>
2022-06-03 07:14:43 +00:00
Hyunjun Ko 8eb5178a6d turnip: clamp to 1 for negative bottom-right of viewport.
This fixes a crash of spec@!opengl 3.0@viewport-clamp in
piglit(with zink).
Also fixes a crash of negativeviewportheight in Sascha's examples.

Closes: #6583

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16831>
2022-06-03 02:40:08 +00:00
Connor Abbott bd68559d36 tu: Enable shaderTessellationAndGeometryPointSize
This already works and AFAICT there was no reason to disable it other
than that the blob does.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16830>
2022-06-02 16:32:57 +00:00
Danylo Piliaiev eba8671e40 tu: Fix D32S8 resolves into D32 or S8 in sysmem mode
Fixes CTS tests in sysmem mode:
 dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d24_unorm_s8_uint.compatibility_depth_zero_stencil_zero_testing_depth
 dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d24_unorm_s8_uint_separate_layouts.compatibility_depth_zero_stencil_zero_testing_depth
 dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d24_unorm_s8_uint_separate_layouts.compatibility_depth_zero_stencil_zero_testing_stencil
 dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint.compatibility_depth_zero_stencil_zero_testing_depth
 dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint_separate_layouts.compatibility_depth_zero_stencil_zero_testing_depth
 dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint_separate_layouts.compatibility_depth_zero_stencil_zero_testing_stencil

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16834>
2022-06-02 16:01:46 +00:00
Emma Anholt bf49d4a084 freedreno/ir3: Enable load/store vectorization for SSBO access, too.
Saves a few ldib/stib instructions in gfxbench vk-5-normal compute shaders
by grouping vec4 accesses together.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16616>
2022-06-01 22:19:44 +00:00
Connor Abbott 68b10b39f7 tu: Implement VK_EXT_image_2d_view_of_3d
This is already allowed by the gallium driver, which uses the same code
for image layout and image views, so everything Just Works and the tests
pass. radv doesn't enable the sampler feature, but I don't see any
reason it wouldn't work and the tests pass.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16806>
2022-06-01 15:04:31 +00:00
Connor Abbott 2e9c53549b tu: Expose VK_KHR_synchronization2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16374>
2022-06-01 04:06:46 +00:00
Connor Abbott 59259a0167 tu: Convert to sync2 entrypoints
Use the common Vulkan fallbacks to implement the now-deprecated original
entrypoints.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16374>
2022-06-01 04:06:46 +00:00
Jason Ekstrand c8e191e369 turnip: Use nir_gather_xfb_info
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16750>
2022-05-31 23:09:30 +00:00
Jason Ekstrand 3e04432b3a nir: Rename nir_gather_xfb_info to nir_shader_get_xfb_info
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16750>
2022-05-31 23:09:30 +00:00
Mike Blumenkrantz aa32b96c51 turnip: fix assert for max xfb outputs
this is a counter, not an index, so use <=

cc: mesa-stable

Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16620>
2022-05-21 16:48:54 +00:00
Chia-I Wu 2a8e6a4d1a turnip: disable UBWC for SNORM formats
In copy_format, we treat snorm as unorm to avoid clamping.  But snorm
and unorm are UBWC incompatible for special values such as all 0's or
all 1's.  Disable UBWC for snorm.

For reference, I dumped the first byte of an UBWC blocks and it was

  color      UNORM  SNORM
  all black  0x01   0x31
  all white  0x0d   0x11

@flto clarified that bit 4 is unset for fast clear encoded blocks.  It
looks like fast clear is not used for SNORM.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6480
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16534>
2022-05-21 15:27:42 +00:00
Chia-I Wu e8eb6d13a5 turnip: fix tu6_pack_border_color for z24
The value should be at the bottom 24 bits, not at the top.

dEQP-VK.pipeline.sampler.* still passes.  This fixes most of
dEQP-GLES31.functional.texture_border_clamp.formats.*depth* on angle.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16570>
2022-05-21 00:54:28 +00:00
Hyunjun Ko f2635ca47b turnip: add an assertion for max descriptor set count.
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16624>
2022-05-20 09:49:00 +00:00
Jason Ekstrand c24aa449d0 vulkan,anv,turnip: Add a common CmdBindVertexBuffers wrapper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16611>
2022-05-20 02:12:37 +00:00
Emma Anholt a28d2e87d3 turnip: Make RelaxedPrecision-decorated ALU ops 16-bit.
Improves gfxbench vk-5-normal performance 5.5%.

Fixes: #6346
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16465>
2022-05-19 19:43:36 +00:00
Connor Abbott 9f67fa368e tu: Implement VK_EXT_pipeline_creation_cache_control
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16562>
2022-05-18 13:14:55 +00:00
Connor Abbott 49827da6fa tu: Implement VK_EXT_pipeline_creation_feedback
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16562>
2022-05-18 13:14:55 +00:00
Connor Abbott e348f2fb38 tu: Zero-initialize compute driver key
Fixes: 05329d7 ("tu: Implement pipeline caching with shared Vulkan cache")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16562>
2022-05-18 13:14:55 +00:00
Chia-I Wu 2410993ef6 turnip: fix off-by-one in border color bitset
BITSET_FFS reserves 0 for no bit set.  BITSET_CLEAR just below cleared
the wrong bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16567>
2022-05-17 23:29:15 +00:00
Chia-I Wu d3d34ad476 turnip: emit VPC_SO_DISABLE in xfb begin/end
SO was always enabled before this change.  That meant, after a call to
tu_CmdBindTransformFeedbackBuffersEXT to emit VPC_SO_BUFFER_SIZE, any
draw call (from the same render pass, in a different render pass, or in
a different cmdbuf) could potentially cause writes to the SO buffers
regardless of whether the draw is inside xfb begin/end or not.

I choose to emit VPC_SO_DISABLE instead of using stateobjs like
freedreno does only because it is simpler.  It is not clear to me which
is more efficient to HW.

This also fixes double SO writes for gmem rendering.  While
tu6_tile_render_begin was careful to disable SO for the draw pass,
tu6_emit_tile_select re-enabled it.

dEQP-VK.transform_feedback.* still passes.  It fixes
dEQP-GLES3.functional.transform_feedback.* on angle.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16502>
2022-05-16 20:46:59 +00:00
Chia-I Wu 0b7751babf turnip: fix sampledImageIntegerSampleCounts
It seems fine to advertise msaa in sampledImageIntegerSampleCounts.

dEQP-VK.rasterization.rasterization_order_attachment_access.format_integer.*
goes from NotSupported to Pass for more test cases.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16487>
2022-05-16 19:26:46 +00:00
Chia-I Wu cd42f63c43 turnip: let modifier takes precedence over TU_DEBUG=noubwc
TU_DEBUG=noubwc is not very usable on sway/xwayland where the wsi uses
modifiers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16507>
2022-05-14 21:56:38 +00:00
Connor Abbott 05329d7f9a tu: Implement pipeline caching with shared Vulkan cache
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
2022-05-13 17:07:05 +00:00
Connor Abbott 43981f0f58 tu: Include turnip debug flags in pipeline cache UUID
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
2022-05-13 17:07:05 +00:00
Connor Abbott d023ae4686 tu: Rewrite cache UUID based on radv
Switch to using sha1 so that we can add as many other flags as we need
to easily.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
2022-05-13 17:07:05 +00:00
Connor Abbott 410d59943d tu: Hash pipeline layout contents
Mostly adapted from anv.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
2022-05-13 17:07:05 +00:00
Connor Abbott 91160dab97 tu: Keep original blit shaders separately
We won't be able to access them once the ->shader link is gone.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
2022-05-13 17:07:05 +00:00
Connor Abbott 21e3dd57d3 ir3: Use ir3_shader_variant::type more often
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
2022-05-13 17:07:05 +00:00
Connor Abbott f45c86dfb7 ir3, fd, tu: Copy misc. info from ir3_shader to ir3_shader_variant
The shader won't be available for deserialized variants, so we need to
include all the info we need for compiling variants to be in the
variant. Most of the things we dug out of the shader were various bits
from nir_shader_info which we move into ir3_shader_variant.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
2022-05-13 17:07:05 +00:00
Connor Abbott 3e30608ceb ir3, freedreno, tu: Make ir3_shader_variant store stream_output
This reduces the number of uses of ir3_shader which will be gone when we
deserialize the variant directly.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
2022-05-13 17:07:05 +00:00