Commit Graph

65 Commits

Author SHA1 Message Date
Emma Anholt fcd96ce002 turnip: Use the GMEM CCU space for attachments when the stores won't.
Since the CCU only gets used for unaligned attachment stores or resolves
with the wrong formats, we can use that space for attachments in many
cases.

This gets two more of vk-5-normal's main renderpass's attachments to fit
in the next gmem_pixels increment, leaving 1 to go.  Other renderpasses do
get better gmem_pixels, and a few get better tile sizes as a result, but
the fps increase from those looks to be <.2% at least.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16921>
2022-08-03 16:54:15 +00:00
Emma Anholt b8a334b547 turnip: Split the tiling config into separate layouts based on CCU usage.
We now choose between two (equal as of this commit) layouts based on
whether the renderpass's stores will use the CCU space, and assert that we
always know the chosen layout when we go using the gmem offsets.

This required making vkCmdClearAttachments in a secondary take the 3D path
instead of gmem blits, since secondaries only have to be compatible with
the primary's renderpass, rather than equal.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16921>
2022-08-03 16:54:15 +00:00
Connor Abbott 9b844d7c42 tu: Add debug option to use emulated renderpass support
This should be useful for stress-testing dynamic rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>
2022-07-27 19:40:44 +00:00
Connor Abbott b90d628a7d tu: Use common vk_image_view base struct
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>
2022-07-27 19:40:44 +00:00
Connor Abbott ed125e6cca tu: Initial support for dynamic rendering
Support for suspend/resume will be added later. This just sets up
the internal render pass, and adds support to pipeline creation and
secondary inheritance.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>
2022-07-27 19:40:44 +00:00
Connor Abbott 2b8b5259c7 tu: Disable GMEM for multiview inside tu_render_pass_gmem_config
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>
2022-07-27 19:40:44 +00:00
Connor Abbott c42e7aa46c tu: Move TU_DONT_CARE_AS_LOAD into attachment_set_ops()
So that we can share it with dynamic rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>
2022-07-27 19:40:44 +00:00
Eric Engestrom 2c99dc5b22 turnip: use updated tokens from vk.xml
Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342>
2022-07-12 15:53:11 +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
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
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
Emma Anholt b282d504a4 turnip: Add a TU_DEBUG=perf debug option.
For doing performance investigation, I often find it useful to have a "are
we tripping over any of our performance TODOs?" flag, so add it and use it
in a few of the TODOs.

This also greatly cleans up the deqp-vk logs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16316>
2022-05-12 01:00:25 +00:00
Danylo Piliaiev 0c489f18cb turnip: Skip load/stores for tiles with no geometry
When HW binning is used tile loads/stores could be skipped
if there is no geometry in the tile.

Loads could be skipped when:
- The attachment won't be resolved, otherwise if load is skipped
  there would be holes in the resolved attachment;
