28,658 questions
Maybe you can test with D3DKMTQueryAdapterInfo
I did a test but I don't have this option on my OS (Windows 10 21H1, no real graphic card) =>
{
LPGUID Guid = (LPGUID)&GUID_DISPLAY_DEVICE_ARRIVAL;
HDEVINFO hDI = SetupDiGetClassDevs(Guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
if (INVALID_HANDLE_VALUE != hDI)
{
SP_DEVINFO_DATA DeviceInfoData;
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for (DWORD dwDeviceIndex = 0; SetupDiEnumDeviceInfo(hDI, dwDeviceIndex, &DeviceInfoData); dwDeviceIndex++)
{
SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
for (DWORD dwMemberIndex = 0; SetupDiEnumDeviceInterfaces(hDI, &DeviceInfoData, Guid, dwMemberIndex, &DeviceInterfaceData); dwMemberIndex++)
{
DWORD dwDeviceInterfaceDetailDataSize = offsetof(SP_DEVICE_INTERFACE_DETAIL_DATA, DevicePath) + MAX_PATH * sizeof(TCHAR);
PSP_DEVICE_INTERFACE_DETAIL_DATA pDeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA)new BYTE[dwDeviceInterfaceDetailDataSize];
pDeviceInterfaceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
if (SetupDiGetDeviceInterfaceDetail(hDI, &DeviceInterfaceData, pDeviceInterfaceDetailData, dwDeviceInterfaceDetailDataSize, NULL, NULL))
{
CONFIGRET cRet;
WCHAR wsText[MAX_PATH] = L"";
DEVINST hDevInst = DeviceInfoData.DevInst;
DEVINST hParentDevInst;
TCHAR wsDeviceID[MAX_DEVICE_ID_LEN];
cRet = CM_Get_Device_ID(hDevInst, wsDeviceID, sizeof(wsDeviceID) / sizeof(TCHAR), 0);
if (cRet == CR_SUCCESS)
{
wsprintf(wsText, L"DeviceID : %s\r\n", wsDeviceID);
OutputDebugString(wsText);
wsprintf(wsText, L"\tDevice Path : %s\r\n", pDeviceInterfaceDetailData->DevicePath);
OutputDebugString(wsText);
}
cRet = CM_Get_Parent(&hParentDevInst, hDevInst, 0);
if (cRet == CR_SUCCESS)
{
TCHAR wsParentDeviceID[MAX_DEVICE_ID_LEN];
cRet = CM_Get_Device_ID(hParentDevInst, wsParentDeviceID, sizeof(wsParentDeviceID) / sizeof(TCHAR), 0);
if (cRet == CR_SUCCESS)
{
wsprintf(wsText, L"\tParent DeviceID : %s\r\n", wsParentDeviceID);
OutputDebugString(wsText);
}
}
// #include <D3dkmthk.h>
D3DKMT_OPENADAPTERFROMDEVICENAME oafdn;
ZeroMemory(&oafdn, sizeof(oafdn));
oafdn.pDeviceName = pDeviceInterfaceDetailData->DevicePath;
NTSTATUS Status;
Status = D3DKMTOpenAdapterFromDeviceName(&oafdn);
if (Status == 0)
{
D3DKMT_QUERYADAPTERINFO qai;
D3DKMT_WDDM_2_7_CAPS caps;
//D3DKMT_WDDM_1_2_CAPS caps;
ZeroMemory(&qai, sizeof(qai));
ZeroMemory(&caps, sizeof(caps));
qai.hAdapter = oafdn.hAdapter;
qai.Type = KMTQAITYPE_WDDM_2_7_CAPS;
//qai.Type = KMTQAITYPE_WDDM_1_2_CAPS;
qai.pPrivateDriverData = (void*)∩︀
qai.PrivateDriverDataSize = sizeof(caps);
// Status = 0xc000000d STATUS_INVALID_PARAMETER
Status = D3DKMTQueryAdapterInfo(&qai);
if (Status == 0)
{
wsprintf(wsText, L"\tHardware-accelerated GPU scheduling Support : %d\r\n", caps.HwSchSupported);
OutputDebugString(wsText);
wsprintf(wsText, L"\tHardware-accelerated GPU scheduling Enabled : %d\r\n", caps.HwSchEnabled);
OutputDebugString(wsText);
}
D3DKMT_CLOSEADAPTER ca;
ca.hAdapter = oafdn.hAdapter;
D3DKMTCloseAdapter(&ca);
}
}
delete[] pDeviceInterfaceDetailData;
}
}
SetupDiDestroyDeviceInfoList(hDI);
}
}