Commit Graph

312 Commits

Author SHA1 Message Date
Yiwei Zhang 2a87a741ae turnip: advertise VK_EXT_queue_family_foreign
Both Venus and Android AHB requires this extension.

Turnip ignores VK_SHARING_MODE_EXCLUSIVE so this is a no-op.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Acked-by: Rob Clark <robdclark@chromium.org>
Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14836>
2022-02-14 21:27:35 +00:00
Danylo Piliaiev 44bdac9849 tu: Implement VK_AMD_buffer_marker to support Graphics Flight Recorder
Graphics Flight Recorder is:
 "The Graphics Flight Recorder (GFR) is a Vulkan layer to help
  trackdown and identify the cause of GPU hangs and crashes.
  It works by instrumenting command buffers with completion tags."

This is a nice little tool which could help quickly identify the call
which hanged. Or if command buffer is executed for too long.

The tiling nature of our GPU shouldn't be a big issue aside from
lower performance.

For non-segfault case, if:
- Hang happens at the same place in cmdbuf and draw/dispatch is not
  finished at that point - it is likely that there is an infinite
  loop in some of the shaders in this draw.
- Hang happens always in different place - likely there is nothing
  wrong and command buffer just takes too long to execute and you
  should try increasing hangcheck_period_ms. If it doesn't help
  it is likely a synchronization issue.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13553>
2022-02-07 12:53:34 +02:00
Danylo Piliaiev fded7a95c5 turnip: Expose VK_KHR_shader_non_semantic_info
This is entirely implemented in the SPIR-V frontend.

Relevant CTS tests:
dEQP-VK.spirv_assembly.instruction.compute.non_semantic_info.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14829>
2022-02-04 09:24:06 +00:00
Danylo Piliaiev ff059605aa turnip: Implement VK_KHR_zero_initialize_workgroup_memory
Moved nir_lower_compute_system_values to lower
load_local_invocation_index which could be emitted by
nir_zero_initialize_shared_memory.

Relevant CTS tests:
dEQP-VK.compute.zero_initialize_workgroup_memory.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14829>
2022-02-04 09:24:06 +00:00
Danylo Piliaiev c6d1cac6e5 turnip: Expose VK_EXT_image_robustness
VK_EXT_image_robustness is a strict subset of VK_EXT_robustness2
so we could just expose it.

Relevant CTS tests: dEQP-VK.robustness.image_robustness.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14829>
2022-02-04 09:24:06 +00:00
Danylo Piliaiev 03f9deecb8 turnip: Use the shared helpers to expose 1.3 core extensions/limits
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14829>
2022-02-04 09:24:06 +00:00
Connor Abbott 0248644c89 ir3,tu: Enable subgroup shuffles and relative shuffles
We still don't use the fast path for relative shuffles, that's left for
future work.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14412>
2022-02-01 16:27:46 +00:00
Emma Anholt bf289e3123 turnip: Store the computed iova in the tu_image.
Less of a big deal than for buffers, but let's be consistent in how we
handle our bindings.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14816>
2022-02-01 15:30:12 +00:00
Emma Anholt f460fb3f91 turnip: Store the computed iova in the tu_buffer.
We recently had a bug of forgeting to add the buf->bo_offset.  Just make
the easiest field to get be the bo->iova + buf->bo_offset already.  Plus,
a little less work at emit time.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14816>
2022-02-01 15:30:12 +00:00
Danylo Piliaiev 803055ccb4 tu: add debug option to force gmem
With autotuner we now want to be able to force gmem rendering,
it will respect existing constraints though.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12128>
2022-01-31 15:26:35 +00:00
Danylo Piliaiev dbae9fa7d8 tu: implement sysmem vs gmem autotuner
The implementation is separate from Freedreno due to multithreading
support.

In Vulkan application may fill command buffer from many threads
and expect no locking to occur. We do introduce the possibility of
locking on renderpass end, however assuming that application
doesn't have a huge amount of slightly different renderpasses,
there would be minimal to none contention.

Other assumptions are:
- Application does submit command buffers soon after their creation.

Breaking the above may lead to some decrease in performance or
autotuner turning itself off.

The heuristic is too simplistic at the moment, to find a proper
one - we should run a bunch of traces with sysmem and gmem, and
build better heuristic from gathered data.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12128>
2022-01-31 15:26:35 +00:00
Danylo Piliaiev f2c53c2a9b turnip/trace: refactor creation and usage of trace flush data
Fixes the case when last cmd buffer in submission doesn't have
tracepoints leading to flush data not being freed.

Added a few comments, renamed things, refactored allocations - now
the data flow should be a bit more clean.

