Commit Graph

390 Commits

Author SHA1 Message Date
Yiwei Zhang b37d97bb86 venus: resolve YV12 AHB to VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM
YV12 is a 3-plane format with minigbm. This change mitigates the crash
of testGLViewLargerHeightDecodeAccuracy[4], and successfully creates the
host side image and imports the memory.

vk_format(1000156002) drm_fourcc(842094169)
offsets(0, 27648, 34560, 0)
strides(256, 128, 128, 0)
modifier(0)

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/16913>
2022-06-17 00:40:10 +00:00
Yiwei Zhang d7f2e6c8d0 venus: add fence feedback
- intercept to record feedback cmds for:
  - vkQueueSubmit
- add feedback code path for
  - vkGetFenceStatus
  - vkResetFences
- VN_PERF_NO_FENCE_FEEDBACK can disable fence feedback

Test: dEQP-VK.synchronization.basic.fence.*
Test: dEQP-VK.wsi.android.swapchain.render.basic*
Test: dEQP-VK.api.object_management.*
Test: dEQP-VK.api.external.fence.sync_fd.*

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang 9f9d543b12 venus: renderer to store allow_vk_wait_syncs capset
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang 8ecac4c063 venus: create per queue family command pool for feedback cmd
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang 1a7632e54b venus: add NO_FENCE_FEEDBACK perf option and disable sparse resource
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang 942ec179f3 venus: add event feedback
- add perf option VN_PERF_NO_EVENT_FEEDBACK
- intercept to record feedback cmds for:
  - vkCmdSetEvent
  - vkCmdResetEvent
- add feedback code path for
  - vkGetEventStatus
  - vkSetEvent
  - vkResetEvent

Test: dEQP-VK.synchronization.basic.event.*
Test: dEQP-VK.api.command_buffers.record_simul*

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang f2563788a1 venus: add feedback check/set/reset helpers
Implemented:
- vn_feedback_get_status
- vn_feedback_reset_status
- vn_feedback_set_status
- vn_feedback_get_counter
- vn_feedback_set_counter

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang e52da323b0 venus: add vn_feedback_pool backed by coherent buffer (part 2)
Implemented:
- vn_feedback_pool_alloc
- vn_feedback_pool_free

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang 27a24caf16 venus: add vn_feedback_pool backed by coherent buffer (part 1)
Implemented:
- vn_feedback_pool_init
- vn_feedback_pool_fini

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang d578f6c727 venus: let device track queue families used for device creation
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang 4cf87d8822 venus: adjust device resources init order
queue init involves fence creation, and we need to do that at the last
to prepare for other resource creation dependencies involved in fence
creation.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang cf55a3f70e venus: fix a missing mtx_destroy in vn_device_init
This was introduced in commit e08960482, however, the logic around has
been largly refactored since then. It's not worth adding the fixes tag.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang cb8dfa4966 venus: fix the queue init failure path
The prior behavior can ignore certain failure result, and might also
clean up queues that are never initialized.

Fixes: ddd7533055 ("venus: initial support for queue/fence/semaphore")

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Yiwei Zhang 01a0bfc3f9 venus: fix a bug on buffer cache init failure path
The failure path was never hit though, and will not either.

Fixes: 65abd1d4ae ("venus: implement vn_buffer_cache_entries_create")

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
2022-06-16 19:00:36 +00:00
Renato Pereyra c642ebf8ab venus: Add driconf option to enable implicit fencing
Signed-off-by: Renato Pereyra <renatopereyra@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16735>
2022-06-02 18:05:50 +00:00
Yiwei Zhang 1c63a0beaf venus: resolve AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 to external format
This is to work around ANGLE yuv support.

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/16759>
2022-06-01 20:25:47 +00:00
Yiwei Zhang 37764272ab venus: use common entry point for VkPhysicalDeviceMemoryProperties
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16694>
2022-05-24 23:35:28 +00:00
Chad Versace fe3e850dfb venus: Don't encode ignored pTessellationState
The spec says that VkGraphicsPipelineCreateInfo::pTessellationState is
ignored and may be an invalid pointer in some cases. When ignored,
patch the pCreateInfo with `pTessellationState = NULL`, so the encoder
doesn't attempt to encode an invalid pointer.

