hasvk: Add VK_KHR_video_encode_intra_refresh for gen7.

Each macroblock's intra/inter decision is already made on its own when the
PAK objects are emitted, so refreshing a region is a matter of coding the
macroblocks it covers the way an I slice codes them.  Regions divide the
picture evenly along rows, columns or raster order, which leaves the block,
block-row and block-column modes supported and gives empty regions for free
when the cycle is longer than the split axis.

Two things needed care.  PAK keeps the I slice numbering for MbType5Bits
inside a P slice, where H.264 itself offsets intra mb_types by 5; handing it
the offset value hangs the MFC.  And under constrained intra prediction a
neighbour only counts as available if it is in the refresh region too,
because prediction may not cross into an inter macroblock.

Nothing constrains motion away from not-yet-refreshed regions, which is
sound only because there is no motion estimation: every vector is zero, so a
macroblock reads its own co-located block and never leaves its region.
Motion estimation will have to honour VkVideoReferenceIntraRefreshInfoKHR's
dirty region count.

Per-picture-partition mode is not offered.  It wants the refreshed slice
coded as an I slice, header included, rather than as intra macroblocks
inside a P slice.

dEQP-VK.video.encode.h264.intra_refresh_* goes from 44 NotSupported to 12
Pass; all three modes pass in the variants that can run.  The other 32 stop
at a CTS precondition, maxDpbSlots >= GOP frame count, which the driver's
two slots do not meet.  Raising that needs real DPB slot tracking and is
what gates B frames and ffmpeg's encoder too.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
elwrclandClaude Opus 5 committed 2026-08-21 07:35:13 +03:00
1 parent 113661753e
commit 0716678e70
6 files changed
+126 -12

No files matched your search

+4
View File
@@ -289,6 +289,7 @@ get_device_extensions(const struct anv_physical_device *device,
.KHR_video_decode_h264 = video_decode,
.KHR_video_encode_queue = video_encode,
.KHR_video_encode_h264 = video_encode,
.KHR_video_encode_intra_refresh = video_encode,
.KHR_video_maintenance1 = video_decode || video_encode,
.KHR_video_maintenance2 = video_decode || video_encode,
.KHR_unified_image_layouts = true,
@@ -735,6 +736,9 @@ get_features(const struct anv_physical_device *pdevice,
/* VK_KHR_video_maintenance2 */
.videoMaintenance2 = true,
/* VK_KHR_video_encode_intra_refresh */
.videoEncodeIntraRefresh = true,
/* VK_KHR_unified_image_layouts
*
* Aux usage is derived from the layout's usage flags, and GENERAL simply