Skip to content

Commit 9d70074

Browse files
committed
Add support for multiple GPUs on Windows
If the primary GPU is not an Intel GPU, libvpl cannot detect the Intel GPU in the Windows environment, even though it is present. The situation is, for example, using an NVIDIA graphics card with an Intel CPU that has an embedded GPU. This patch allows the Intel GPU to be detected in such situations. Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
1 parent 778a66d commit 9d70074

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

libvpl/src/windows/mfx_library_iterator.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,12 @@ mfxStatus MFXLibraryIterator::GetRegkeyDir(std::wstring &regDir, size_t length,
619619
mfxStatus sts = MFX_ERR_UNSUPPORTED;
620620
MFX::MFXLibraryIterator libIterator;
621621
wchar_t wRegDir[MFX_MAX_DLL_PATH];
622+
int adapterNum = 0;
622623

623-
regDir.clear();
624-
sts = libIterator.Init(MFX_LIB_HARDWARE, MFX_IMPL_VIA_D3D11, 0, storageID);
624+
do {
625+
sts = libIterator.Init(MFX_LIB_HARDWARE, MFX_IMPL_VIA_D3D11, adapterNum, storageID);
626+
adapterNum++;
627+
} while (sts == MFX_ERR_NONE && !libIterator.isIntelAdapter());
625628
if (sts)
626629
return MFX_ERR_UNSUPPORTED;
627630

libvpl/src/windows/mfx_library_iterator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ class MFXLibraryIterator {
9999
mfxU32 deviceID,
100100
int storageID);
101101
static mfxStatus GetRegkeyDir(std::wstring &regDir, size_t length, int storageID);
102+
bool isIntelAdapter() const {
103+
return m_vendorID == INTEL_VENDOR_ID;
104+
}
102105

103106
protected:
104107
// Release the iterator

0 commit comments

Comments
 (0)