panvk: Skip barrier QFOT if src_qfi equals dst_qfi

Do not perform a queue family ownership transfer during memory barriers
if srcQueueFamilyIndex equals dstQueueFamilyIndex, as the Vulkan spec
mandates that this should only happen if the two values are unequal.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Fixes: 715d6e740a ("panvk: improve VK_QUEUE_FAMILY_EXTERNAL support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35458>
(cherry picked from commit 5d0465a253)
This commit is contained in:
Lars-Ivar Hesselberg Simonsen 2025-06-11 11:13:23 +02:00 committed by Eric Engestrom
parent f2547ac6e3
commit a3c4eec46d
2 changed files with 33 additions and 30 deletions

View file

@ -2854,7 +2854,7 @@
"description": "panvk: Skip barrier QFOT if src_qfi equals dst_qfi",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "715d6e740a35b2d2d46ff40179390a87b161b814",
"notes": null

View file

@ -444,36 +444,39 @@ normalize_dependency(VkPipelineStageFlags2 *src_stages,
VkAccessFlags2 *src_access, VkAccessFlags2 *dst_access,
uint32_t src_qfi, uint32_t dst_qfi)
{
/* queue family acquire operation */
switch (src_qfi) {
case VK_QUEUE_FAMILY_EXTERNAL:
/* no execution dependency and no availability operation */
*src_stages = VK_PIPELINE_STAGE_2_NONE;
*src_access = VK_ACCESS_2_NONE;
break;
case VK_QUEUE_FAMILY_FOREIGN_EXT:
/* treat the foreign queue as the host */
*src_stages = VK_PIPELINE_STAGE_2_HOST_BIT;
*src_access = VK_ACCESS_2_HOST_WRITE_BIT;
break;
default:
break;
}
/* Perform queue family ownership transfer if src and dst are unequal. */
if (src_qfi != dst_qfi) {
/* queue family acquire operation */
switch (src_qfi) {
case VK_QUEUE_FAMILY_EXTERNAL:
/* no execution dependency and no availability operation */
*src_stages = VK_PIPELINE_STAGE_2_NONE;
*src_access = VK_ACCESS_2_NONE;
break;
case VK_QUEUE_FAMILY_FOREIGN_EXT:
/* treat the foreign queue as the host */
*src_stages = VK_PIPELINE_STAGE_2_HOST_BIT;
*src_access = VK_ACCESS_2_HOST_WRITE_BIT;
break;
default:
break;
}
/* queue family release operation */
switch (dst_qfi) {
case VK_QUEUE_FAMILY_EXTERNAL:
/* no execution dependency and no visibility operation */
*dst_stages = VK_PIPELINE_STAGE_2_NONE;
*dst_access = VK_ACCESS_2_NONE;
break;
case VK_QUEUE_FAMILY_FOREIGN_EXT:
/* treat the foreign queue as the host */
*dst_stages = VK_PIPELINE_STAGE_2_HOST_BIT;
*dst_access = VK_ACCESS_2_HOST_WRITE_BIT;
break;
default:
break;
/* queue family release operation */
switch (dst_qfi) {
case VK_QUEUE_FAMILY_EXTERNAL:
/* no execution dependency and no visibility operation */
*dst_stages = VK_PIPELINE_STAGE_2_NONE;
*dst_access = VK_ACCESS_2_NONE;
break;
case VK_QUEUE_FAMILY_FOREIGN_EXT:
/* treat the foreign queue as the host */
*dst_stages = VK_PIPELINE_STAGE_2_HOST_BIT;
*dst_access = VK_ACCESS_2_HOST_WRITE_BIT;
break;
default:
break;
}
}
*src_stages = vk_expand_src_stage_flags2(*src_stages);