[idd] driver: add additional logging to CIVSHMEM
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

This commit is contained in:
Geoffrey McRae 2025-03-31 00:25:54 +11:00
parent a4406ac867
commit 656d01a694

View File

@ -72,10 +72,12 @@ bool CIVSHMEM::Init()
m_devices.push_back(data); m_devices.push_back(data);
} }
if (GetLastError() != ERROR_NO_MORE_ITEMS) HRESULT hr = GetLastError();
if (hr != ERROR_NO_MORE_ITEMS)
{ {
m_devices.clear(); m_devices.clear();
SetupDiDestroyDeviceInfoList(devInfoSet); SetupDiDestroyDeviceInfoList(devInfoSet);
DEBUG_ERROR_HR(hr, "Enumeration Failed");
return false; return false;
} }
@ -111,12 +113,14 @@ bool CIVSHMEM::Init()
if (!device) if (!device)
{ {
DEBUG_ERROR("Failed to match a shmDevice");
SetupDiDestroyDeviceInfoList(devInfoSet); SetupDiDestroyDeviceInfoList(devInfoSet);
return false; return false;
} }
if (SetupDiEnumDeviceInterfaces(devInfoSet, &devInfoData, &GUID_DEVINTERFACE_IVSHMEM, 0, &devInterfaceData) == FALSE) if (SetupDiEnumDeviceInterfaces(devInfoSet, &devInfoData, &GUID_DEVINTERFACE_IVSHMEM, 0, &devInterfaceData) == FALSE)
{ {
DEBUG_ERROR_HR(GetLastError(), "SetupDiEnumDeviceInterfaces");
SetupDiDestroyDeviceInfoList(devInfoSet); SetupDiDestroyDeviceInfoList(devInfoSet);
return false; return false;
} }
@ -125,6 +129,7 @@ bool CIVSHMEM::Init()
SetupDiGetDeviceInterfaceDetail(devInfoSet, &devInterfaceData, nullptr, 0, &reqSize, nullptr); SetupDiGetDeviceInterfaceDetail(devInfoSet, &devInterfaceData, nullptr, 0, &reqSize, nullptr);
if (!reqSize) if (!reqSize)
{ {
DEBUG_ERROR_HR(GetLastError(), "SetupDiGetDeviceInterfaceDetail");
SetupDiDestroyDeviceInfoList(devInfoSet); SetupDiDestroyDeviceInfoList(devInfoSet);
return false; return false;
} }
@ -133,6 +138,7 @@ bool CIVSHMEM::Init()
infData->cbSize = sizeof(PSP_DEVICE_INTERFACE_DETAIL_DATA); infData->cbSize = sizeof(PSP_DEVICE_INTERFACE_DETAIL_DATA);
if (!SetupDiGetDeviceInterfaceDetail(devInfoSet, &devInterfaceData, infData, reqSize, nullptr, nullptr)) if (!SetupDiGetDeviceInterfaceDetail(devInfoSet, &devInterfaceData, infData, reqSize, nullptr, nullptr))
{ {
DEBUG_ERROR_HR(GetLastError(), "SetupDiGetDeviceInterfaceDetail");
SetupDiDestroyDeviceInfoList(devInfoSet); SetupDiDestroyDeviceInfoList(devInfoSet);
return false; return false;
} }
@ -140,11 +146,13 @@ bool CIVSHMEM::Init()
m_handle = CreateFile(infData->DevicePath, 0, 0, nullptr, OPEN_EXISTING, 0, 0); m_handle = CreateFile(infData->DevicePath, 0, 0, nullptr, OPEN_EXISTING, 0, 0);
if (m_handle == INVALID_HANDLE_VALUE) if (m_handle == INVALID_HANDLE_VALUE)
{ {
DEBUG_ERROR_HR(GetLastError(), "CreateFile");
SetupDiDestroyDeviceInfoList(devInfoSet); SetupDiDestroyDeviceInfoList(devInfoSet);
return false; return false;
} }
SetupDiDestroyDeviceInfoList(devInfoSet); SetupDiDestroyDeviceInfoList(devInfoSet);
DEBUG_TRACE("IVSHMEM Initialized");
return true; return true;
} }
@ -153,7 +161,7 @@ bool CIVSHMEM::Open()
IVSHMEM_SIZE size; IVSHMEM_SIZE size;
if (!DeviceIoControl(m_handle, IOCTL_IVSHMEM_REQUEST_SIZE, nullptr, 0, &size, sizeof(size), nullptr, nullptr)) if (!DeviceIoControl(m_handle, IOCTL_IVSHMEM_REQUEST_SIZE, nullptr, 0, &size, sizeof(size), nullptr, nullptr))
{ {
DEBUG_ERROR("Failed to request ivshmem size"); DEBUG_ERROR_HR(GetLastError(), "Failed to request ivshmem size");
return false; return false;
} }
@ -163,7 +171,7 @@ bool CIVSHMEM::Open()
config.cacheMode = IVSHMEM_CACHE_WRITECOMBINED; config.cacheMode = IVSHMEM_CACHE_WRITECOMBINED;
if (!DeviceIoControl(m_handle, IOCTL_IVSHMEM_REQUEST_MMAP, &config, sizeof(config), &map, sizeof(map), nullptr, nullptr)) if (!DeviceIoControl(m_handle, IOCTL_IVSHMEM_REQUEST_MMAP, &config, sizeof(config), &map, sizeof(map), nullptr, nullptr))
{ {
DEBUG_ERROR("Failed to request ivshmem mmap"); DEBUG_ERROR_HR(GetLastError(), "Failed to request ivshmem mmap");
return false; return false;
} }