From e3356acc163ba7a93c062dbfa269645a2f29a79c Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 22 Sep 2025 23:05:08 +0200 Subject: [PATCH] Update Monado --- flake.nix | 2 +- monado-rev | 2 +- ...0008-vk-fix-video-encode-queue-index.patch | 24 +++++++++++++++++++ server/driver/wivrn_comp_target.cpp | 6 ++--- server/utils/wivrn_vk_bundle.cpp | 8 +++---- 5 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 patches/monado/0008-vk-fix-video-encode-queue-index.patch diff --git a/flake.nix b/flake.nix index ff79204d..5a729387 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,7 @@ # Keep in sync with CMakeLists.txt monado rev rev = builtins.readFile ./monado-rev; # Nix will output the correct hash when it doesn't match - hash = "sha256-K8DbHvyDmNwOxTxhTn9e/6++9wmY14ryVrqDOQCXcsw="; + hash = "sha256-f1lcFVH5Ww7v2Mjubtn8/nEnOsRt9gUhFeYgcSXSfeE="; }; }; diff --git a/monado-rev b/monado-rev index 63703cdc..c59bcf4e 100644 --- a/monado-rev +++ b/monado-rev @@ -1 +1 @@ -c4417629ac099e24001bb50bd327b769901cbb0a +d5cf67f6aa259b2c4ebbc6fa3211e6dde51c8970 diff --git a/patches/monado/0008-vk-fix-video-encode-queue-index.patch b/patches/monado/0008-vk-fix-video-encode-queue-index.patch new file mode 100644 index 00000000..b8df231f --- /dev/null +++ b/patches/monado/0008-vk-fix-video-encode-queue-index.patch @@ -0,0 +1,24 @@ +From a17589c9f77a5e5c3a56685017115fe07f9fd9cc Mon Sep 17 00:00:00 2001 +From: Patrick Nicolas +Date: Mon, 22 Sep 2025 23:33:31 +0200 +Subject: [PATCH] vk: fix video encode queue index + +--- + src/xrt/auxiliary/vk/vk_bundle_init.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/xrt/auxiliary/vk/vk_bundle_init.c b/src/xrt/auxiliary/vk/vk_bundle_init.c +index 01ce0c2f1..c4c63b608 100644 +--- a/src/xrt/auxiliary/vk/vk_bundle_init.c ++++ b/src/xrt/auxiliary/vk/vk_bundle_init.c +@@ -1513,6 +1513,7 @@ vk_create_device(struct vk_bundle *vk, + vk->vkGetDeviceQueue(vk->device, vk->main_queue.family_index, 0, &vk->main_queue.queue); + #if defined(VK_KHR_video_encode_queue) + if (vk->encode_queue.family_index != VK_QUEUE_FAMILY_IGNORED) { ++ vk->encode_queue.index = 0; + vk->vkGetDeviceQueue(vk->device, vk->encode_queue.family_index, 0, &vk->encode_queue.queue); + } + #endif +-- +2.51.0 + diff --git a/server/driver/wivrn_comp_target.cpp b/server/driver/wivrn_comp_target.cpp index 46a0be4e..d3060ce5 100644 --- a/server/driver/wivrn_comp_target.cpp +++ b/server/driver/wivrn_comp_target.cpp @@ -305,7 +305,7 @@ static bool comp_wivrn_init_post_vulkan(struct comp_target * ct, uint32_t prefer cn->wivrn_bundle->device, { .flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer, - .queueFamilyIndex = vk->queue_family_index, + .queueFamilyIndex = vk->main_queue.family_index, }); cn->wivrn_bundle->name(cn->command_pool, "comp target command pool"); } @@ -584,8 +584,8 @@ static VkResult comp_wivrn_present(struct comp_target * ct, .dstAccessMask = vk::AccessFlagBits::eMemoryWrite, .oldLayout = vk::ImageLayout::eTransferSrcOptimal, .newLayout = vk::ImageLayout::eVideoEncodeSrcKHR, - .srcQueueFamilyIndex = vk->queue_family_index, - .dstQueueFamilyIndex = vk->encode_queue_family_index, + .srcQueueFamilyIndex = vk->main_queue.family_index, + .dstQueueFamilyIndex = vk->encode_queue.family_index, .image = psc_image.image, .subresourceRange = {.aspectMask = vk::ImageAspectFlagBits::eColor, .baseMipLevel = 0, diff --git a/server/utils/wivrn_vk_bundle.cpp b/server/utils/wivrn_vk_bundle.cpp index 5d9b688a..088f77c3 100644 --- a/server/utils/wivrn_vk_bundle.cpp +++ b/server/utils/wivrn_vk_bundle.cpp @@ -89,11 +89,11 @@ wivrn::wivrn_vk_bundle::wivrn_vk_bundle(vk_bundle & vk, std::span .vulkanApiVersion = VK_MAKE_VERSION(1, 3, 0), // FIXME: sync with wivrn_session.cpp }, vk.has_EXT_debug_utils), - queue(device, vk.queue_family_index, vk.queue_index), - queue_family_index(vk.queue_family_index), + queue(device, vk.main_queue.family_index, vk.main_queue.index), + queue_family_index(vk.main_queue.family_index), #ifdef VK_KHR_video_encode_queue - encode_queue(make_queue(device, vk.encode_queue, vk.encode_queue_family_index, vk.encode_queue_index)), - encode_queue_family_index(vk.encode_queue_family_index), + encode_queue(make_queue(device, vk.encode_queue.queue, vk.encode_queue.family_index, vk.encode_queue.index)), + encode_queue_family_index(vk.encode_queue.family_index), #else encode_queue(nullptr), encode_queue_family_index(vk::QueueFamilyIgnored),