Skip to content

VkVideoEncoder: add VK_KHR_video_encode_feedback2 support for AV1 - #224

Open
elima wants to merge 22 commits into
KhronosGroup:mainfrom
elima:elima/VK_KHR_video_encode_feedback2
Open

VkVideoEncoder: add VK_KHR_video_encode_feedback2 support for AV1#224
elima wants to merge 22 commits into
KhronosGroup:mainfrom
elima:elima/VK_KHR_video_encode_feedback2

Conversation

@elima

@elima elima commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

Adds encoder support for the VK_KHR_video_encode_feedback2 extension to the AV1 encode path, exposing the richer per-encode feedback the extension provides on top of the base VK_KHR_video_encode_queue feedback.

When any feedback2 option is enabled, the encoder now requests the VK_KHR_video_encode_feedback2 device extension and the videoEncodeFeedback2 feature, sets up the appropriate query pool, and parses the returned feedback into:

  • Encode status, bitstream size and offset
  • Picture-level feedback: average / min / max quantization
  • Pixel counts: intra / inter / skipped
  • Picture partition count
  • Per-partition feedback: status, bitstream buffer offset and bytes written, up to a requested maximum number of entries

These outputs are intended for use by VK-GL-CTS to validate encoded output against the decoded bitstream, in particular for the per-partition count tests.

New encoder CLI options

Option Description
--pictureFeedback Enable picture-level feedback2 output
--params Provide custom picture feedback params (used together with --pictureFeedback; otherwise defaults are used)
--pixelFeedback Enable pixel-count feedback2 output (intra/inter)
--skippedPixelFeedback Enable skipped-pixel feedback2 output (implies --pixelFeedback)
--enablePerPartitionFeedback Enable per-partition feedback2 output
--maxPerPartitionFeedbackEntries <n> Max per-partition feedback entries to request

Build requirement

VK_KHR_video_encode_feedback2 first appears in Vulkan-Headers v1.4.353, so the minimum required patch version is bumped from 321 to 353. When the system SDK is older, the build fetches v1.4.353 automatically. VkVSCommon.h now routes Vulkan through vulkan_interfaces.h so the encoder library also builds under VKCTS without relying on a system Vulkan installation.

Type of change

feature

Tests

AMD Radeon RX 7600 (RADV NAVI33) / radv Mesa 26.1.0-devel (git-16ece32984) / Debian GNU/Linux 13 (trixie)

Total Tests: 83
Passed: 69
Crashed: 0
Failed: 0
Not Supported: 10
Skipped: 4 (in skip list)
Success Rate: 100.0%

NVIDIA GeForce RTX 4060 Ti / NVIDIA 595.44.00 / Debian GNU/Linux 13 (trixie)

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

@elima

elima commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Heads-up for @dabrain34, @lolzballs, @srinathkr-nv

Comment thread vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoder.cpp
@dabrain34

Copy link
Copy Markdown
Contributor

you should run the tests with vvs_test_runner.sh on supported HW

You should not report an issue which is not public

@elima
elima force-pushed the elima/VK_KHR_video_encode_feedback2 branch from df3ba4b to ad8be88 Compare July 14, 2026 09:27
@lolzballs

Copy link
Copy Markdown
Contributor

Seems like the CTS build from CI is failing because the headers aren't new enough? @dabrain34 are you able to assist with that?

@lolzballs

Copy link
Copy Markdown
Contributor

Oh, the Windows arm64 build is failing because of not new enough headers. The CTS build is failing because it doesn't have the new inls? Not sure what we need to do in this situation, but it seems like it's just an integration issue so maybe we can bypass the CTS check in this case?

@elima

elima commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Oh, the Windows arm64 build is failing because of not new enough headers. The CTS build is failing because it doesn't have the new inls? Not sure what we need to do in this situation, but it seems like it's just an integration issue so maybe we can bypass the CTS check in this case?

That's also what I think we should do. The problem could happen with other extensions too, seems like an issue inherent to this CI job.

We are currently discussing options.

@elima

elima commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

you should run the tests with vvs_test_runner.sh on supported HW

You should not report an issue which is not public

Right, my bad. Both have been fixed.