Tested in Borealis, with debug build of venus, with a minimal test app
that sets `.pTesselationState = 0x17`. Pre-patch, the app crashes;
post-patch, the app works.

Signed-off-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16284>
2022-05-17 19:47:52 +00:00
Chad Versace 683b6e8d35 venus: Refactor vn_fix_graphics_pipeline_create_info
We currently do only a single fix. Prepare to do multiple independent
fixes.

Signed-off-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16284>
2022-05-17 19:47:52 +00:00
Yiwei Zhang 81515f6b3c venus: extend buffer cache to cover layering usage
Layering clients, e.g. angle and zink, use wide sets of buffer usage
flags because they don't know what a resource will be used for in the
majority cases, which is on the other hand making it easier for layering
to optimize resource management.

This change adds a super-set usage to the buffer cache entries, that
will mostly ensure no cache-miss for non-sparsed buffer usages. Since
that involves usage bits from extensions, we'll mask out those disabled
ones upon querying but will use the static cache create info for
checking cache hit for code simplicity.

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/16379>
2022-05-07 05:26:44 +00:00
Yiwei Zhang 3f44bad1ce venus: log performance envs upon instance creation with debug init
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Change-Id: I8db93d6de28ac6a727c10fbaca94cffac092f8ea
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16256>
2022-05-02 20:20:43 +00:00
Yiwei Zhang 84a53de76c venus: add VN_RELAX_BASE_SLEEP_US env var for tuning cpu utils
Cap the minimum to the current base sleep us 10.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16256>
2022-05-02 20:20:43 +00:00
Yiwei Zhang 2f8123abab venus: enable ANB shared presentable image prop
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15868>
2022-04-30 04:25:44 +00:00
Yiwei Zhang 2df0aa185e venus: update vn_GetSwapchainGrallocUsage2ANDROID for shared present
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15868>
2022-04-30 04:25:44 +00:00
Yiwei Zhang d6b4f746b0 venus: cache front_rendering_usage bit at gralloc init
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15868>
2022-04-30 04:25:44 +00:00
Yiwei Zhang 52ad0368cd venus: refactor android gralloc pieces
There's no functional change.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15868>
2022-04-30 04:25:44 +00:00
Renato Pereyra e6706d230e venus: add support for vk_xwayland_wait_ready
Signed-off-by: Renato Pereyra <renatopereyra@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16229>
2022-04-29 00:45:24 +00:00
Yiwei Zhang fd90a57e28 venus: disable VK_EXT_extended_dynamic_state2
extended_dynamic_state.*_raster tests timeout because the new
VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE is not handled in venus.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16222>
2022-04-28 21:19:11 +00:00
Rob Clark cb5f25ea71 freedreno/drm/virtio: Protocol updates
This syncs up with the protocol of what eventually landed in virglrender.

1) Move all static params to capset to avoid having to query host
   (reduce synchronous round trips at startup)
2) Use res_id instead of host_handle.. costs extra hashtable lookups in
   host during submit, but this lets us (with userspace allocated IOVA)
   make bo alloc and import completely async.
3) Require userspace allocated IOVA to simplify the protocol and not
   have to deal with GEM_NEW/GEM_INFO potentially being synchronous.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16086>
2022-04-27 23:10:00 +00:00
Rob Clark e6b2785811 freedreno/drm/virtio: Use userspace IOVA allocation
If supported by host virglrenderer and host kernel, use userspace
allocated GPU virtual addresses.  This lets us avoid stalling on
waiting for response from host kernel until we need to know the
host handle (which is usually not until submit time).

Handling the async response from host to get host_handle is done
thru the submit_queue, so that in the submit path (hot) we do not
need any additional synchronization to know that the host_handle
is valid.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16086>
2022-04-27 23:10:00 +00:00
Yiwei Zhang 1598d18a88 venus: flush when batched draw calls reach a threshold
Add VN_DRAW_CMD_BATCH_LIMIT option

