Zhiyi Zhang (@zhiyi) commented about dlls/win32u/sysparams.c:
- struct adapter *adapter;
- ULONG idx = 0, count;
- TRACE( "(%p)\n", desc );
- if (!desc) return STATUS_INVALID_PARAMETER;
- if (!desc->pAdapters)
- {
desc->NumAdapters = max_adapters;
return STATUS_SUCCESS;
- }
- if (!lock_display_devices()) return STATUS_UNSUCCESSFUL;
- if ((count = list_count( &adapters )) > max_adapters)
This is wrong. adapters in sysparams.c are GDI adapters, they are not the same adapter in D3DKMT terms. Adapters in D3DKMT terms mean GPUs. So you need to add a list of GPUs to the cache and then do enumeration from that. You should do the initialization from the SetupAPI registry data. For example, basically with the following code. However, since you're in win32u. You can't use SetupAPI directly and you need to convert these to NT registry calls instead. See prepare_devices() for some example code for how to do it.
``` devinfo = SetupDiCreateDeviceInfoList( &GUID_DEVCLASS_DISPLAY, DIGCF_PRESENT ); for (i = 0; SetupDiEnumDeviceInfo( set, i, &device ); ++i) { if (SetupDiGetDevicePropertyW( device, &device_data, &DEVPROPKEY_GPU_LUID, &type, (BYTE *)&luid_desc.AdapterLuid, sizeof( luid_desc.AdapterLuid ), NULL, 0)) add_to_gpu_list; }
```
Then `NumOfSources` is the number of GDI adapters with the same GPU LUID. As for bPrecisePresentRegionsPreferred, I guess you can just return TRUE.
The GPU list construction can be done in update_display_cache_from_registry().