Skip to content

Commit

Permalink
GPU (Windows): add some debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Aug 13, 2024
1 parent 96c838d commit 57e3492
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/detection/gpu/gpu_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,25 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
unsigned vendorId = 0, deviceId = 0, subSystemId = 0, revId = 0;
swscanf(buffer, L"PCI\\VEN_%x&DEV_%x&SUBSYS_%x&REV_%x", &vendorId, &deviceId, &subSystemId, &revId);
ffStrbufSetStatic(&gpu->vendor, ffGetGPUVendorString(vendorId));
_putws(buffer);

FF_HKEY_AUTO_DESTROY hVideoIdKey = SetupDiOpenDevRegKey(hdev, &did, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_QUERY_VALUE);
if (!hVideoIdKey) continue;
DWORD videoIdLength = sizeof(buffer);
if (RegGetValueW(hVideoIdKey, NULL, L"VideoID", RRF_RT_REG_SZ, NULL, buffer, &videoIdLength) != ERROR_SUCCESS)
continue;
_putws(buffer);

if (videoIdLength != (FF_GUID_STRLEN + 1) * sizeof(wchar_t))
continue; // Should not happen

wmemcpy(regControlVideoKey + regControlVideoKeyPrefixLength, buffer, FF_GUID_STRLEN);
_putws(regControlVideoKey);
FF_HKEY_AUTO_DESTROY hRegControlVideoKey = NULL;
if (!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, regControlVideoKey, &hRegControlVideoKey, NULL)) continue;

wmemcpy(regDirectxKey + regDirectxKeyPrefixLength, buffer, FF_GUID_STRLEN);
_putws(regDirectxKey);
FF_HKEY_AUTO_DESTROY hDirectxKey = NULL;
if (ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, regDirectxKey, &hDirectxKey, NULL))
{
Expand Down

0 comments on commit 57e3492

Please sign in to comment.