@elima
elima force-pushed the elima/VK_KHR_video_encode_feedback2 branch from ad8be88 to ca1adf1 Compare July 17, 2026 13:15
Comment thread common/include/VkVSCommon.h Outdated
Comment thread common/libs/VkCodecUtils/VulkanDeviceContext.cpp Outdated
Comment thread common/libs/VkCodecUtils/VulkanDeviceContext.cpp Outdated
Comment thread common/libs/VkCodecUtils/VulkanDeviceContext.h Outdated
Comment thread vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfigH265.cpp
Comment thread vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoderAV1.cpp
Comment thread vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoder.cpp Outdated
Comment thread vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoder.cpp
Comment thread vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoderAV1.cpp Outdated
Comment thread vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfigAV1.cpp Outdated
@dabrain34

Copy link
Copy Markdown
Contributor

I think that would be great to have a full unit test in encode_samples.json to validate the CLI params.

@dabrain34

Copy link
Copy Markdown
Contributor

I added new tests in encode_samples.json
encode_samples.json
to validate the use of the parameters and I hit two different issues:

1.av1_encode_feedback is crashing with

     Warning: dropping unsupported encode feedback flags: 0x100
     vk-video-enc-test: /home/igalia/scerveau/DEV/IGALIA/PROJECTS/VALVE/DEV/Vulkan-Video-Samples/vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoderAV1.cpp:1041: virtual VkResult VkVideoEncoderAV1::AssembleBitstreamData(VkSharedBaseObj<VkVideoEncoder::VkVideoEncodeFrameInfo>&, uint32_t, uint32_t): Assertion `encodeResult.status == VK_QUERY_RESULT_STATUS_COMPLETE_KHR' failed.
  1. encode_av1_encode_feedback_per_partition reports not supported with:
   STDERR:
     Per-partition encode feedback is not supported: maxPerPartitionFeedbackEntries 0, unsupported per-partition flags 0x7
     
     ERROR: InitEncoder() failed with ret(-8)
     Can't create the video encoder: unsupported feature

on nvidia

On Radv I havent been able to find a working public driver.

Comment thread vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfig.cpp Outdated
@elima

elima commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

I think that would be great to have a full unit test in encode_samples.json to validate the CLI params.

Ok, I will look into it.

@elima

elima commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

I fixed most of the reported review issues. Pushed one commit for each fix, so that is easier to review. Once the branch is clear, I will squash the fixes into the main (original) commits. Please let me know if you prefer squashing them now.

@elima

elima commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

I think that would be great to have a full unit test in encode_samples.json to validate the CLI params.

Ok, I will look into it.

Added two AV1 cases to encode_samples.json: one covering picture-level, pixel-count, and skipped-pixel feedback, and another covering per-partition feedback with --maxPerPartitionFeedbackEntries. Unsupported hardware capabilities are reported as N/S by the runner.

@elima

elima commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

I added new tests in encode_samples.json encode_samples.json to validate the use of the parameters and I hit two different issues:

1.av1_encode_feedback is crashing with

     Warning: dropping unsupported encode feedback flags: 0x100
     vk-video-enc-test: /home/igalia/scerveau/DEV/IGALIA/PROJECTS/VALVE/DEV/Vulkan-Video-Samples/vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoderAV1.cpp:1041: virtual VkResult VkVideoEncoderAV1::AssembleBitstreamData(VkSharedBaseObj<VkVideoEncoder::VkVideoEncodeFrameInfo>&, uint32_t, uint32_t): Assertion `encodeResult.status == VK_QUERY_RESULT_STATUS_COMPLETE_KHR' failed.
2. `encode_av1_encode_feedback_per_partition` reports not supported with:
   STDERR:
     Per-partition encode feedback is not supported: maxPerPartitionFeedbackEntries 0, unsupported per-partition flags 0x7
     
     ERROR: InitEncoder() failed with ret(-8)
     Can't create the video encoder: unsupported feature

on nvidia

On Radv I havent been able to find a working public driver.

@elima elima closed this Jul 21, 2026
@elima elima reopened this Jul 21, 2026
@dabrain34

Copy link
Copy Markdown
Contributor

