@@ -45,12 +45,6 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
4545 {
4646 FF_DEBUG ("Processing device ID: %ls" , devId );
4747
48- if (wcsncmp (devId , L"SWD\\" , 4 ) == 0 )
49- {
50- FF_DEBUG ("Skipping SWD device interface to avoid duplicates" );
51- continue ;
52- }
53-
5448 DEVINST devInst = 0 ;
5549
5650 {
@@ -121,6 +115,25 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
121115
122116 wchar_t buffer [256 ];
123117 ULONG bufferLen = 0 ;
118+
119+ FF_DEBUG ("Get device description as device name" );
120+ bufferLen = sizeof (buffer );
121+ if (CM_Get_DevNode_Registry_PropertyW (devInst , CM_DRP_DEVICEDESC , NULL , buffer , & bufferLen , 0 ) == CR_SUCCESS )
122+ {
123+ ffStrbufSetWS (& gpu -> name , buffer );
124+ FF_DEBUG ("Found device description: %s" , gpu -> name .chars );
125+ }
126+ else
127+ {
128+ FF_DEBUG ("Failed to get device description" );
129+ }
130+
131+ if (wcsncmp (devId , L"SWD\\" , 4 ) == 0 || wcsncmp (devId , L"ROOT\\DISPLAY\\" , 13 ) == 0 )
132+ {
133+ FF_DEBUG ("Skipping virtual devices to avoid duplicates" );
134+ continue ;
135+ }
136+
124137 if (CM_Open_DevNode_Key (devInst , KEY_QUERY_VALUE , 0 , RegDisposition_OpenExisting , & hVideoIdKey , CM_REGISTRY_HARDWARE ) == CR_SUCCESS )
125138 {
126139 FF_DEBUG ("Opened device node registry key" );
@@ -145,8 +158,12 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
145158 }
146159 }
147160
148- if (ffRegReadStrbuf (hDirectxKey , L"Description" , & gpu -> name , NULL ))
149- FF_DEBUG ("Found GPU description: %s" , gpu -> name .chars );
161+ if (gpu -> name .length == 0 )
162+ {
163+ FF_DEBUG ("Trying to get GPU name from DirectX registry" );
164+ if (ffRegReadStrbuf (hDirectxKey , L"Description" , & gpu -> name , NULL ))
165+ FF_DEBUG ("Found GPU description: %s" , gpu -> name .chars );
166+ }
150167
151168 if (ffRegReadUint64 (hDirectxKey , L"DedicatedVideoMemory" , & gpu -> dedicated .total , NULL ))
152169 FF_DEBUG ("Found dedicated video memory: %llu bytes" , gpu -> dedicated .total );
@@ -309,21 +326,6 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
309326 FF_DEBUG ("No driver-specific detection function found for vendor: %s" , gpu -> vendor .chars );
310327 }
311328
312- if (!gpu -> name .length )
313- {
314- FF_DEBUG ("Trying to get device description as fallback" );
315- bufferLen = sizeof (buffer );
316- if (CM_Get_DevNode_Registry_PropertyW (devInst , CM_DRP_DEVICEDESC , NULL , buffer , & bufferLen , 0 ) == CR_SUCCESS )
317- {
318- ffStrbufSetWS (& gpu -> name , buffer );
319- FF_DEBUG ("Found device description: %s" , gpu -> name .chars );
320- }
321- else
322- {
323- FF_DEBUG ("Failed to get device description" );
324- }
325- }
326-
327329 if (gpu -> type == FF_GPU_TYPE_UNKNOWN && adapterLuid > 0 )
328330 {
329331 FF_DEBUG ("Trying to determine GPU type using D3DKMT APIs" );
0 commit comments