Skip to content

Windows: Add a DDA grabber for much better performance #1745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 30, 2024

Conversation

davidsansome
Copy link
Contributor

@davidsansome davidsansome commented May 25, 2024

Summary

The DDA (Desktop Duplication API) was added in DX11 and allows for GPU-assisted screen capture on Windows. This PR adds a new DDA grabber that uses this API.

Video comparing the old DX grabber with the new DDA grabber

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of web configuration, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated (docs/docs/en)
  • Related tests have been updated

PLEASE DON'T FORGET TO ADD YOUR CHANGES TO CHANGELOG.MD

  • Yes, CHANGELOG.md is also updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:
Fixes #1329
Fixes #1391
Fixes #1547

@Lord-Grey
Copy link
Collaborator

Lord-Grey commented May 25, 2024

@davidsansome Thank you very much for your contribution.
The grabber performance much improved!

Could you please have a look at the Picture decimation and the Cropping values?
It looks like that any change in the values do not have any effect currently.
See in the screenshot below that regardless what it is given the whole screen in full resolution is shown.

image

Maybe here the GPU can help too, if it is already possible to receive a cropped image in a target size....

@davidsansome
Copy link
Contributor Author

Thanks for taking a look @Lord-Grey!

I've implemented cropping and pixel decimation. I decided to do it in software because it was much easier than trying to do it with the directx API, and performance is fine as is anyway.

I was taking a look through the bug tracker and I think this PR will probably fix #1547 (NVFBC is deprecated and DDA is the replacement), #1329 (the HyperionScreenCapture project referenced as a fix there actually uses DDA) and #1391.

These can happen when changing resolution, or resuming from sleep.
@Lord-Grey
Copy link
Collaborator

@davidsansome Thanks for doing the changes. They look good for me.
A performant Windows Screengrabber was outstanding since a while, as you have seen with the issues you linked too.
Great that you addressed the issues, providing a new grabber.

@Lord-Grey
Copy link
Collaborator

@davidsansome Is the PR ready to be merged from your side or do you plan additional testing or changes?

@davidsansome
Copy link
Contributor Author

Yes I think this is ready to be merged now! I've been running it locally for a few days without issues.

I have a few more ideas for performance improvements but I'll need to do some more investigation first. I might send some separate PRs in the next few weeks!

@Lord-Grey
Copy link
Collaborator

Yes. Screengrabber performance is a topic.
For videograbbers multi-threading was introduced, but the overall grabber code is lacking an overall, consistent design.

@Paulchen-Panther had a start some time back on refactoring grabbers. But due to time constraints and other priorities that was never brought forward.
Maybe it is something you would like to have a look too as food for thought.

Potentially, you had something different in mind…
I am curious what the upcoming PRs will bring. 😀

@Lord-Grey Lord-Grey merged commit 8c303c8 into hyperion-project:master May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

NVIDIA NVFBC Grabber Lagg during gameplay Stuttering with DX or QT screen capture under Windows
3 participants