When I run on nvidia driver offering `VK_KHR_video_encode_feedback2 : extension revision 1:

$ ./tests/vvs_test_runner.py -t encode_av1_encode_feedback --verbose

I get a not supported result:

  STDERR:
    Requested encode feedback flags are not supported: 0x100
    
    ERROR: InitEncoder() failed with ret(-8)
    Can't create the video encoder: unsupported feature

Is it expected ?

With

$ ./tests/vvs_test_runner.py -t encode_av1_encode_feedback_per_partition --verbose

I get a failure result

     Done processing 15 input frames!
     Encoded file's location is at /DEV/Vulkan-Video-Samples/tests/results/test_output_av1_encode_feedback_per_partition.ivf
   STDERR:
     
     encodeResult.status is (0x0) NOT STATUS_COMPLETE! bitstreamStartOffset 0, bitstreamSize 42486
     
     encodeResult.status is (0x0) NOT STATUS_COMPLETE! bitstreamStartOffset 0, bitstreamSize 16344
     
     encodeResult.status is (0x0) NOT STATUS_COMPLETE! bitstreamStartOffset 0, bitstreamSize 17645
     
     encodeResult.status is (0x0) NOT STATUS_COMPLETE! bitstreamStartOffset 0, bitstreamSize 13142
   --- Decoder validation output (last 10 lines) ---
   | status: ERROR, exit code: 1
   | General error -1094995529 at line 204 in file /DEV/Vulkan-Video-Samples/vk_video_decoder/libs/VkDecoderUtils/FFmpegDemuxer.cppNo AVFormatContext provided.Error: Failed to initialize VideoStreamDemuxer for file: /DEV/Vulkan-Video-Samples/tests/results/test_output_av1_encode_feedback_per_partition.ivf
   --- End of decoder validation output ---

Can you add more information about your working setup ?

@dabrain34

Copy link
Copy Markdown
Contributor

I think that would be great to have a full unit test in encode_samples.json to validate the CLI params.

Ok, I will look into it.

Added two AV1 cases to encode_samples.json: one covering picture-level, pixel-count, and skipped-pixel feedback, and another covering per-partition feedback with --maxPerPartitionFeedbackEntries. Unsupported hardware capabilities are reported as N/S by the runner.

This is expected that CI runner is reporting not supported as there is no hardware supporting Vulkan Video on these runners.

@elima

elima commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Can you add more information about your working setup ?

I get the exact same results on NVidia (GeForce RTX 4060 Ti / NVidia 595.44.00):

  • encode_av1_encode_feedback_per_partition: Fail. This is unexpected, This driver should support per-partition feedback.
  • encode_av1_encode_feedback: Not Supported. This is expected. NVidia only supports per-partition feedback.

On AMD (RADV and a custom, non-public branch of Mesa that supports feedback2), I get:

  • encode_av1_encode_feedback_per_partition: Not Supported. This is expected, AMD doesn't support per-partition feedback.
  • encode_av1_encode_feedback: Pass.

I'm looking into the NVidia failure. My preliminary assessment is that the driver is outputting the right feedback2 values, but leaving the final status blank (zero), when it should be status-complete. A similar CTS test passes so this needs further investigation.

Comment thread vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoderAV1.cpp
Comment thread vk_video_encoder/libs/VkVideoEncoder/VkVideoEncoder.cpp
Comment thread cmake/FindVulkanSDK.cmake
elima and others added 4 commits July 24, 2026 09:49
VK_KHR_video_encode_feedback2 first appears in Vulkan-Headers v1.4.353.
The build pinned the minimum at v1.4.321, which predates the extension,
so the fetched headers left every feedback2 type and flag undefined.
Bump the minimum patch version to 353 so the encoder builds against
headers that provide the extension.
This builds on top of video encode functionality used by CTS for AV1
codec. Support for other H.26X codecs will be added in a follow-up.
These will be used in CTS for validation against decoded bitstream as
part of per-partition count tests.
After updating to v1.4.353, the Vulkan-Loader build reads
VulkanHeaders_VERSION from find_package(VulkanHeaders).
When the headers come from FetchContent there is no installed package
to find, the variable is empty and CMake fails with:

    CMake Error: if given arguments: "VERSION_GREATER" "1.4.353"

This only happens on hosts without a system Vulkan SDK, such as
Windows CI runners, because only they build the loader from source.

Set VulkanHeaders_VERSION manually before configuring the loader,
matching the version of the fetched headers.
elima added 15 commits July 24, 2026 09:49
The encode feedback query status was only checked with assert(), which
compiles away in Release builds, so a failed or incomplete encode
operation would go unnoticed and the bitstream data would be consumed
with a garbage offset and size.

Test the status explicitly and return VK_ERROR_UNKNOWN when it is not
VK_QUERY_RESULT_STATUS_COMPLETE_KHR. Do not assert in the handled
failure path, so assert-enabled and Release builds report the same
error.
Chain VkVideoEncodeFeedback2CapabilitiesKHR into the encode
capabilities query and use it to validate the query pool creation:
fail when per-partition feedback is unsupported, clamp the requested
entry count to the reported maximum, and mask out unsupported
per-partition feedback flags.
…lags

VK_ERROR_FEATURE_NOT_PRESENT describes the failure better than
VK_ERROR_INITIALIZATION_FAILED and is handled as "unsupported" by
IsVideoUnsupportedResult().
Min/max quantization feedback flags were silently masked out when not
supported by the implementation. Report the dropped flags instead.
string_VkResult() and string_VkResult_Extended() had no callers.
The values parsed from "--pictureFeedback --params" were never read.
Remove them and the related help text.
Use the existing conditional pNext accumulator instead of a separate
ternary chain, and check the feature with the same
CHECK_VULKAN_FEATURE syntax as the other optional features.
SetVideoEncodeFeedback2Enabled() now adds the required device
extension itself, so the feature flag and the extension cannot get out
of sync.
Add runner coverage for picture-level QP and pixel-count feedback,
skipped-pixel feedback, and per-partition feedback with a configurable
maximum entry count.
The options report aggregate pixel counts rather than per-pixel feedback.
Rename --pixelFeedback and --skippedPixelFeedback to --pixelCountFeedback
and --skippedPixelCountFeedback, and update the corresponding
configuration members, help text, and test sample.
The BITSTREAM_HAS_OVERRIDES feedback value was parsed but no CLI option
ever requested it, so it was never exercised. Add --hasOverridesFeedback,
which requests VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_HAS_OVERRIDES_BIT_KHR
and writes the reported value (overrides=...) to the feedback text
output. Exercise it from the av1_encode_feedback test.
The combined check printed the unsupported feedback flags as a single
hexadecimal mask, which is hard to map back to a specific request. Loop
over the unsupported bits and report each one by name so it is clear
exactly which requested feedback the implementation lacks before
failing with VK_ERROR_FEATURE_NOT_PRESENT.
Vulkan-Loader reads VulkanHeaders_VERSION to gate part of its
configuration (notably the Windows arm64 build), and it is left unset
when the headers come from FetchContent instead of an installed
package. Document why we seed it here and add a TODO to drop it once
Vulkan-Loader derives the version itself as a subproject.
@elima
elima force-pushed the elima/VK_KHR_video_encode_feedback2 branch from 99703bf to aa03f3d Compare July 24, 2026 11:31
@elima

elima commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

I get the exact same results on NVidia (GeForce RTX 4060 Ti / NVidia 595.44.00):

* encode_av1_encode_feedback_per_partition: _Fail_. This is unexpected, This driver should support per-partition feedback.

* encode_av1_encode_feedback: _Not Supported_. This is expected. NVidia only supports per-partition feedback.

I'm looking into the NVidia failure. My preliminary assessment is that the driver is outputting the right feedback2 values, but leaving the final status blank (zero), when it should be status-complete. A similar CTS test passes so this needs further investigation.

Regarding the encode_av1_encode_feedback_per_partition failure on NVidia (595.44.00 / RTX 4060 Ti): we believe this is a driver bug rather than an issue in this PR. The encode itself completes normally — all 15 frames are processed and a non-empty bitstream is produced (e.g. bitstreamStartOffset=0, bitstreamSize=42486) — but the whole-picture query status reads back 0x0 (VK_QUERY_RESULT_STATUS_NOT_READY_KHR) on every frame, so the encoder treats the result as incomplete and aborts, leaving an empty .ivf that then fails decode validation. That status is read only after waiting on the encode-complete fence and with VK_QUERY_RESULT_WAIT_BIT set, with vkGetQueryPoolResults returning VK_SUCCESS, so a NOT_READY status is contradictory: the results are finalized and the preceding offset/size fields read back correctly, which indicates the driver populated the feedback values but never wrote the whole-picture status (leaving it at its reset value) instead of VK_QUERY_RESULT_STATUS_COMPLETE_KHR. Notably the AV1 CTS feedback2_partition_count_* tests request per-partition feedback only, whereas this case also enables --pictureFeedback, so the trigger may be the combination of whole-picture QP feedback with per-partition feedback. @srinathkr-nv can you take a look please, in case we are missing something?

@srinathkr-nv

Copy link
Copy Markdown
Contributor

@elima I noticed your above comments just now, after being at-mentioned. Can you try out the latest Vulkan beta driver (Linux 595.44.11, Windows 596.83) from https://developer.nvidia.com/vulkan-driver to see if this issue reproduces with it?

@elima

elima commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@elima I noticed your above comments just now, after being at-mentioned. Can you try out the latest Vulkan beta driver (Linux 595.44.11, Windows 596.83) from https://developer.nvidia.com/vulkan-driver to see if this issue reproduces with it?

Hi, Srinath!
I could not find 595.44.11, but tried 595.45.04 (nearest I could find) and 610.43.03 (latest) and with both encode_av1_encode_feedback_per_partition gives not-supported instead of failure.

I also changed the video sample to one with higher resolution, because the original test had 352x288 which I understand NVidia feedback2 doesn't support. But still the code never reaches that point, the extension is not advertised.

I have spent several rounds of debugging trying to find a culprit on VVS side, but have exhausted all avenues. Is it possible that later drivers like 610.43.03 (and 595.45.04) don't support (or advertise) encode_feedback2?

$ ./tests/vvs_test_runner.py -t encode_av1_encode_feedback_per_partition --verbose
✓ Found encoder: /home/devel/devel/src/Vulkan-Video-Samples/build/vk_video_encoder/demos/vk-video-enc-test
✓ Found decoder: /home/devel/devel/src/Vulkan-Video-Samples/build/vk_video_decoder/demos/vk-video-dec-test
✓ Found executable: /home/devel/devel/src/Vulkan-Video-Samples/build/vk_video_encoder/demos/vk-video-enc-test
✓ Found executable: /home/devel/devel/src/Vulkan-Video-Samples/build/vk_video_decoder/demos/vk-video-dec-test
=== Vulkan Video Samples Test Framework ===
Encoder: /home/devel/devel/src/Vulkan-Video-Samples/build/vk_video_encoder/demos/vk-video-enc-test
Decoder: /home/devel/devel/src/Vulkan-Video-Samples/build/vk_video_decoder/demos/vk-video-dec-test

✓ All encoder YUV resource files found and verified
✓ All decoder resource files found and verified

==================================================
RUNNING ENCODER TESTS
==================================================
======================================================================
VULKAN VIDEO TEST SUITE
======================================================================
Binary: /home/devel/devel/src/Vulkan-Video-Samples/build/vk_video_encoder/demos/vk-video-enc-test

✓ All encoder YUV resource files found and verified

[1/1] Running: encode_av1_encode_feedback_per_partition
   Command: /home/devel/devel/src/Vulkan-Video-Samples/build/vk_video_encoder/demos/vk-video-enc-test -i /home/devel/devel/src/Vulkan-Video-Samples/tests/resources/video/yuv/1920x1080_420_8le.yuv --codec av1 --inputWidth 1920 --inputHeight 1080 --inputNumPlanes 3 --verbose --profile main --noDeviceFallback --pictureFeedback --enablePerPartitionFeedback --maxPerPartitionFeedbackEntries 16 -o /home/devel/devel/src/Vulkan-Video-Samples/tests/results/test_output_av1_encode_feedback_per_partition.ivf
✓ Detected driver: nvidia
✓ Detected GPU: NVIDIA GeForce RTX 4060 Ti
 ⚠️  Warning detected in av1_encode_feedback_per_partition
○ N/S (0.47s)
  === Command Output ===
  STDOUT:
    No QP was provided. Using default value: 20.
    numFrames 0 should be different from zero and inferior to input file frame count: 30. Use input file frame count.
    Enumerating instance layers:
    	VK_LAYER_NV_optimus
    	VK_LAYER_NV_present
    	VK_LAYER_VALVE_steam_fossilize_64
    	VK_LAYER_VALVE_steam_overlay_64
    	VK_LAYER_VALVE_steam_fossilize_32
    	VK_LAYER_VALVE_steam_overlay_32
    	VK_LAYER_MESA_device_select
    	VK_LAYER_RENDERDOC_Capture
    	VK_LAYER_MESA_overlay
    	VK_LAYER_KHRONOS_validation
    	VK_LAYER_INTEL_nullhw
    Looking for instance layers:
    Enumerating instance extensions:
    	VK_KHR_device_group_creation
    	VK_KHR_display
    	VK_KHR_external_fence_capabilities
    	VK_KHR_external_memory_capabilities
    	VK_KHR_external_semaphore_capabilities
    	VK_KHR_get_display_properties2
    	VK_KHR_get_physical_device_properties2
    	VK_KHR_get_surface_capabilities2
    	VK_KHR_surface
    	VK_KHR_surface_protected_capabilities
    	VK_KHR_wayland_surface
    	VK_KHR_xcb_surface
    	VK_KHR_xlib_surface
    	VK_EXT_acquire_drm_display
    	VK_EXT_acquire_xlib_display
    	VK_EXT_debug_report
    	VK_EXT_debug_utils
    	VK_EXT_direct_mode_display
    	VK_EXT_display_surface_counter
    	VK_EXT_surface_maintenance1
    	VK_EXT_swapchain_colorspace
    	VK_NV_display_stereo
    	VK_KHR_portability_enumeration
    	VK_LUNARG_direct_driver_loading
    Looking for instance extensions:
    ###### List of Instance Extensions: ######
    	 VK_KHR_device_group_creation(v.1)
    	 VK_KHR_display(v.23)
    	 VK_KHR_external_fence_capabilities(v.1)
    	 VK_KHR_external_memory_capabilities(v.1)
    	 VK_KHR_external_semaphore_capabilities(v.1)
    	 VK_KHR_get_display_properties2(v.1)
    	 VK_KHR_get_physical_device_properties2(v.2)
    	 VK_KHR_get_surface_capabilities2(v.1)
    	 VK_KHR_surface(v.25)
    	 VK_KHR_surface_protected_capabilities(v.1)
    	 VK_KHR_wayland_surface(v.6)
    	 VK_KHR_xcb_surface(v.6)
    	 VK_KHR_xlib_surface(v.6)
    	 VK_EXT_acquire_drm_display(v.1)
    	 VK_EXT_acquire_xlib_display(v.1)
    	 VK_EXT_debug_report(v.10)
    	 VK_EXT_debug_utils(v.2)
    	 VK_EXT_direct_mode_display(v.1)
    	 VK_EXT_display_surface_counter(v.1)
    	 VK_EXT_surface_maintenance1(v.1)
    	 VK_EXT_swapchain_colorspace(v.5)
    	 VK_NV_display_stereo(v.1)
    	 VK_KHR_portability_enumeration(v.1)
    	 VK_LUNARG_direct_driver_loading(v.1)
    *** Selected Vulkan physical device with name: NVIDIA GeForce RTX 4060 Ti, vendor ID: 10de, device UUID: 2939fda2-d1d5-41c2-0ee3-8cfaecad267c, and device ID: 2803, driver ID: 4, driver name: NVIDIA, driver info: 610.43.03, Num Decode Queues: 0, Num Encode Queues: 1 ***
    ================================================================================
                              AV1 Encoder Capabilities
    ================================================================================
      flags                                           : 0xd
      maxSingleReferenceCount                         : 7
      singleReferenceNameMask                         : 0x7f
      maxUnidirectionalCompoundReferenceCount         : 4
      maxUnidirectionalCompoundGroup1ReferenceCount   : 4
      unidirectionalCompoundReferenceNameMask         : 0xf
      maxBidirectionalCompoundReferenceCount          : 7
      maxBidirectionalCompoundGroup1ReferenceCount    : 4
      maxBidirectionalCompoundGroup2ReferenceCount    : 3
      bidirectionalCompoundReferenceNameMask          : 0x7f
      maxTemporalLayerCount                           : 1
      maxSpatialLayerCount                            : 1
      maxPerPartitionFeedbackEntries                  : 0
      supportedPerPartitionEncodeFeedbackFlags        : 0x0
    ================================================================================
                         AV1 Encoder Quality Level Properties
    ================================================================================
      preferredRateControlMode                        : 4
      preferredRateControlLayerCount                  : 1
      preferredRateControlFlags                       : 5
      preferredGopFrameCount                          : 250
      preferredKeyFramePeriod                         : 250
      preferredConsecutiveBipredictiveFrameCount      : 5
      preferredTemporalLayerCount                     : 1
      preferredConstantQIndex.intraQIndex             : 114
      preferredConstantQIndex.predictiveQIndex        : 131
      preferredConstantQIndex.bipredictiveQIndex      : 147
      preferredMaxSingleReferenceCount                : 1
      preferredSingleReferenceNameMask                : 1
      preferredMaxUnidirectionalCompoundReferenceCount: 4
      preferredMaxUnidirectionalCompoundGroup1ReferenceCount: 4
      preferredUnidirectionalCompoundReferenceNameMask: 15
      preferredMaxBidirectionalCompoundReferenceCount : 7
      preferredMaxBidirectionalCompoundGroup1ReferenceCount: 4
      preferredMaxBidirectionalCompoundGroup2ReferenceCount: 3
      preferredBidirectionalCompoundReferenceNameMask : 127
    ================================================================================
                                Encoder Capabilities
    ================================================================================
      flags                                           : 0x4
      minCodedExtent                                  : 192 x 128
      maxCodedExtent                                  : 8192 x 8192
      pictureAccessGranularity                        : 64 x 64
      encodeInputPictureGranularity                   : 2 x 2
      maxDpbSlots                                     : 17
      maxActiveReferencePictures                      : 7
      maxQualityLevels                                : 7
      maxRateControlLayers                            : 1
      maxBitrate                                      : 120000000
      rateControlModes                                : 0x7
      minBitstreamBufferOffsetAlignment               : 256
      minBitstreamBufferSizeAlignment                 : 256
    
    GOP frame count: 30, IDR period: 30, Consecutive B frames: 5
    
    Input order:   0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  
    Frame Type:   IDR B   B   B   B   B   P   B   B   B   B   B   P   B   B   B   B   B   P   B   B   B   B   B   P   B   B   B   B   P   
    Encode  order: 0   2   3   4   5   6   1   8   9   10  11  12  7   14  15  16  17  18  13  20  21  22  23  24  19  26  27  28  29  25  
    Warning: dropping unsupported picture feedback flags: 0x30
  STDERR:
    Per-partition encode feedback is not supported by the implementation for this video profile.
    
    ERROR: InitEncoder() failed with ret(-8)
    Can't create the video encoder: unsupported feature


======================================================================
VULKAN VIDEO CODEC TEST RESULTS SUMMARY
======================================================================

ENCODER RESULTS:
======================================================================
VULKAN VIDEO ENCODER TEST RESULTS SUMMARY
======================================================================
AV1      -  0 pass,  1 N/S,  0 crash,  0 fail ( 1 total)
----------------------------------------------------------------------
○ av1  encode_av1_encode_feedback_per_partition - N/S   (0.47s)
----------------------------------------------------------------------

### NVIDIA GeForce RTX 4060 Ti / NVIDIA 610.43.03 / Debian GNU/Linux 13 (trixie)

Total Tests:     1
Passed:          0
Crashed:         0
Failed:          0
Not Supported:   1

✔️ ALL TESTS COMPLETED - 0 passed, 1 not supported by hardware/driver

======================================================================
OVERALL SUMMARY
======================================================================

### Debian GNU/Linux 13 (trixie)

Total Tests:     1
Passed:          0
Crashed:         0
Failed:          0
Not Supported:   1

✔️ ALL TESTS COMPLETED - 0 passed, 1 not supported by hardware/driver
📊 Results exported to: /home/devel/devel/src/Vulkan-Video-Samples/tests/results/encode_results.json
🧹 Cleaned up output artifacts
🧹 Cleaned up output artifacts

@srinathkr-nv

Copy link
Copy Markdown
Contributor

Is it possible that later drivers like 610.43.03 (and 595.45.04) don't support (or advertise) encode_feedback2?

Yes, this is expected. VK_KHR_video_encode_feedback2 is supported only by the NVIDIA Vulkan beta drivers specified in https://developer.nvidia.com/vulkan-driver under the section "Vulkan Developer Beta Driver Release Updates".

The link to the 595.44.11 beta driver is present in the section "Vulkan 1.4 Developer Beta Driver Downloads" but I'll provide it here directly: https://developer.nvidia.com/downloads/assets/gameworks/downloads/secure/Vulkan_Beta_Drivers/NVIDIA-Linux-x86_64-595.44.11.run

The 352x288 sample is too small to exercise per-partition and pixel
count feedback meaningfully on some encoders. Switch both AV1 encode
feedback2 tests to the 1920x1080 8-bit 4:2:0 sample so the reported
feedback reflects a realistic encode.
@elima

elima commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

The link to the 595.44.11 beta driver is present in the section "Vulkan 1.4 Developer Beta Driver Downloads" but I'll provide it here directly: https://developer.nvidia.com/downloads/assets/gameworks/downloads/secure/Vulkan_Beta_Drivers/NVIDIA-Linux-x86_64-595.44.11.run

Thanks, Srinath. I had been testing on 595.45.04 and 610.43.03, which don't advertise the extension, but 595.44.11 does indeed :)

On 595.44.11 (RTX 4060 Ti) per-partition feedback is now advertised and the test reaches the encode. It reproduces the original failure though: the whole-picture query status reads back 0 (VK_QUERY_RESULT_STATUS_NOT_READY_KHR) on every frame, even though the encode completes and writes a valid bitstream (non-zero offset and size).

The status is read with VK_QUERY_RESULT_WAIT_BIT, after also waiting on the encode-complete fence, and vkGetQueryPoolResults returns VK_SUCCESS. So NOT_READY looks wrong here: the result is finalized, and the offset and size fields that precede the status read back correctly, so the whole-picture status field is being left at zero instead of set to COMPLETE. My working assumption is that the per picture partition statuses are correct and only the whole-picture status is affected.

Let me know if you want me to share a dump of the per-partition statuses if that helps.

@srinathkr-nv

srinathkr-nv commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

I really should have checked the updates to the test application code in this PR earlier. I noticed just now that this PR has updated only the vk_video_encoder/src/vulkan_video_encoder.cpp code to call VulkanDeviceContext::SetVideoEncodeFeedback2Enabled() but has not made similar updates to the "demo" application at vk_video_encoder/demos/vk-video-enc/Main.cpp, which the test runner uses.

Naturally, this means that the encode_feedback2 test cases run without enabling the videoEncodeFeedback2 device feature, so none of the feedback corresponding to this extension is actually available in the query result buffer. The code in VkVideoEncoderAV1::GetEncodeFeedbackResults() expects some of the new feedback values (like the avg, min and max quantization) and reads the result buffer for these values, accidentally consuming the whole-picture status.

@elima

elima commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

I really should have checked the updates to the test application code in this PR earlier. I noticed just now that this PR has updated only the vk_video_encoder/src/vulkan_video_encoder.cpp code to call VulkanDeviceContext::SetVideoEncodeFeedback2Enabled() but has not made similar updates to the "demo" application at vk_video_encoder/demos/vk-video-enc/Main.cpp, which the test runner uses.

Great catch! That was indeed the problem; totally overlooked adding the call to the demo.

per-partition feedback test is now passing with 3562e09.

Thank you for the reviews!

Call VulkanDeviceContext::SetVideoEncodeFeedback2Enabled() when any AV1
feedback option is set, mirroring the VulkanVideoEncoder library path, so
the demo enables the videoEncodeFeedback2 feature and the
VK_KHR_video_encode_feedback2 extension.
Comment thread tests/encode_samples.json
"--pictureFeedback",
"--pixelCountFeedback",
"--skippedPixelCountFeedback",
"--hasOverridesFeedback"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest not including --hasOverridesFeedback here, it is not an mandatory feedback with feedback2.

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.

5 participants