Skip to content

Add helper to import an external fence#24

Merged
fincs merged 2 commits intodevkitPro:masterfrom
averne:fence-import
Jan 29, 2025
Merged

Add helper to import an external fence#24
fincs merged 2 commits intodevkitPro:masterfrom
averne:fence-import

Conversation

@averne
Copy link
Copy Markdown
Contributor

@averne averne commented Jan 27, 2025

During hardware-accelerated video playback, in order to remove a synchronization roundtrip between the decode engine and the GPU, waiting on a Host1x syncpt from the GPU is necessary.
Fortunately, deko3d already has such a mechanism for display sync, so we can simply reuse that code.

include/deko3d.h Outdated
DkResult dkMemBlockFlushCpuCache(DkMemBlock obj, uint32_t offset, uint32_t size);

DkResult dkFenceWait(DkFence* obj, int64_t timeout_ns);
DkFence dkFenceImport(uint32_t id, uint32_t value);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor nitpick: I think this should be void dkFenceImport(DkFence* obj, uint32_t id, uint32_t value) instead. Plus, I'm wondering if it may be worth passing in a pointer to a libnx NvFence or NvMultiFence object instead of id/value directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm ok with your first suggestion.
As for the second point, the thing is that deko3d.h currently doesn't import the libnx header.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I applied your suggestion regarding the function signature

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That is true. In any case, I don't expect this to be a commonly used function, so I think for now it's ok to leave it with id/value pair.

@fincs fincs merged commit 8cb7b4c into devkitPro:master Jan 29, 2025
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