Extracted submission data creation into tu_u_trace_submission_data_create
which would be later used in in tu_kgsl.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14391>
2022-01-27 18:59:43 +00:00
Danylo Piliaiev cadcbed258 tu: expose VK_KHR_copy_commands2
Relevant CTS tests:
dEQP-VK.api.copy_and_blit.copy_commands2.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14623>
2022-01-20 10:43:31 +00:00
Charles Giessen 4e0604279d freedreno, tu: Update LoaderICDInterfaceVersion to v5
With the proper version checking in the common vulkan instance code
(commit 88b9b68) it is now possible to bring the reported interface
version up to v5.

Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14563>
2022-01-20 07:25:07 +00:00
Danylo Piliaiev e4c582ee71 tu: support VK_EXT_primitive_topology_list_restart
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14556>
2022-01-17 15:21:03 +00:00
Charles Giessen dbd3935b04 freedreno, tu: Export vk_icdGetPhysicalDeviceProcAddr
Support Loader ICD Interface Version 4 by exporting the function
vk_icdGetPHysicalDeviceProcAddr.

Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14299>
2022-01-14 10:26:13 +01:00
Hyunjun Ko 0a82a26a18 turnip: Porting to common implementation for timeline semaphore
Define struct tu_timeline_sync for emulated timeline support in common
implementation that is on top of drm syncobj as a binary sync.

Also implement init/finish/reset/wait_many methods for the struct.

v1. Does not set MSM_SUBMIT_SYNCOBJ_RESET for waiting syncobjs since
it's being managed in the common implementation already.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14105>
2022-01-13 04:01:44 +00:00
Hyunjun Ko 479a1c405e turnip: Porting to common vulkan implementation for synchronization.
This patch ports to common code for VkSemaphore, VkFence and relevant
APIs like vkCreate(Destroy)Semaphore/Fence, vkGetSemaphoreFdKHR, etc.

Accordingly, starts using common vkQueueSubmit with implementing
driver-specific hook.

Also remove all timeline semaphore codes so that we could use common
code in the following patches. This way we could easily see what's
modified in the following patch.

Note that kgsl is not ported in this patch.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14105>
2022-01-13 04:01:44 +00:00
Hyunjun Ko f976f71fb0 turnip: Use the new common device lost tracking
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14105>
2022-01-13 04:01:44 +00:00
Konstantin Seurer 651bec0971 turnip: Fixed maxFragmentCombinedOutputResources
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14320>
2022-01-10 19:28:17 +00:00
Danylo Piliaiev d77bfc117c tu,ir3: Implement VK_KHR_shader_integer_dot_product
- gen4 - has dp4acc and dp2acc, dp4acc is used to implement
  4x8 dot product.
- gen3 - has dp2acc, in OpenCL blob uses dp2acc for dot product
  on both get3 and gen4.
- gen2 - unknown, lower everything.
- gen1 - no dp2acc, lower everything. OpenCL blob doesn't advertise
  cl_qcom_dot_product8 but still generates code for it.
  The assembly is more verbose and uses yet to be documented
  mad32.u16 instruction.

Passes:
 dEQP-VK.spirv_assembly.instruction.compute.opsdotkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opudotkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opsudotkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opsdotaccsatkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opudotaccsatkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opsudotaccsatkhr.*

Only packed 4x8 unsigned and mixed versions are accelerated.
However in theory we should be able to do better for signed version
than current NIR lowering.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13986>
2022-01-10 13:21:24 +02:00
Connor Abbott c45c6e36eb tu: Implement VK_EXT_subgroup_size_control
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13960>
2022-01-10 10:58:28 +00:00
Danylo Piliaiev c749da6135 ir3,turnip: Add support for GL_KHR_shader_subgroup_quad
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13817>
2021-12-07 20:45:53 +00:00
Danylo Piliaiev 3dfd4230bb ir3,turnip: Enable subgroup ops support in all stages on gen4
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13817>
2021-12-07 20:45:53 +00:00
Lionel Landwerlin 65697d6141 util/u_trace: add end_of_pipe property to tracepoints
In order to capture the timestamp when things actually end on Intel
GPU HW, we need to know whether the timestamp should be capture at the
top or end of pipeline.

v2: use one line python if/else (Danylo)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13911>
2021-12-01 15:14:05 +00:00
Danylo Piliaiev d5757c965a turnip: implement VK_KHR_buffer_device_address
We don't advertise bufferDeviceAddressCaptureReplay capability and
neither does blob, because at the moment there is no way to allocate
bo with predefined iova.

