Commit graph

210870 commits

Author SHA1 Message Date
Danylo Piliaiev
1184830f60 util: Add function os_get_option_secure
Same as os_get_option() but uses secure_getenv() instead of getenv()

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36821>
2025-08-23 10:06:46 +00:00
Valentine Burley
59f5f239f6 freedreno/ci: Add missing caching proxy for traces
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The currently active a618 trace jobs haven’t been using the caching
proxy.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36929>
2025-08-23 08:02:11 +00:00
Pohsiang (John) Hsu
e76e95e084 gallium/pipebuffer: fix multithread issue on pb_slab_manager_create_buffer
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This is an issue found in testing multiple mediafoundation MFT
concurrently.  Thanks to Jesse for the fix.

cc: mesa-stable

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36923>
2025-08-23 02:09:15 +00:00
Yiwei Zhang
25b1591df5 vulkan/android: support AHB query for VK_ANDROID_external_format_resolve
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Conditional based on whether the extension is enabled.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:36 +00:00
Yiwei Zhang
2c63252517 vulkan/android: refactor to retrieve AHB format properties once
...and loop through pNext chain once.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:36 +00:00
Yiwei Zhang
9e99e604db vulkan/android: support AHARDWAREBUFFER_FORMAT_YCbCr_P010 format mapping
Add it only on external format code path so that no api level guard is
needed. It automatically works with gralloc impls that support
allocating such format.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:35 +00:00
Yiwei Zhang
dcffe932a0 anv: adopt common GetAndroidHardwareBufferPropertiesANDROID
ANV currently carries a partial copy of the gralloc mapper's format
resolving code, while the ground truth solely resides inside the
gralloc. The local copy is delicate and unable to maintain compatibility
with different gralloc implementations because AHB formats like
Y8Cb8Cr8_420 and IMPLEMENTATION_DEFINED are flexible formats, and can be
resolved to different underlying drm fourcc formats depending on the
usage and media IPs.

The common impl is more correct as it relies on the info from gralloc
mapper side, and it only sets the minimal set of explicit formats to
avoid hitting spec corner case of allocating out AHB with flexible
formats (missing half of the media usage bits might end up allocating
something different that potentially get resolved to a different
VkFormat as well).

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:35 +00:00
Yiwei Zhang
a34eb09c89 anv: drop anv_ahb_format_for_vk_format
The vk_image::ahb_format is for drivers that support more than the
common explicit AHB formats. It is used on AHB image memory export
allocation path, and more specifically vk_device_memory_create will
use that AHB format to allocate the AHB out from gralloc. To be noted,
export allocation path only deals with explicit format but not external
format. So even with the obsolete HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL
private format, we don't need such either as multi-planar formats are
supposed to be reported as external format.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:35 +00:00
Yiwei Zhang
ef885eb9ac anv: adopt vk_android_get_ahb_image_properties
The current impl misses the probe against gralloc mapper, which is the
required handshake before advertising support. For simplicity, just
adopt the common AHB helper. It does not rely on driver specific format
mapping, since the query doesn't allow external format at all.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:34 +00:00
Yiwei Zhang
3b19aa6261 anv: avoid setting image format twice for AHB image
AHB images are created with the right VkFormat when external format
isn't used. When external format does get used, the proper VkFormat has
already being set in the common runtime. Upon AHB props query, we
resolve external format to VkFormat and set to the externalFormat field
to be used by the app. The app would than chain the exact external
format when creating the AHB image if it wants to go down the external
format code path instead of being explicit. So in the end, the format we
resolve is the format we get. Thus no need to set it twice.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:34 +00:00
Yiwei Zhang
b6427520d6 anv: drop obsolete anv_create_ahw_memory
Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:33 +00:00
Yiwei Zhang
25a8e124e0 vulkan/android: amend a missing case for IMPLEMENTATION_DEFINED AHB
An AHB with IMPLEMENTATION_DEFINED format is commonly backed by NV12 or
XBGR8888. The former is the usual pick for camera <-> GPU interop, while
the latter is mostly only seen in Android CTS. Ideally, we can rely on
the queried fourcc to resolve everything instead of being on the
fallback path, but keeping this a minimal fix is easy for porting.

