Skip to content

VVL: Fix issues for qpmap and intra refresh#211

Merged
dabrain34 merged 6 commits into
KhronosGroup:mainfrom
dabrain34:dab_vvl_qpmap_intra_refresh
Jun 16, 2026
Merged

VVL: Fix issues for qpmap and intra refresh#211
dabrain34 merged 6 commits into
KhronosGroup:mainfrom
dabrain34:dab_vvl_qpmap_intra_refresh

Conversation

@dabrain34

@dabrain34 dabrain34 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Description

First various VVL issues related to QpMap and IntraRefresh extensions enablement.

  • VUID-VkVideoSessionCreateInfoKHR-flags-parameter
  • VUID-VkVideoEncodeInfoKHR-flags-parameter
  • VUID-vkCmdEncodeVideoKHR-pEncodeInfo-10846 (H.264)
  • VUID-vkCmdEncodeVideoKHR-pEncodeInfo-10852 (H.265)

Type of change

VVL bug fix

Issue (optional)

Tests

Intel(R) Iris(R) Xe Graphics (ADL GT2) / Intel open-source Mesa driver Mesa 26.1.2 (git-c653d1509f) / Ubuntu 24.04.4 LTS

Total Tests: 54
Passed: 47
Crashed: 0
Failed: 0
Not Supported: 4
Skipped: 3 (in skip list)
Success Rate: 100.0%

NVIDIA GeForce RTX 3050 Ti Laptop GPU / NVIDIA 595.44.00 / Ubuntu 24.04.4 LTS

Total Tests: 83
Passed: 64
Crashed: 0
Failed: 0
Not Supported: 18
Skipped: 1 (in skip list)
Success Rate: 100.0%

✔️ ALL TESTS COMPLETED - 47 passed, 4 not supported by hardware/driver

Additional Details (optional)

@dabrain34 dabrain34 requested a review from zlatinski June 3, 2026 17:57
@dabrain34 dabrain34 changed the title Fix vvl issues for qpmap and intra refresh VVL: Fix issues for qpmap and intra refresh Jun 3, 2026
Comment thread tests/encode_samples.json Outdated
Comment thread tests/encode_samples.json Outdated
Comment thread vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoderH264.cpp Outdated
@dabrain34 dabrain34 force-pushed the dab_vvl_qpmap_intra_refresh branch from 0f6bffc to d630a43 Compare June 15, 2026 10:54
Mirror the existing encode_h264_qpmap entry: same 352x288 source YUV and
delta-QP map file, with codec/profile adjusted. Drivers lacking the
quantization-map capability still report N/S.
The encoder set the quantization-map session-create flag
VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_QUANTIZATION_DELTA_MAP_BIT_KHR without
enabling VK_KHR_video_encode_quantization_map, tripping
VUID-VkVideoSessionCreateInfoKHR-flags-parameter.

Match the CTS setup (vktCustomInstancesDevices.cpp createDeviceSupportingQueue):

- Add VK_KHR_VIDEO_ENCODE_QUANTIZATION_MAP_EXTENSION_NAME to the optional
  device extensions in both encoder entry points.
- Chain VkPhysicalDeviceVideoEncodeQuantizationMapFeaturesKHR into the feature
  pNext list in VulkanDeviceContext::CreateVulkanDevice so the device is
  created with videoEncodeQuantizationMap = VK_TRUE when supported.
- Drop the spurious encodeSessionParametersCreateInfo->flags = 0 in the H.264
  encoder that was clobbering QUANTIZATION_MAP_COMPATIBLE_BIT_KHR set by
  VideoSessionParametersInfo (the H.265 / AV1 helpers already set it).
- In VkVideoEncoder::InitEncoder, when --qpMap is requested but the extension
  is not enabled on the device, return VK_ERROR_FEATURE_NOT_PRESENT so the
  test framework reports N/S.

Verified on hardware: encode_h264_qpmap passes with --validate clean.
Mirror the existing encode_h264_intrarefresh entry for H.265 and AV1, with
the same picpartition mode and cycle duration of 30. Implementations lacking
the corresponding intra-refresh capability report N/S.
…efreshMode

The encoder set VK_VIDEO_ENCODE_INTRA_REFRESH_BIT_KHR on
VkVideoEncodeInfoKHR.flags without enabling VK_KHR_video_encode_intra_refresh,
tripping VUID-VkVideoEncodeInfoKHR-flags-parameter.

Add VK_KHR_VIDEO_ENCODE_INTRA_REFRESH_EXTENSION_NAME to the optional device
extensions in both encoder entry points (the feature struct was already chained
in VulkanDeviceContext), and require both the extension and the feature in the
InitEncoder N/S guard so drivers lacking either report unsupported cleanly
instead of tripping the layer.
…refresh (H264+H265)

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-10846 (H264) and -10852 (H265)
require
naluSliceEntryCount / naluSliceSegmentEntryCount ==
intraRefreshCycleDuration
on intra-refresh frames when the session was created with
PER_PICTURE_PARTITION mode. The encoder set the slice count to the
configured sliceCount (default 1) and never derived it from the cycle
duration, so every PER_PARTITION intra-refresh frame tripped the layer.

Three pieces were missing:

- The cycle duration was not constrained by the picture geometry. In
PER_PARTITION mode each partition is one slice row, so the maximum
usable duration is height / 16 for H264 (macroblocks) or height / 64 for
H265 (CTUs). VkVideoEncoder::InitEncoder now clamps
intraRefreshCycleDuration to that maximum when the driver does not
advertise nonRectangularIntraRefreshRegions.

- Even after the geometry clamp, the duration can still exceed the
codec's maxSliceCount / maxSliceSegmentCount. Each codec's
InitEncoderCodec now bails out with VK_ERROR_FEATURE_NOT_PRESENT in that
case so the test reports N/S instead of submitting a request the driver
cannot honour.

- naluSliceEntryCount / naluSliceSegmentEntryCount was hard-coded to
  m_encoderConfig->sliceCount in EncodeFrame. ProcessDpb now sets it to
intraRefreshCycleDuration on PER_PARTITION intra-refresh frames, and
the late unconditional assignments in EncodeFrame are removed.
…tersInfoH265

Mirror the H.264 helper: wrap the VPS/SPS/PPS add info, the H.265 session-
parameters create info, the quality-level info and the session-parameters
create info into a single object set up at construction. When enableQpMap is
true, chain VkVideoEncodeQuantizationMapSessionParametersCreateInfoKHR onto
qualityLevelInfo and set QUANTIZATION_MAP_COMPATIBLE_BIT_KHR on
VkVideoSessionParametersCreateInfoKHR.flags (fixes
VUID-vkCmdEncodeVideoKHR-pNext-10315 in the --qpMap path).

InitEncoderCodec switches to a single helper instantiation, matching H.264.
@dabrain34 dabrain34 force-pushed the dab_vvl_qpmap_intra_refresh branch from d630a43 to 73bdfd5 Compare June 15, 2026 15:37
@dabrain34 dabrain34 merged commit cd87744 into KhronosGroup:main Jun 16, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants