Skip to content

Minor cleanup: pNext chaining of structures#192

Merged
zlatinski merged 1 commit intonvpro-samples:mainfrom
krajunv:pNext-chain-cleanup
Jan 23, 2026
Merged

Minor cleanup: pNext chaining of structures#192
zlatinski merged 1 commit intonvpro-samples:mainfrom
krajunv:pNext-chain-cleanup

Conversation

@krajunv
Copy link
Contributor

@krajunv krajunv commented Jan 21, 2026

  • Cleanup pNext chain of structures that extends VkVideoReferenceSlotInfoKHR
  • Group together pNext chaining of structure that extends VkVideoEncodeInfoKHR in the codec specific EnodeFrameInfo reset methods (eg. VkVideoEncodeFrameInfoH265::Reset())

@krajunv
Copy link
Contributor Author

krajunv commented Jan 21, 2026

@zlatinski @srinathkr-nv Please take a look at the small cleanup.

Copy link
Contributor

@srinathkr-nv srinathkr-nv left a comment

Choose a reason for hiding this comment

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

Instead of manually adding code for manipulating the pNext chain, please look at using vk::ChainNextVkStruct() wherever needed.

@krajunv
Copy link
Contributor Author

krajunv commented Jan 21, 2026

I initially considered using this approach. However, I wanted to group the population of one structure parameters in a single place and follow the order referenceSlotsInfo -> stdDpbSlotInfo -> referenceIntraRefreshInfo for populating and chaining. To maintain this ordering, I chose to manually chain the structures. I find these steps equally simple and easy.

I’ll try updating the implementation based on your suggestion and see if I can still preserve the desired grouping and ordering I wanted which is mentioned above.

@krajunv
Copy link
Contributor Author

krajunv commented Jan 21, 2026

I updated the files.

Just to note, if multiple features are enabled conditionally, maintaining a specific chaining order (or any predefined order we may want to follow in the future) is not possible without introducing conditional chaining. Since the ordering is not a requirement in Vulkan, so I changed the coded accordingly.

Copy link
Contributor

@zlatinski zlatinski left a comment

Choose a reason for hiding this comment

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

Nice clean-up! Thank you, Raju!

@krajunv krajunv requested a review from srinathkr-nv January 22, 2026 03:08
Copy link
Contributor

@srinathkr-nv srinathkr-nv left a comment

Choose a reason for hiding this comment

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

Please squash together the commits in this PR, so that there is a single commit with the required description of changes.

m_dpbAV1->GetDirtyIntraRefreshRegions((int8_t)dpbIdx);

pFrameInfo->dpbSlotInfo[numReferenceSlots].pNext = &pFrameInfo->referenceIntraRefreshInfo[numReferenceSlots];
vk::ChainNextVkStruct(pFrameInfo->dpbSlotInfo[numReferenceSlots], pFrameInfo->referenceIntraRefreshInfo[numReferenceSlots]);
Copy link
Contributor

Choose a reason for hiding this comment

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

While this is technically correct and we don't have strict usage rules for vk::ChainNextVkStruct, I think that we should use this helper in such a way that it naturally follows the specification language.

Whenever the specification refers to a given pNext chain, it is with respect to the base structure in an API call. Using a modified version of the example from a previous comment i.e. VkVideoReferenceSlotInfoKHR -> VkVideoDecodeAV1DpbSlotInfoKHR -> VkVideoReferenceIntraRefreshInfoKHR, both VkVideoDecodeAV1DpbSlotInfoKHR and VkVideoReferenceIntraRefreshInfoKHR are said to be present in the pNext chain of VkVideoReferenceSlotInfoKHR, and the ordering between VkVideoDecodeAV1DpbSlotInfoKHR and VkVideoReferenceIntraRefreshInfoKHR is not relevant.

For this reason, I suggest rewriting this statement as:

    vk::ChainNextVkStruct(pFrameInfo->referenceSlotsInfo[numReferenceSlots], pFrameInfo->referenceIntraRefreshInfo[numReferenceSlots]);

, in the intra-refresh-specific blocks for all codecs.

All the other changes look fine to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the chaining as per your suggestion.

@krajunv krajunv force-pushed the pNext-chain-cleanup branch from 9a5e52e to bdd69a7 Compare January 22, 2026 10:43
* Cleanup pNext chain of structures that extends VkVideoReferenceSlotInfoKHR.
  Use `vk::ChainNextVkStruct()` helper function to chain the structures.
* Group together pNext chaining of structure that extends VkVideoEncodeInfoKHR in the
  codec specific EnodeFrameInfo reset methods (eg. VkVideoEncodeFrameInfoH265::Reset())

Signed-off-by: Raju Konda <kraju@nvidia.com>
@krajunv krajunv force-pushed the pNext-chain-cleanup branch from bdd69a7 to 6b2cb8f Compare January 22, 2026 10:47
@krajunv
Copy link
Contributor Author

krajunv commented Jan 22, 2026

Squashed the commits. @zlatinski Please check and merge.

Copy link
Contributor

@srinathkr-nv srinathkr-nv left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@zlatinski zlatinski left a comment

Choose a reason for hiding this comment

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

LGTM

@zlatinski zlatinski merged commit 2590d75 into nvpro-samples:main Jan 23, 2026
5 checks passed
@krajunv krajunv deleted the pNext-chain-cleanup branch January 28, 2026 04:47
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.

3 participants