Cc: mesa-stable
Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:33 +00:00
Lucas Fryzek
b927b52e24 hasvk: Remove special CROS_GRALLOC path from format logic
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:32 +00:00
Lucas Fryzek
a43fa85fab anv: Remove special CROS_GRALLOC path from format logic
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36866>
2025-08-22 23:40:32 +00:00
Faith Ekstrand
d9217bd9cf vulkan/wsi: Always use VK_PIPELINE_STAGE_2_TRANSFER_BIT for semaphore ops
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:05 +00:00
Faith Ekstrand
75434fb5cb vulkan/wsi: Skip the vkQueueSubmit() entirely if we aren't blitting
If we don't need any prime blits then there's no reason to submit
anything to the queue.  We can just signal the signal semaphores and
fences with the wait semaphores and skip the queue.

This is only possible because we no longer need a vkQueueSubmit() for
implicit synchronization.  The old ANV implicit synchronization path is
gone and all other drivers that do implicit sync do it per-bo so we can
assume that they synchronized somewhere else when writing to the BO and
that the present submit does nothing.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:05 +00:00
Faith Ekstrand
6266751749 vulkan/wsi: Consolodate vkQueueSubmit2() calls across swapchains
Vulkan WSI allows you to present to multiple swapchains at the same
time.  If it weren't for some of the Vulkan sync rules, this wouldn't be
a big deal as we could just loop and do the present per-swapchain.
However, the whole present takes a single set of wait semaphores and we
can only wait on them once.  Right now this works because we do at least
one QueueSubmit2() per-swapchain on the present queue.  Since those all
happen on the same queue, we can just wait on the semaphores in the
first present and all the others will pick up that wait thanks to queue
ordering.  However, this requires doing a lot of vkQueueSubmit().

This commit changes the vkQueuePresent() flow so that we do a single
vkQueueSubmit2() on the present queue for all swapchains that consumes
the wait semaphores and signals any per-image semaphores and fences.  In
the case where separate blit queues are used, we just signal blit
semaphores in the first vkQueueSubmit2() on the present queue and then
do a submit per-swapchain for each of the blit queue blits and signal
per-image semaphores and fences with that submit.

This significantly reduces the number of vkQueueSubmit2() calls being
made by vkQueuePresent() and also breaks the dependency on implicit
ordering of submits, which will be important in the next commit.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:05 +00:00
Faith Ekstrand
47fcc88b93 vulkan/wsi: Handle throttling in a separate loop
Instead of doing the throttle as we go through the present loop,
allocate throttle fences and wait on them at the top.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:04 +00:00
Faith Ekstrand
cec7e865a7 vulkan/wsi: Gather per-swapchain results in an array in queue_present()
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:04 +00:00
Faith Ekstrand
cb1ee1d730 vulkan/wsi: Add a QueueSubmit2() wrapper
Unlike regular QueueSubmit2(), the wrapper takes multiple out fences.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:03 +00:00
Faith Ekstrand
9a023b3615 vulkan/wsi: Make get_blit_queue return a struct vk_queue *
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:03 +00:00
Faith Ekstrand
59f85e678f vulkan/wsi: Take a vk_queue in wsi_common_queue_present()
The common entrypoint wrapper already depends on vk_queue, as do all the
drivers that implement drv_QueuePresentKHR() so there's no point in
passing through Vulkan API types anymore.

The one functional change here is that ANV is no longer forcing the
queue index to be zero, which I suspect was a mistake in the first
place.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:02 +00:00
Faith Ekstrand
81325cf887 vulkan,anv,hasvk: Drop vk_queue_wait_before_present()
This helper existed to ensure that drivers waited for semaphores to
materialize before processing a QueuePresent().  However, most drivers
never called this and they were kind-of fine.  Now that we have explicit
and dma-buf sync built into WSI, this wait happens as part
GetSemaphoreFd when we fetch the sync file from the semaphore.