e.g. for Android
adb shell setprop mesa.vn.draw.cmd.batch.limit 100

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16110>
2022-04-26 23:49:59 +00:00
Yiwei Zhang 9dc68bd975 venus: refactor vn_cmd_submit
The caller checks cmd->state instead.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16110>
2022-04-26 23:49:59 +00:00
Yiwei Zhang 42a8383170 venus: add VN_PERF option no_async_queue_submit
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16110>
2022-04-26 23:49:59 +00:00
Yiwei Zhang 0fc36b11ab venus: add VN_PERF option no_async_buffer_create
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16110>
2022-04-26 23:49:59 +00:00
Yiwei Zhang f0bfd8afe2 venus: add env perf options and introduce no_async_set_alloc
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16110>
2022-04-26 23:49:59 +00:00
Yiwei Zhang 4ab640852b venus: refactor to add struct vn_env
This is to prepare for adding perf options.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16110>
2022-04-26 23:49:59 +00:00
Yiwei Zhang 4f7de83110 venus: fix view format for ahb image
There's below AHB VU on the image view:

VUID-VkImageViewCreateInfo-image-02399
If image has an external format, format must be VK_FORMAT_UNDEFINED

This is well hidden and completely missed from the original venus ahb
implementation.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16159>
2022-04-26 22:21:53 +00:00
Yiwei Zhang 31727f114a venus: use linear modifier for legacy common wsi path
Towards the renderer, venus better uses VK_EXT_image_drm_format_modifier
to force linear with tiling modifier and mod_linear. Doing so won't make
any difference on the mesa implementations we care about given we have
required VK_EXT_image_drm_format_modifier for wsi support.

A lucky side effect of this is to allow common wsi to work with host
implementations not supporting dma_buf export.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15993>
2022-04-21 01:29:21 +00:00
Yiwei Zhang 09cee71e80 venus: override aspectMask for internal tiling modifier
WSI images and Android AHBs can have tiling modifier overrides, thus we
must override the aspectMask upon image subresource layout query.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15993>
2022-04-21 01:29:21 +00:00
Yiwei Zhang a263da69ec venus: prepare and feed renderer protocol info into cs
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15495>
2022-04-09 00:19:05 +00:00
Yiwei Zhang 440705d78f venus: update protocol for mask helper and ignore renderer unknown pNext
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15495>
2022-04-09 00:19:05 +00:00
Yiwei Zhang 0de968f71c venus: add cs helper stubs to be used by protocol
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15495>
2022-04-09 00:19:05 +00:00
Yiwei Zhang 2223f13b26 venus: store extension mask in renderer info
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15495>
2022-04-09 00:19:05 +00:00
Renato Pereyra 5ec4995305 Revert "venus: Increase the base sleep of vn_relax"
This reverts commit 737937f45e.

Testing has revealed sizable performance drops arising out of this change.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15760>
2022-04-06 01:46:10 +00:00
Igor Torrente cc8e271813 venus: add VK_EXT_{conditional_rendering,index_type_uint8} extensions
Implements all the necessary code in the device initialization
and extensions functions.

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15652>
2022-04-05 05:10:26 +00:00
Igor Torrente bfab83ab4b venus: Update venus-protocol to add two new extensions
These are the changes automatically generated from the venus-protocol
repository.

Update the file to add `VK_EXT_index_type_uint8` and
`VK_EXT_conditional_rendering`

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15652>
2022-04-05 05:10:26 +00:00
Yiwei Zhang 801cdd83f1 venus: workaround an ANGLE assumption on FORMAT_IMPLEMENTATION_DEFINED
ANGLE expects VK_FORMAT_UNDEFINED to be returned for such AHB prop
query.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15721>
2022-04-05 05:03:39 +00:00
Konstantin Seurer a8c7e8fef8 venus: Use trivial common entrypoints
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15613>
2022-03-28 22:15:45 +00:00
Yiwei Zhang 6d1cc0e47d venus: let vn_android use vn_BindImageMemory2 and directly use reqs
v2: remove an unused variable

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15619>
2022-03-28 21:39:05 +00:00
Boris Brezillon 13efbdf830 venus: Stop using VK_OUTARRAY_MAKE()
We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>
2022-03-25 11:00:03 +00:00