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
+4
View File
@@ -78,6 +78,10 @@ public:
const uint8_t stream_idx;
const uint32_t target_queue;
const bool need_transfer;
// Layout the encoder needs y_cbcr to arrive in. Set during construction
// or init() and read by the compositor on every layer_commit — must not
// change after the first frame.
vk::ImageLayout target_layout = vk::ImageLayout::eGeneral;
static const uint8_t num_slots = 2;
const double bitrate_multiplier;