There is no support of any arithmetic with addresses since shaderInt64
is not enabled. However, we could enable int64 support whenever we want.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8717>
2021-11-23 18:26:37 +00:00
Connor Abbott a9b4a507fe tu: Expose Vulkan 1.2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13756>
2021-11-12 18:14:34 +00:00
Connor Abbott c6216c941c tu: Add VK_KHR_buffer_device_address stubs
dEQP-VK.api.version_check.entry_points requires us to return a function
pointer, even though the feature is optional in Vulkan 1.2.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13756>
2021-11-12 18:14:34 +00:00
Connor Abbott 952ab4f64f tu: Enable subgroupBroadcastDynamicId
It's a Vulkan 1.2 only feature, but it's trivially supported.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13756>
2021-11-12 18:14:34 +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
Hyunjun Ko 5d0712b185 turnip: expose VK_KHR_driver_properties
Now that we have a conformance version to advertise, we can expose the
extension.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6251>
2021-11-09 03:43:54 +00:00
Emma Anholt 1e850f23b1 turnip: Claim 1.2.7.1 CTS conformance.
I submitted a conformance package for A618 today, so let's stop doing all
this warning about non-conformance.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6251>
2021-11-09 03:43:54 +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
Danylo Piliaiev fd31989ecb turnip: add support for dirconf
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
Hyunjun Ko 30b4911031 turnip: enable strictLines
Now we can enable strictLines as we set rectangular lines by default.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6020>
2021-10-13 12:18:01 +00:00
Hyunjun Ko 542211676c turnip: enable VK_EXT_line_rasterization
By default line mode is VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT,
when lineRasterizationMode is VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT
and primtype is line - we enable bresenham line mode.

We have to disable MSAA when bresenham lines are used, this is
a hardware limitation and spec allows it:

  "When Bresenham lines are being rasterized, sample locations may
   all be treated as being at the pixel center (this may affect
   attribute and depth interpolation)."

This forces us to re-emit msaa state when line mode is changed.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6020>
2021-10-13 12:18:01 +00:00
Jason Ekstrand 531437d7f6 turnip: Use the common WSI wrappers
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13234>
2021-10-13 00:06:15 +00:00
Connor Abbott 0450c1b8a2 tu: Expose VK_KHR_shader_subgroup_extended_types
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13271>
2021-10-11 11:00:56 +00:00
Connor Abbott 4537814349 tu: Implement VK_KHR_imageless_framebuffer
This is mostly a matter of auditing uses of
cmd->state.framebuffer and replacing every use of fb->attachments with
cmd->state.attachments. We already weren't using the attachments
anywhere outside of the render pass, so this is pretty straightforward.
We also don't have any use for anything in
VkFramebufferAttachmentImageInfo so we can just ignore it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13228>
2021-10-08 15:09:59 +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
Emma Anholt 591afd1d52 turnip: Free disk cache on pdev init failure.
Noticed while debugging test failure under valgrind (the disk cache
doesn't come from the vulkan allocator, so we could leak it and not fail
the test).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13200>
2021-10-06 16:49:03 +00:00
Emma Anholt 36d761f2a5 turnip: Fix allocation failure handling around device->name.
Fixes regressions in dEQP-VK.api.device_init.create_instance_device_intentional_alloc_fail

Fixes: 5116388e0b ("turnip: Expose a device name similar to the blob.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13200>
2021-10-06 16:49:03 +00:00
Danylo Piliaiev d2543658ef turnip: clamp per-tile scissors to max viewport size in binning pass
Tiles on the edge may cross maximum viewport size, we have to clamp
per-tile scissor to maximum allowed viewport dimensions.

Add MAX_VIEWPORT_SIZE constant along the way.

Fixes vkd3d test "test_draw_uav_only"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13197>
2021-10-05 14:27:44 +00:00
Emma Anholt 5116388e0b turnip: Expose a device name similar to the blob.
We add "Turnip" so that users (and vulkan.gpuinfo.org) can distinguish us
without requiring VK_KHR_driver_properties.  This will be a lot more
user-friendly than "FD618", though.

I made some little vk_asprintf helpers, because I figure other drivers
setting up deviceName's will want them too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13041>
2021-10-01 22:32:10 +00:00
Emma Anholt 7e471541e0 turnip: Match the blob's format for vendorID and deviceID.
This should hopefully cause us the least trouble with apps tuning for
device performance.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13041>
2021-10-01 22:32:10 +00:00
Tapani Pälli 40c798c6bc turnip: remove feature checks from device creation
This is already handled by vk_device_init(); drivers no longer
need to do it themselves.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12867>
2021-10-01 17:37:02 +00:00
Jason Ekstrand c6210d5aa9 turnip: Switch to common GetDeviceQueues2 and DeviceWaitIdle
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:26 +00:00
Jason Ekstrand 8619c6df62 turnip: Drop tu_queue::flags/queue_family_index/queue_idx
They're now part of vk_queue.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:25 +00:00
Jason Ekstrand b2313b6884 vulkan: Add the pCreateInfo to vk_queue_init()
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:25 +00:00
Emma Anholt c0142ddf3a turnip: Disable VK_EXT_display_control.
The common code fails dEQP-VK.wsi.display_control.register_device_event
due to having a stub NOT_IMPLEMENTED return, and thus fails the CTS.  This
is one of our last failures, so disable the extension until it can get
finished off, so we can unblock passing the CTS.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13010>
2021-09-27 17:41:43 +00:00