0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

obs-qsv11: Fix QSV failing on multi-vendor multi-GPU systems

Adds index correction present in QSV test binary to Windows encoder
initialization as well. This is necessary when the adapter index of the
Intel GPU is not the same as the "implementation" index in MFX.
This commit is contained in:
derrod 2024-05-27 18:50:36 +02:00 committed by Ryan Foster
parent fc1ab5fcbc
commit 7a870fd923

View File

@ -33,26 +33,31 @@ mfxStatus Initialize(mfxVersion ver, mfxSession *pSession,
obs_video_info ovi;
obs_get_video_info(&ovi);
mfxU32 adapter_idx = ovi.adapter;
mfxU32 idx_adjustment = 0;
// Select current adapter - will be iGPU if exists due to adapter reordering
if (codec == QSV_CODEC_AV1 && !adapters[adapter_idx].supports_av1) {
for (mfxU32 i = 0; i < 4; i++) {
for (mfxU32 i = 0; i < MAX_ADAPTERS; i++) {
if (!adapters[i].is_intel) {
idx_adjustment++;
continue;
}
if (adapters[i].supports_av1) {
adapter_idx = i;
break;
}
}
} else if (!adapters[adapter_idx].is_intel) {
for (mfxU32 i = 0; i < 4; i++) {
for (mfxU32 i = 0; i < MAX_ADAPTERS; i++) {
if (adapters[i].is_intel) {
adapter_idx = i;
break;
}
idx_adjustment++;
}
}
adapter_index = adapter_idx;
adapter_idx -= idx_adjustment;
mfxStatus sts = MFX_ERR_NONE;
mfxVariant impl;