Commit graph

1224 commits

Author SHA1 Message Date
Yiwei Zhang
c093a4e18b venus: properly handle implicit fence from the compositor
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Vulkan is supposed to operate in explicit synchronization mode. However,
for legacy compositors that only support implicit fencing, we have to
extract the compositor implicit fence (release fence) and resolve it
properly. Since we used to rely on renderer side drivers being able to
handle implicit in-fence, here we only opt-in the new behavior for those
known to have issues with that.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34516>
2025-05-27 02:40:44 +00:00
Yiwei Zhang
5535184539 venus: track prime blit dst buffer memory in the wsi image
This is to prepare for handling implicit fence from the compositor.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34516>
2025-05-27 02:40:44 +00:00
Yiwei Zhang
d7f6400762 venus: force different device on NV proprietary
If forcing prime blit via disabling modifier support is not sufficient,
take a step further to force different device so that the memory type
choice is more conservative.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34965>
2025-05-22 11:03:47 -07:00
Yiwei Zhang
a312bb4285 venus: refactor wsi acquire to use semaphore and fence SYNC_FD import
This drops separate vn_fence_signal_wsi and vn_semaphore_signal_wsi
helpers for consistency and robustness. The behavior now aligns with the
Android WSI vkAcquireImageANDROID impl. This is to prepare for
installing an actual payload from the compositor side.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35079>
2025-05-21 18:41:23 +00:00
Yiwei Zhang
b19e470802 venus: update docs and drop obsolete code for prime blit
The spec has been clarified long ago. Meanwhile, prime blit in common
wsi has become more legit over the time, and the handling in venus has
been obsolete for a while. For now, I just dropped all obsolete code for
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35034, which
has taken care of the pipeline barriers for prime blit dst buffer.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35079>
2025-05-21 18:41:23 +00:00
Yiwei Zhang
47b207726c venus: avoid false assert for MESA_VK_WSI_DEBUG=sw,linear
Forcing linear cpu image is supported via venus.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35079>
2025-05-21 18:41:23 +00:00
Yiwei Zhang
1895de16a6 venus: filter out venus incapable physical devices
VK_KHR_external_memory_fd is required by Venus at the bare minimum for
all different ways to support the current venus guest memory mapping.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34830>
2025-05-16 14:12:36 +00:00
Yiwei Zhang
5abce52a67 venus: misc cleanups post wsi requirement relax
This avoids an invalid assert hit on debug build since we no longer
require drm format modifiers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34830>
2025-05-16 14:12:36 +00:00
Yiwei Zhang
92f79d35c4 venus: relax external memory ext requirement
On Android, both the ANB and AHB extensions support still requires
renderer external memory support along with format modifier and foreign
queue support.

On Linux, however, renderer external memory support alone is sufficient
to expose external memory extensions. This also helps not to force sw
wsi device when renderer has external memory support.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34830>
2025-05-16 14:12:36 +00:00
Yiwei Zhang
0c345c2c5e venus: clang-format
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34830>
2025-05-16 14:12:36 +00:00
Yiwei Zhang
cc4fd7cc9d vulkan: fix random tabs to spaces
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Only the vk_time_max_deviation tab usage requires a manual fix to make
sense. Others are boring replacements.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35011>
2025-05-16 03:57:31 +00:00
Valentine Burley
c276e0b29a ci/crosvm: Use structured tagging for crosvm
Structured tagging captures a checksum of the component we think we're
building, and verifies this through the chain.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34813>
2025-05-07 12:13:24 +00:00
Dmitry Osipenko
daad392d5c virtio/vpipe: Correct vdrm_vpipe_connect() definition
The vdrm_vpipe_connect() prototype defined in vdrm.c doesn't match
vdrm_vpipe_connect() defined in vdrm_vpipe.c. This leads to a compilation
warning about the wrong proto when Mesa linked with enabled LTO. Fix the
vdrm_vpipe_connect() definition.

Fixes: bf0e3d6274 ("virtio/vdrm: Add vtest backend")
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34819>
2025-05-06 21:36:16 +00:00
Yiwei Zhang
4f07092bdb venus: fix to passively enable wsi required extensions
Required extensions to support wsi have been relaxed earlier for sw blit
path. So the renderer extensions enablement is fixed to be passive based
on the renderer side correspondingly.

Test: emulate to drop dma-buf and modifier support from host anv driver,
and confirm wsi via venus works with sw blit fallback and device
creation no longer returns VK_ERROR_FEATURE_NOT_PRESENT.

