Commit Graph

376 Commits

Author SHA1 Message Date
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
Rob Clark 802f4da5ee freedreno/drm: Add virtio backend
Add a new backend to enable using native driver in a VM guest, via a new
virtgpu context type which (indirectly) makes host kernel interface
available in guest and handles the details of mapping buffers to guest,
etc.

Note that fence-fd's are currently a bit awkward, in that they get
signaled by the guest kernel driver (drm/virtio) once virglrenderer in
the host has processed the execbuf, not when host kernel has signaled
the submit fence.  For passing buffers to the host (virtio-wl) the egl
context in virglrenderer is used to create a fence on the host side.
But use of out-fence-fd's in guest could have slightly unexpected
results.  For this reason we limit all submitqueues to default priority
(so they cannot be preepmted by host egl context).  AFAICT virgl and
venus have a similar problem, which will eventually be solveable once we
have RESOURCE_CREATE_SYNC.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14900>
2022-03-25 02:03:30 +00:00
Yiwei Zhang e542981727 venus: update protocol to remove redundant decoders
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15537>
2022-03-25 00:33:56 +00:00
Renato Pereyra 737937f45e venus: Increase the base sleep of vn_relax
Based on profiling, these 10us sleeps are behaving closer to ~60us
and causing higher-than-necessary CPU overhead. 120us seems like a
good balance between latency management and overhead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15565>
2022-03-25 00:16:39 +00:00
Igor Torrente 5d33068cd9 venus: add VK_EXT_extended_dynamic_state2 extension
Implements all the necessary code in the device initialization
and extension functions.

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15428>
2022-03-24 17:35:43 +00:00
Corentin Noël 2aa8e56e52 virgl: Update virgl_protocol and use the provided constants
Allow for better readability of the code.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14473>
2022-03-24 10:50:21 +01:00
Chia-I Wu ce84b1c30f venus: update venus-protocol headers
This requires vn_extension_get_spec_version to be updated as well.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15498>
2022-03-22 21:10:56 +00:00
Chia-I Wu 5d188274ee venus: add vn_extension_get_spec_version
It is a wraper for vn_info_extension_get

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15498>
2022-03-22 21:10:56 +00:00
Igor Torrente 6d7f04e5de venus: add VK_EXT_calibrated_timestamps extension
Implements all the necessary code in the device initialization
and extension functions.

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15389>
2022-03-17 00:02:21 +00:00
Igor Torrente 88638ceb2d venus: move vkGetCalibratedTimestamps to vn_protocol_driver_device.h
Update venus-protocol files to move vkGetCalibratedTimestamps function
from vn_protocol_driver_transport.h to vn_protocol_driver_device.h.

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15389>
2022-03-17 00:02:21 +00:00
Igor Torrente f30334b6c4 Venus: add VN_CMD_ENQUEUE to vn_cmd_encode_memory_barriers
Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15344>
2022-03-14 21:47:19 +00:00
Igor Torrente a65d2ef1c1 Venus: Adjust VN_CMD_ENQUEUE to set VN_COMMAND_BUFFER_STATE_INVALID
This improves the issue of a return inside the macro.

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15344>
2022-03-14 21:47:19 +00:00
Igor Torrente 6cdbc0299a Venus: Add VN_CMD_ENQUEUE macro with vkCmd* common code
Several `vn_Cmd` share the same code to enqueue the command to the
command stream.

This adds a macro with this common code.

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15344>
2022-03-14 21:47:19 +00:00
Akihiko Odaki b70f14188d virgl: Check texture multisample compatibility
v2: Support VIRGL_FORMAT_NONE (Gert Wollny)

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Suggested-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15115>
2022-03-10 10:34:12 +00:00
Chia-I Wu 889d050739 venus: add VK_EXT_vertex_attribute_divisor
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15265>
2022-03-09 17:24:49 +00:00