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 năm trước cách đây
mục cha
commit
7a870fd923
1 tập tin đã thay đổi với 9 bổ sung4 xóa
  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;