Fixes: 06f5d1a105 ("venus: expose WSI on renderer without dma-buf support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34827>
2025-05-05 21:43:33 +00:00
Yiwei Zhang
06f5d1a105 venus: expose WSI on renderer without dma-buf support
For Venus on host driver without dmabuf support, we can fallback to
allow cpu buffer blit for wsi instead of not exposing it.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13096
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34804>
2025-05-05 08:27:48 +00:00
Eric Engestrom
4227982326 ci: rename misleading *-postmerge stages to *-nightly
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
These stages are for the jobs that are skipped in merge pipelines,
automatically run in nightly pipelines, and are available to run
manually in other pipelines.

None of these ever run in post-merge pipelines.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34590>
2025-04-29 05:49:00 +00:00
Janne Grunau
3d3ca9b65e venus: virtgpu: Require stable wire format
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
When VMMs do not support VIRTGPU_DRM_CAPSET_VENUS the capset data
remains zeroed. By requiring the stable wire_format_version 1 this can
be detected early without initialising the renderer.

Avoids triggering `assert(capset->supports_blob_id_0);` in debug builds
under such circumstances.

Cc: mesa-stable
Signed-off-by: Janne Grunau <j@jannau.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34613>
2025-04-19 21:02:17 +00:00
Yiwei Zhang
2a4675ee9f venus: fix missing renderer destructions
With failed compatibility check, the created renderer must be destroyed
within vn_instance_init_renderer.

Cc: mesa-stable
Fixes: 25b8f4f714 ("venus: handle device probing properly.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34613>
2025-04-19 21:02:17 +00:00
Janne Grunau
39e4fd98ce venus: Do not use instance pointer before NULL check
Fixes: a753f50668 ("venus: break up vn_device.c")
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Signed-off-by: Janne Grunau <j@jannau.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34613>
2025-04-19 21:02:17 +00:00
Rob Clark
bf0e3d6274 virtio/vdrm: Add vtest backend
This allows for testing drm native ctx support without spinning up a VM.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33433>
2025-04-08 15:38:39 +00:00
Aaron Ruby
8513bcbd2f virtio: Remove virglrenderer_hw.h entirely
Capset definitions replaced by those in virtgpu_drm.h

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34300>
2025-04-01 22:11:10 +00:00
Daniel Stone
1be1af78bf ci/virgl: Add timeout to software jobs
Let's make sure these don't get stuck. They're all good citizens and
turn around in 5min or less, so give them triple that.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34280>
2025-04-01 12:21:01 +00:00
Eric Engestrom
359f69ba0c ci: add FDO_RUNNER_JOB_PRIORITY_TAG_* to control priority of generic freedesktop runners
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This affects:
- generic jobs (sanity, rustfmt, shader-db, docs, etc.)
- linux image builds
- linux mesa builds
- software renderer tests
- android tests
- virgl & venus tests

Marge pipelines get high priority, nightly pipelines get low priority,
and everything else is in between.

(Hardware test farms have their own mechanisms.)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34264>
2025-03-29 18:17:24 +01:00
Faith Ekstrand
e980123293 venus: Set wsi_device::supports_scanout = false
This will cause venus to take the prime blit path if modifiers are not
supported.  This has been an outstanding TODO in venus for a while.

Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34218>
2025-03-28 23:54:51 +00:00
Faith Ekstrand
11ba89097f venus: Only claim modifiers in WSI if the host driver supports it
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34218>
2025-03-28 23:54:51 +00:00
Faith Ekstrand
de7cae705d venus: Don't report global priorities if globalPriorityQuery is unsupported
Drivers are expected to ignore unknown structs in pNext chains.  Venus
is a bit weird because we advertise features based on the host driver
and so we have code for all sorts of things which may not be supported
by the host driver.  When globalPriorityQuery is unsupported, we
shouldn't even attempt to return anything.  Currently, we just crash in
this case because vn_physical_device::global_priority_properties is an
uninitialized pointer.  While we're here, initialize it to NULL if it's
invalid.

Fixes: e488b5e45e ("venus: support VK_KHR_global_priority")
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34218>
2025-03-28 23:54:51 +00:00
Faith Ekstrand
e7bb6df7cb venus: Assume wsi_mem->base_bo != NULL
Now that the WSI code is signaling the correct BO, we don't need this
workaround in venus.

Fixes: a315a64291 ("venus: relax 2 assertions for prime blit path")
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34218>
2025-03-28 23:54:51 +00:00
Yiwei Zhang
315d55db79 venus: support VK_EXT_multisampled_render_to_single_sampled
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34207>
2025-03-27 00:52:17 +00:00
Yiwei Zhang
7155ffe275 venus: refactor format properties cache to be extensible
Now the key consists of format + high order index from different pNext
chain structs. To be noted. we still don't want to cache modifiers to
avoid preparing dynamic length internal storage for per format
modifiers. The good thing is that most of the queries against modifier
support are one-time.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34207>
2025-03-27 00:52:17 +00:00
Yiwei Zhang
8e173230b6 venus: support VK_KHR_shader_relaxed_extended_instruction
This is missed from earlier batches as it was falsely grouped under 1.3
core exts that have been recently fixed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34207>
2025-03-27 00:52:17 +00:00
Yiwei Zhang
5227398a6c venus: support VK_EXT_buffer_device_address
Need a separate feature struct as the capture/replay bit means different
things.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34207>
2025-03-27 00:52:17 +00:00
Yiwei Zhang
a19b0ccc31 venus: sync latest protocol
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34207>
2025-03-27 00:52:17 +00:00
Yiwei Zhang
8c6a5250ec venus: support VK_KHR_maintenance7
Need to properly fill layered api properties while adjusting query
wrapping based on maint7 feature enablement. Venus has to conditionally
advertise maint7 support only when renderer side vk is 1.2 or supports
VK_KHR_driver_properties.

Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33960>
2025-03-26 00:26:22 +00:00
Aaron Ruby
121d163b21 gfxstream: Move virtgpu_gfxstream_protocols.h to the common location for
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
house protocols

- Remove some duplicate definitions  (replaced with virgl_hw.h include,
which is also represented in gfxstream host code)
- Also removed the capset_ids from virtgpu_gfxstream_protocol.h. They
aren't needed to build guest-side driver, and are planned to be merged
to virtgpu_drm.h

Reviewed-By: Gurchetan Singh <gurchetansingh@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34116>
2025-03-24 23:25:10 +00:00
Yiwei Zhang
488b2d4d25 virgl/venus/vtest: align capset and protocol with virglrenderer
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Virgl and venus capsets along with vtest protocol v3 are all stable now.
This change is to align with:
https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1311

Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34135>
2025-03-24 21:58:10 +00:00
Yiwei Zhang
25556de759 venus: enable VK_EXT_debug_utils
After adopting common command buffers, venus can safely enable the
extension leveraging the common implementation.

Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34135>
2025-03-24 21:58:10 +00:00
Yiwei Zhang
63cac09d74 venus: improve image memory requirement cache for image aliasing
We can strip the alias bit as the memory requirements are identical
between the bound image and the aliased image per spec.

Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34135>
2025-03-24 21:58:10 +00:00
Yiwei Zhang
adcb967c5c venus: fix maint4 multi-planar memory requirements
Fixes: ce1bbd241e ("venus: extend image cache to vkGetDeviceImageMemoryRequirements")
Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34135>
2025-03-24 21:58:10 +00:00
Yiwei Zhang
ea6dc035d8 venus: fix ahb usage caching
Test: dEQP-VK.api.external.memory.android_hardware_buffer.*

Fixes: fde5cebec5 ("venus: fix image format cache miss with AHB usage query")
Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34135>
2025-03-24 21:58:10 +00:00
Yiwei Zhang
8b2703fe08 venus: fix unexpected ring alive status expire upon owner thread switch
If the last owner thread has just unset the alive status and released
the watchdog, the new owner thread could have acquired to abort
unexpectedly if the ownership transfer occurs right before the next
owner's warn order. So we must set watchdog alive for new owner so that
it can properly check ring alive status in the next warn order.

Cc: mesa-stable
Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34135>
2025-03-24 21:58:10 +00:00
Valentine Burley
a36379d973 ci: Add missing kvm runner tags
A recent change now requires the kvm runner tag to be explicitly listed
for jobs that need to run on runners with KVM capability.
This ensures the jobs are scheduled on compatible runners.

Cc: mesa-stable

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34120>
2025-03-24 20:45:52 +00:00
Yiwei Zhang
5b11c3ff0a venus: use common cmd pool_link
Some checks failed
macOS-CI / macOS-CI (dri) (push) Has been cancelled
macOS-CI / macOS-CI (xlib) (push) Has been cancelled
We only implement the destroy func to leverage the existing link, and we
only give vk_command_buffer the ops but not the pool.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
2025-03-15 22:14:59 +00:00
Yiwei Zhang
4c0635ee04 venus: use vk_command_buffer internals
Use common tracking of cmd pool, cmd level and cmd state.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
2025-03-15 22:14:59 +00:00
Yiwei Zhang
0a324d37da venus: use common vk_command_buffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
2025-03-15 22:14:59 +00:00
Yiwei Zhang
7a3c18fa8e venus: use vk_command_pool internals
No longer need to track allocator, device or queue family.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
2025-03-15 22:14:59 +00:00
Yiwei Zhang
58b0d2e234 venus: use common vk_command_pool
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
2025-03-15 22:14:59 +00:00
Yiwei Zhang
84b33aa6e1 venus: explicitly get vn_device from vk_device
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
2025-03-15 22:14:59 +00:00
Yiwei Zhang
dfcad90240 venus: rename common vk object base member to vk
This way we avoid the confusing base.base or even base.base.base when
venus uses common objects. This also aligns with the naming of the other
drivers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
2025-03-15 22:14:58 +00:00
Yiwei Zhang
b346d8acfc venus: support VK_EXT_image_sliced_view_of_3d
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34037>
2025-03-13 13:24:48 +00:00
Yiwei Zhang
638341d709 venus: support VK_EXT_pipeline_library_group_handles
This completes the entire series of ray tracing support.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34037>
2025-03-13 13:24:48 +00:00