It's also less racy to just rely on GetSemaphoreFd() because, even
though we were stalling the submit thread prior to present, the present
itself does one or more submits and those may go to the thread and
potentially race with the window system.  The GetSemaphoreFd(), however,
happens at the right time to ensure we actually stall before handing
off to the window system.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:02 +00:00
Faith Ekstrand
c9d361ca80 vulkan/wsi: Switch to vkQueueSubmit2()
Venus was the last driver to be implementing old-school vkQueueSubmit()
but it now has a 2-on-1 wrapper as of 07cee75c39 ("venus: layer
vkQueueSubmit2 over vkQueueSubmit w/o sync2").  This makes everything a
little more readable now that we're not juggling separate arrays for
timelines.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:01 +00:00
Faith Ekstrand
650debdf40 anv: Stop picking our own blit queue
This reverts commit 1f0fdcb619 ("anv: always pick graphics queue to
execute prime blits on.") which was added to avoid prime blits on video
queues.  However, this was fixed properly in d7938de8fe ("vulkan/wsi:
don't support present with queues where blit is unsupported") which
made us stop advertising presentation on video queues entirely.  We no
longer need the code in ANV.

Acked-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:01 +00:00
Faith Ekstrand
4f56ff70ff panvk: Use vk_drm_syncobj_copy_payloads
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00
Faith Ekstrand
eb421b6a9e nvk: Use vk_drm_syncobj_copy_payloads
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00
Faith Ekstrand
e0c30b0fc2 anv,hasvk: Use vk_drm_syncobj_copy_payloads
Acked-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00
Faith Ekstrand
4827ba625d vulkan/drm_syncobj: Add a vk_drm_syncobj_copy_payloads helper
This intentionally matches vk_device::copy_sync_payloads.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00
Faith Ekstrand
f4d00c1dbf vulkan: Add a vk_device_copy_semaphore_payloads() helper
This acts as a vkQueueSubmit() except that it doesn't take any command
buffers or sparse binds and it doesn't act on a queue.  Instead, it just
copies semaphore payloads around using a new copy_sync_payloads vfunc on
vk_device.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00
Faith Ekstrand
379cffc3bb vulkan: Add a vk_sync_signal_unwrap() helper
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:05:00 +00:00
Faith Ekstrand
8cffa9a7fd vulkan/queue: Move timeline point allocation to vk_queue_submit_final()
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:04:59 +00:00
Faith Ekstrand
3c7e973d40 vulkan: Add a vk_sync_wait_unwrap() helper
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:04:59 +00:00
Faith Ekstrand
b5045d6e42 vulkan/drm_syncobj: Implement signal/reset_many
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:04:58 +00:00
Faith Ekstrand
c203c5ba91 vulkan/sync: Add vk_sync_signal/reset_many()
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:04:57 +00:00
Faith Ekstrand
57368203a7 vulkan/sync: Make the can_wait_many() check faster
In the common case where drivers only support one sync type, we can make
this check a lot faster.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:04:57 +00:00
Faith Ekstrand
1f6209ba09 vulkan/drm_syncobj: Use SWAP() in vk_drm_syncobj_move()
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:04:56 +00:00
Faith Ekstrand
4a634a56bb vulkan/sync: Return early in vk_sync_timeline_wait() if wait_value == 0
This is a trivial case so we don't even need to take the lock.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36827>
2025-08-22 23:04:56 +00:00
Jesse Natalie
415f4d7678 util: Disable inline asm for arm64 for MSVC
Fixes: b2761d14 ("util: Remove usage of USE_**_ASM macros")
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36940>
2025-08-22 22:33:50 +00:00
Jesse Natalie
5b3756f231 nir: Add missing #include for c99_alloca.h
Fixes: 3dd9a978 ("nir: add new pass nir_lower_io_indirect_loads")
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36940>
2025-08-22 22:33:50 +00:00
Yiwei Zhang
b76c556c59 panvk: support VK_ANDROID_external_memory_android_hardware_buffer
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This last piece hooks up:
- GetPhysicalDeviceImageFormatProperties2
- GetPhysicalDeviceExternalBufferProperties
- GetImageMemoryRequirements2

Test:
- dEQP-VK.api.external.memory.android_hardware_buffer.*
- CtsNativeHardwareTestCases via ANGLE
- Android HWUI and SurfaceFlinger via skiavk (entirely AHB based)

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:12 +00:00
Yiwei Zhang
66bbd9eec8 panvk: implement AHB image deferred init and memory alloc
Implement as a layer on top, and can be resilient to core panvk changes
later. e.g. more and strict memory types, need dedicated info, etc.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:12 +00:00
Yiwei Zhang
33ab9d8320 panvk: add shared image support and advertise VK_ANDROID_native_buffer
Now we have:
1. baseline ANB (pre ANB spec v8)
   - basic vulkan wsi on Android
2. aliased ANB (ANB spec v8+)
   - required for swapchain maintenance1 support, and is used by ANGLE
     on Android for smooth swapchain recreation.
3. ANB shared image
   - required for KHR_shared_presentable_image support.

Test:
- dEQP-VK.wsi.android.*
- dEQP-EGL.* via ANGLE
- CtsGraphicsTestCases via ANGLE
- CtsOpenGLTestCases via ANGLE
- Instagram via ANGLE

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:12 +00:00
Yiwei Zhang
8aa2f1a94f panvk: add panvk_android_get_wsi_memory for AHB spec v8+
Android Vulkan loader relies on aliased ANB image support to advertise
KHR_swapchain spec v69+. This change adds panvk_android_get_wsi_memory
helper based on deep copied (and sanitized) image create info to perform
deferred image initialization and ANB memory alloc.

Also we switch to use VK_USE_PLATFORM_ANDROID_KHR instead.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:12 +00:00
Yiwei Zhang
2f54020f29 panvk: ensure wsi memory is bound at offset 0
No apps or tests have hit the spec corner case yet, but in theory they
could pass invalid offset and expect the impl to ignore it for wsi alias
binding. This change ensures the offset is zero, which aligns with
common wsi side binding as well as obeying the dedicated allocation
requirement.

Fixes: 187956bd51 ("panvk: adopt wsi_common_get_memory")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:11 +00:00
Yiwei Zhang
075d78115e panvk: implement deferred image creation
Implemented in the way without leaking concerns. The container
panvk_android_deferred_image will be freed up upon panvk_DestroyImage
with the strictly paired allocator obeying the spec.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:11 +00:00
Yiwei Zhang
752ea7f6df panvk: resolve ANB (pre spec v8)
Before ANB spec v8, all ANB images are created and fully initialized
upon panvk_CreateImage.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:10 +00:00
Yiwei Zhang
63db388543 panvk: stub out Android ANB and AHB image handling
ANB and AHB image handling will be implemented on top of
VK_EXT_image_drm_format_modifier impl. To be specific, they will be
resolved to VkImageDrmFormatModifierExplicitCreateInfoEXT when the
backing gralloc image is available:
- ANB: upon ANB image creation
- ANB alias: upon binding image to memory
- AHB: upon dedicated memory import

So for ANB alias and AHB, the initial VkImage creation only needs to
allocate the image object while the create info has to be deferred till
later to help with actual image layouting.

Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
2025-08-22 21:39:10 +00:00
Mel Henning
b5973bed78 zink: Add zink_check_requirements
This is a new tool that checks a driver against the vulkan profile and
complains about any missing features.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36061>
2025-08-22 16:08:11 -04:00
Mel Henning
9d295f4e21 zink: Convert profile tabs to spaces
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36061>
2025-08-22 15:17:51 -04:00