- There is no vkCmdClearAttachments afterwards since it is likely
  a partial clear done via 2d blit (2d blit doesn't produce geometry).

Stores could be skipped when:
- The attachment was not cleared, which may happen by load_op or
  vkCmdClearAttachments;
- When store is not a resolve.

I chose to predicate each load/store separately to allow them to be
skipped when only some attachments are cleared or resolved.

Gmem loads are moved into separate cs because whether to emit
CP_COND_REG_EXEC depends on HW binning being enabled and usage of
vkCmdClearAttachments.

CP_COND_REG_EXEC predicate could be changed during draw_cs only
by perf query, in such case the predicate should be re-emitted.
(At the moment it is always re-emitted before stores)

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15974>
2022-04-29 09:29:55 +00:00
Emma Anholt 7ba63f516a turnip: Ignore TOP/BOTTOM_OF_PIPE bits in subpass src/dst dep flags.
gfxbench sets these between the gbuffer subpass and the following ones.
They should be no-ops as subpass dependencies.  gfxbench vk-5-debug perf
12.8 -> 14.6 fps thanks to getting gmem on the gbuffer rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15982>
2022-04-19 18:45:30 +00:00
Danylo Piliaiev ebc23ac963 turnip: Implement VK_ARM_rasterization_order_attachment_access
Trivially implemented by using A6XX_GRAS_SC_CNTL_SINGLE_PRIM_MODE.

This extension is useful for emulators e.g. AetherSX2 PS2 emulator and
could drastically improve performance when blending is emulated.

Relevant tests:
dEQP-VK.rasterization.rasterization_order_attachment_access.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15106>
2022-02-23 11:31:59 +00:00
Danylo Piliaiev dab34bd5c8 turnip: Use LATE_Z when there might be depth/stencil feedback loop
Otherwise a shader invocation would read the value which should have
been set AFTER this shader invocation.

Fixes tests:
 dEQP-VK.rasterization.rasterization_order_attachment_access.depth.samples_1.multi_draw_barriers
 dEQP-VK.rasterization.rasterization_order_attachment_access.stencil.samples_1.multi_draw_barriers

Fixes: 71595a189a
("tu: Fix feedback loops in sysmem mode")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15106>
2022-02-23 11:31:59 +00:00
Hyunjun Ko ddb3d30d47 turnip: Enable VK_KHR_separate_depth_stencil_layouts
We now start handling depth/stencil layouts separately when
adding implicit subpass dependancies.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13057>
2021-11-12 13:16:23 +00:00
Danylo Piliaiev ebca227db1 turnip: implement vk_dont_care_as_load workaround
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13367>
2021-10-18 17:26:41 +00:00
Jason Ekstrand a1ac8234ec turnip: Plumb non-startup errors through the new vk_error helpers
Also, change every vk_error to use the closest object instead of
fetching all the way back to the instance.

Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>
2021-10-07 20:51:36 +00:00
Danylo Piliaiev 4839f442e9 turnip: consider multiview_mask when clearing depth-stencil attachment
Otherwise only first layer is being cleared.

Would fix several VK_EXT_multi_draw tests:
 dEQP-VK.draw.multi_draw.overlapping.normal.max_draws.*.vert_only.multiview.no_offset

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12913>
2021-09-20 18:41:23 +00:00
Connor Abbott abf0ae014a tu: Properly handle waiting on an earlier pipeline stage
I never really implemented this properly, because I wasn't aware of the
clusters when doing the original pipeline barrier implementation. It
turns out that the Vulkan stages we get as part of the barriers are
actually good for something, because it turns out that the pipeline
state is split into stages, so earlier stages can run ahead of later
stages and sometimes we need to wait when an earlier stage depends on
the result of a later stage. This happens most often whenever a shader
reads the result of a color/depth attachment write, because attachment
writes happen in a logically later stage. However this could also happen
for a FS -> VS dependency.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12475>
2021-08-20 18:03:26 +00:00
Connor Abbott 2df5387e38 tu: Consider depth/stencil for implicit dependencies
Noticed by inspection.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12386>
2021-08-17 18:33:17 +00:00
Connor Abbott 09e0b29bb6 tu: Fix logic errors with subpass implicit dependencies
We were adding them if there was an external dep instead of if there
wasn't, and we were skipping the entire subpass which would've resulted
in attachments not getting marked as used.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12386>
2021-08-17 18:33:17 +00:00
Connor Abbott 71595a189a tu: Fix feedback loops in sysmem mode
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12360>
2021-08-16 08:57:10 +00:00
Connor Abbott 380d4904ea tu: Read some input attachments directly
It can happen that the user reads an input attachment as the first use
of that attachment. In that case there are no subpass dependencies
required at all, because there could be a pipeline barrier before the
renderpass instead, and in any case we assume that dependencies with the
first subpass as a destination can be executed only once outside the
renderpass. The result is that we only do a CACHE_INVALIDATE once
before the entire renderpass, but it's actually required after each GMEM
load, because input attachments read GMEM through UCHE and those writes
to GMEM invalidate UCHE.

While we could add the missing CACHE_INVALIDATE "by hand" somehow, it
turns out it's actually just as easy to do an optimization the blob
does, where it simply doesn't patch those input attachments and reads
them directly instead. This means we can skip allocating memory in GMEM
for them entirely in some circumstances.

This fixes e.g.
dEQP-VK.api.copy_and_blit.core.resolve_image.whole_array_image.4_bit
with TU_DEBUG=forcebin.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12213>
2021-08-10 16:45:53 +02:00
Danylo Piliaiev 20547a110e tu: delay decision of forcing sysmem due to subpass self-dependencies
DXVK always inserts vertex stage subpass self-dependency for every
subpass regardless of whether there actually would be a barrier.
This effectively disabled gmem rendering with DXVK.

Thus we delay the decision to disable gmem rendering until we
see a barrier with vertex stages.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12038>
2021-07-28 15:35:44 +00:00
Rob Clark c9bcd835fa turnip: Convert fd_dev_info to const pointer
Split out from earlier patch to reduce churn.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Jonathan Marek 1a6dd7f9b1 freedreno/common: unhardcode CCU color cache offset
Replace it with a calculation which works for all current GPUs.

Duplicated the calculation in both drivers because freedreno_dev_info isn't
meant for derived parameters (and drivers might want to just calculate on
the fly instead).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Hyunjun Ko 1a773c0009 turnip: add missing VKAPI_ATTR/CALL
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11099>
2021-06-14 02:01:57 +00:00
Danylo Piliaiev 519eb735a3 turnip: implement variableMultisampleRate
If subpass doesn't have depth/color attachments - samples count is
devised from VkPipelineMultisampleStateCreateInfo::rasterizationSamples.
Without variableMultisampleRate enabled all pipelines in such subpass
should have the same samples count; variableMultisampleRate allows
to have pipelines with different number of samples in one subpass,
given that it doesn't have depth/color attachments.

Blob doesn't have it enabled but there is no known reason for this.

Passes:
 dEQP-VK.pipeline.multisample.variable_rate.*

Fixes test:
 dEQP-VK.pipeline.framebuffer_attachment.no_attachments_ms

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9556>
2021-04-07 12:04:45 +00:00
Samuel Iglesias Gonsálvez 1200f6da0b turnip: implement VK_KHR_depth_stencil_resolve support
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6884>
2020-11-19 09:43:11 +00:00
Connor Abbott a1d2b215f1 tu: Use freedreno_dev_info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7385>
2020-11-02 18:07:05 +00:00
Jonathan Marek 8dc8922af2 turnip: implement legacy API functions separately
Move legacy API functions to a separate file, and implement them by calling
the new API functions, like tu_CreateRenderPass was already doing.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6920>
2020-09-30 17:02:55 +00:00
Connor Abbott 99a87e5e0e tu: Parse multiview render pass info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:17 +00:00
Connor Abbott f01a0dc27a tu: Translate VkRenderPassMultiviewCreateInfo to VkRenderPassCreateInfo2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:17 +00:00
Jonathan Marek 67b1163f9f turnip: add support for D32_SFLOAT_S8_UINT
Add support for D32_SFLOAT_S8_UINT, which requires special handling because
it is actually two images.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5537>
2020-08-04 11:40:18 +00:00
Connor Abbott f7f29a04b4 tu: Detect invalid-for-binning renderpass dependencies
This is all that was missing for stores & atomics.

Closes: #3196
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5738>
2020-07-24 18:43:40 +00:00
Jonathan Marek 1747f9fdd0 turnip: remove extra gmem alignment
Now that we clear the PITCHALIGN" field when filling GMEM input attachment
descriptors, we can get rid of the extra tile width alignment on a630/a640.

With the "block_align_shift" value change, this brings down the default
gmem_align from 16k to 4k on a630/a640 and down from 24k to 12k on a650,
to match the gallium driver.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5528>
2020-07-24 13:44:42 +00:00
Hyunjun Ko 5d3fdbc52b turnip: Use the common base object type and struct.
v2. Define new helper function to avoid duplicated a pair of function calls.
v3. Move new helper functions to vk_object.h and call them.
v4. Merge 2 commits to use commomn base object type and struct into one.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5539>
2020-07-14 02:48:30 +00:00
Jonathan Marek 64c2a10707 turnip: move some logic out of create_render_pass_common
CreateRenderPass2 is the common path now, it doesn't make sense to have a
create_render_pass_common. Rename it to tu_render_pass_gmem_config and
move logic not related to gmem config out of it.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5451>
2020-06-24 22:12:33 +00:00
Jonathan Marek c9c76f6832 turnip: use RenderPassCreateInfo for render_pass_add_implicit_deps
This gets rid of the some unnecessary values that were stored in
tu_render_pass for this. It also makes the render_pass_add_implicit_deps
more generic, with very few references to the tu_render_pass.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5451>
2020-06-24 22:12:33 +00:00
Jonathan Marek e4099201bc turnip: replace a memset(0) with zalloc in CreateRenderPass
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5451>
2020-06-24 22:12:33 +00:00
Jonathan Marek 70046145d1 turnip: translate CreateRenderPass to CreateRenderPass2
It doesn't cut down the code size by much, and might not be the ideal for
performance (unless the compiler is unexpectedly smart), but makes it
easier to maintain (no modifying the same code in two places) and will
allow some simplifications since we wont have to worry about trying to
share code between the two versions.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5451>
2020-06-24 22:12:33 +00:00
Jonathan Marek 0a84d22bf2 turnip: fix renderpass gmem configs when there are too many attachments
Since a value of at least "align" is used for nblocks, we might end up
with nblocks greater than the number of GMEM blocks remaining. Check for
this case and bail out, sysmem rendering will be used for such cases.

Fixes some of these tests:
dEQP-VK.pipeline.render_to_image.core.*.huge.*

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5499>
2020-06-18 03:15:27 +00:00
Connor Abbott 487aa807bd tu: Rewrite flushing to use barriers
Replace the various ad-hoc flushes that we've inserted, copied from
freedreno, etc. with a unified system that uses the user-supplied
information via vkCmdPipelineBarrier() and subpass dependencies.

There are a few notable differences in behavior:

- We now move setting RB_CCU_CNTL up a little in the gmem case, but
hopefully that won't matter too much. This matches what the Vulkan blob
does.

- We properly implement delayed setting of events, completing our
implementaton of events.

- Finally, of course, we should be a lot less flush-happy. We won't emit
useless CCU/cache flushes with multiple copies, renderpasses, etc. that
don't depend on each other, and also won't flush/invalidate the cache
around renderpasses unless we actually need to.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4964>
2020-06-09 14:40:52 +00:00
Connor Abbott 078aa9df8d tu: Move RENDER_COMPONENTS setting to pipeline state
This needs to be pipeline state because it can change when dual-source
blending is active.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5039>
2020-05-14 18:15:31 +00:00
Jonathan Marek c3ef0275c4 turnip: add adreno 650
Tile alignment is 96, with gmem alignment of 0x6000

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4608>
2020-04-24 17:42:01 +00:00
Jonathan Marek 44c6c145da turnip: improve GMEM load/store logic
Determine load/store at renderpass creation time.

This also fixes behavior with S8_UINT.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4588>
2020-04-22 17:45:33 +00:00
Jonathan Marek b6455e9a6a turnip: compute render_components/srgb_cntl at renderpass creation time
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4581>
2020-04-16 14:04:18 +00:00