Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Fix multi GPU automatic selection for hybrid GPU and IDDSampleDriver

Open Nonary opened this issue 1 year ago • 14 comments

Description

Enhances the ddprobe utility to test to see if frames can be captured and that they are also not empty frames. If one of the 10 frames captured is not empty, it will return back successful. Previously it was only testing to see if it can be duplicated, but would fail on capturing frames which would cause Sunshine to pick the wrong GPU.

Screenshot

N/A

Issues Fixed or Closed

  • Fixes #2203
  • Fixes #2076
  • Fixes #2875
  • Fixes #2078
  • Fixes #1632

Type of Change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Dependency update (updates to dependencies)
  • [ ] Documentation update (changes to documentation)
  • [ ] Repository update (changes to repository files, e.g. .github/...)

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Nonary avatar Aug 10 '24 19:08 Nonary

Codecov Report

Attention: Patch coverage is 46.15385% with 7 lines in your changes missing coverage. Please review.

Project coverage is 9.87%. Comparing base (5bc32cd) to head (ec488ca). Report is 95 commits behind head on master.

Files with missing lines Patch % Lines
src/platform/windows/display_base.cpp 46.15% 2 Missing and 5 partials :warning:
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #3002      +/-   ##
=========================================
- Coverage    9.88%   9.87%   -0.01%     
=========================================
  Files         101     101              
  Lines       17975   17980       +5     
  Branches     8402    8408       +6     
=========================================
- Hits         1776    1775       -1     
+ Misses      13321   13318       -3     
- Partials     2878    2887       +9     
Flag Coverage Δ
Linux 7.27% <ø> (-0.07%) :arrow_down:
Windows 5.10% <46.15%> (+0.02%) :arrow_up:
macOS-12 10.79% <ø> (-0.02%) :arrow_down:
macOS-13 10.74% <ø> (+0.02%) :arrow_up:
macOS-14 10.03% <ø> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/windows/display_base.cpp 13.60% <46.15%> (+0.67%) :arrow_up:

... and 7 files with indirect coverage changes

codecov[bot] avatar Aug 10 '24 19:08 codecov[bot]

I have no idea about whether the code logic is correct or not, but I've added a few remarks about other stuff.

FrogTheFrog avatar Aug 11 '24 08:08 FrogTheFrog

I'm having troubles recompiling sunshine on master branch ever since the game capture commit was added

And yeah I did swap the docs to master and followed the steps, but it just refuses to compile.

So I'm planning to push these changes again soon just need to clone an earlier build of sunshine before that was added so that way the old build instructions for me work and I can test locally again

Nonary avatar Aug 11 '24 18:08 Nonary

Probably one these are the reasons...

  1. Need to use ucrt64 instead of mingw64
  2. Need to downgrade curl, see https://github.com/LizardByte/Sunshine/blob/f9c885a414f92d8277337e2fd1283110a0e376bb/.github/workflows/CI.yml#L1008-L1030

ReenigneArcher avatar Aug 11 '24 19:08 ReenigneArcher

Probably one these are the reasons...

  1. Need to use ucrt64 instead of mingw64
  2. Need to downgrade curl, see https://github.com/LizardByte/Sunshine/blob/f9c885a414f92d8277337e2fd1283110a0e376bb/.github/workflows/CI.yml#L1008-L1030

That was the first place I looked when I suspected documentation was wrong, made no difference.

BI::Windows::UI::Core::Point'
 1605 |                     struct Point AdjustedPoint;
C:/msys64/ucrt64/include/windows.ui.core.h:1605: note: forward declaration of 'struct ABI::Windows::UI::Core::Point'
C:/msys64/ucrt64/include/windows.ui.core.h:2762: error: use of enum 'VirtualKey' without previous declaration
 2762 |                         enum VirtualKey key,
C:/msys64/ucrt64/include/windows.ui.core.h:2766: error: use of enum 'VirtualKey' without previous declaration
 2766 |                         enum VirtualKey key,
C:/msys64/ucrt64/include/windows.ui.core.h:4608: error: use of enum 'VirtualKey' without previous declaration
 4608 |                         enum VirtualKey *value) = 0;
C:/msys64/ucrt64/include/windows.ui.core.h:4879: error: use of enum 'VirtualKeyModifiers' without previous declaration
 4879 |                         enum VirtualKeyModifiers *value) = 0;
In file included from C:/msys64/ucrt64/include/windows.graphics.capture.interop.h:42:
C:/msys64/ucrt64/include/windows.graphics.capture.h:905: error: use of enum 'DirectXPixelFormat' without previous declaration
  905 |                         enum DirectXPixelFormat pixel_format,
C:/msys64/ucrt64/include/windows.graphics.capture.h:1103: error: use of enum 'DirectXPixelFormat' without previous declaration 1103 |                         enum DirectXPixelFormat pixel_format,
C:/msys64/ucrt64/include/windows.graphics.capture.h:1239: error: use of enum 'DirectXPixelFormat' without previous declaration 1239 |                         enum DirectXPixelFormat pixel_format,
[30/72] Building CXX object tests/CMakeFiles/test_sunshine.dir/__/src/nvhttp.cpp.obj
ninja: build stopped: subcommand failed.

