Fix vulkan encode QFOT layouts (NVIDIA green frame)

Compositor release left layouts as eUndefined while encoder acquire
transitioned to eVideoEncodeSrcKHR (or eTransferSrcOptimal on the NVIDIA
tmp_image path); the spec forbids that layout mismatch for exclusive-mode
QFOT. NVIDIA honoured it by treating encode-queue contents as undefined
(solid green frame).

Encoders now publish target_layout. The compositor's release and the
encoder's acquire both transition eGeneral -> target_layout in a single
barrier; per VkImageMemoryBarrier2 the layout transition is performed
exactly once between the queues, so no second non-QFOT barrier is needed.
target_layout is eVideoEncodeSrcKHR on the direct vulkan encode path and
eGeneral elsewhere.

Also fix optimal_transfer(): the inner `auto to = ...` shadowed the
parameter, so the maintenance9 check was effectively always false.
This commit is contained in:
Jonathan Steffan
2026-05-19 06:59:03 +02:00
committed by Patrick Nicolas
parent f54be85c26
commit e79621d377
4 changed files with 49 additions and 28 deletions
+10
View File
@@ -442,6 +442,16 @@ xrt_result_t compositor::layer_commit(xrt_graphics_sync_handle_t sync_handle)
.srcAccessMask = vk::AccessFlagBits2::eShaderStorageWrite,
.dstStageMask = vk::PipelineStageFlagBits2::eAllCommands,
.dstAccessMask = vk::AccessFlagBits2::eMemoryRead,
// For a queue-family ownership transfer in EXCLUSIVE
// sharing mode, the release barrier's old/new layout
// must match the encoder-side acquire. newLayout is
// the encoder's target_layout; per the VkImageMemoryBarrier2
// spec the layout transition is executed exactly once
// between the queues, so this single QFOT barrier covers
// both the queue-family transfer and the layout
// transition the encoder needs.
.oldLayout = vk::ImageLayout::eGeneral,
.newLayout = encoder->target_layout,
.srcQueueFamilyIndex = vk.queue_family_index,
.dstQueueFamilyIndex = encoder->target_queue,
.image = images[i].image,