Browse Source

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.
derrod 1 year ago
parent
commit
7a870fd923
1 changed files with 9 additions and 4 deletions
  1. 9 4
      plugins/obs-qsv11/common_utils_windows.cpp

+ 9 - 4
plugins/obs-qsv11/common_utils_windows.cpp

@@ -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;