Nonary avatar Aug 11 '24 20:08 Nonary

Works for me in Win 11 (not beta channel)... and ucrt64 with ninja. Tough to diagnose without seeing more logs like cmake logs (after clearing cache and re-running) and everything.

Haven't been any recent changes to mingw-w64-cppwinrt, https://github.com/msys2/MINGW-packages/commits/0517c5b3b68994453d599fe1c3b4fdfc24907334/mingw-w64-cppwinrt/PKGBUILD

Also, note you need to run all of those commands in order... not just downgrade curl.

Lastly, be sure to update submodules.

p.s. I'm closing the previously closed issues, which were either closed because the users found workarounds, or went stale. No need to re-open them, you can still link your PR to closed issued.

ReenigneArcher avatar Aug 11 '24 21:08 ReenigneArcher

Works for me in Win 11 (not beta channel)... and ucrt64 with ninja. Tough to diagnose without seeing more logs like cmake logs (after clearing cache and re-running) and everything.

Haven't been any recent changes to mingw-w64-cppwinrt, https://github.com/msys2/MINGW-packages/commits/0517c5b3b68994453d599fe1c3b4fdfc24907334/mingw-w64-cppwinrt/PKGBUILD

Also, note you need to run all of those commands in order... not just downgrade curl.

Lastly, be sure to update submodules.

p.s. I'm closing the previously closed issues, which were either closed because the users found workarounds, or went stale. No need to re-open them, you can still link your PR to closed issued.

As long as the fix bot attaches a comment stating it has been fixed, that's all I was really going for on that one. To make sure people where notified that had commented on those issues

I've been beating my head around this for like an hour and a half now, so just going to clone out an old base of sunshine, then cherry pick the commits on top of that so it builds for me to test it.

Nonary avatar Aug 11 '24 22:08 Nonary

As long as the fix bot attaches a comment stating it has been fixed, that's all I was really going for on that one.

Oh, okay... That was a manual process before... after merging we had to go and apply the "fixed" label. We're no longer doing that since we got rid of the nightly branch.

ReenigneArcher avatar Aug 11 '24 22:08 ReenigneArcher

Replicating the build issues in CI now: https://github.com/LizardByte/Sunshine/actions/runs/10342476366/job/28625553004?pr=3003#step:9:169

ReenigneArcher avatar Aug 11 '24 22:08 ReenigneArcher

I think it's mingw's wrong.. mingw-w64-ucrt-x86_64-headers-git-12.0.0.r81.g90abf784a-1-any succeeded mingw-w64-ucrt-x86_64-headers-git-12.0.0.r215.g8704184f6-1-any failed

These incorrect header files come from this package https://packages.msys2.org/package/mingw-w64-ucrt-x86_64-headers-git?repo=ucrt64

It seems that there is an issue with g8704184f6-1. Try g8704184f6-2 https://github.com/msys2/MINGW-packages/commit/4092caa8b74efedcdc3122c66b46a2228dc3b70a

paulzzh avatar Aug 13 '24 06:08 paulzzh

@paulzzh thanks, I have submitted an issue here: https://github.com/msys2/MINGW-packages/issues/21645

ReenigneArcher avatar Aug 13 '24 17:08 ReenigneArcher

I pretty much guessed it was mingW issue when the header files was in the mingW directories, but their GitHub structure is so convoluted I couldn't figure out how to submit the proper issue...

Nonary avatar Aug 13 '24 17:08 Nonary

but their GitHub structure is so convoluted I couldn't figure out how to submit the proper issue...

Just FYI, every package page has a "Report Issue" button. For example, https://packages.msys2.org/package/mingw-w64-ucrt-x86_64-headers-git?repo=ucrt64

Biswa96 avatar Aug 14 '24 13:08 Biswa96

Any progress on this fix? Using two RTX quad 6000s now yet still no dice.

Apprisco avatar Sep 12 '24 08:09 Apprisco

Any progress on this fix? Using two RTX quad 6000s now yet still no dice.

Its already fixed, but not in any sunshine release because this PR has not been merged in.

If you installed a fixed version and still have issues, then it's likely you have a separate issue (such as hybrid GPU laptops), which often require you to restart Sunshine in order for the GPU selection to work again.

Nonary avatar Sep 12 '24 21:09 Nonary

@Nonary can you fix the compilation errors?

cgutman avatar Sep 13 '24 13:09 cgutman

@Nonary can you fix the compilation errors?

done

Nonary avatar Sep 14 '24 16:09 Nonary

Also, we now use semantic PRs. Could you make the PR title follow the conventional commit guidelines? https://www.conventionalcommits.org/en/v1.0.0/

ReenigneArcher avatar Sep 14 '24 17:09 ReenigneArcher