From 803aea0d21a329659ea83f5f3767d5b36bfb42f9 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 3 Jun 2026 17:48:32 +1000 Subject: [PATCH] [idd] ipc: implement reporting of GPU software status --- idd/LGCommon/PipeMsg.h | 9 ++++++++- idd/LGIdd/CD3D11Device.cpp | 7 +++++++ idd/LGIdd/CD3D11Device.h | 3 +++ idd/LGIdd/CIndirectMonitorContext.cpp | 2 ++ idd/LGIdd/CPipeServer.cpp | 12 ++++++++++++ idd/LGIdd/CPipeServer.h | 1 + idd/LGIddHelper/CPipeClient.cpp | 9 +++++++++ idd/LGIddHelper/CPipeClient.h | 1 + 8 files changed, 43 insertions(+), 1 deletion(-) diff --git a/idd/LGCommon/PipeMsg.h b/idd/LGCommon/PipeMsg.h index cf74d6fe..99595c40 100644 --- a/idd/LGCommon/PipeMsg.h +++ b/idd/LGCommon/PipeMsg.h @@ -30,7 +30,8 @@ struct LGPipeMsg enum { SETCURSORPOS, - SETDISPLAYMODE + SETDISPLAYMODE, + GPUSTATUS } type; union @@ -49,5 +50,11 @@ struct LGPipeMsg uint32_t refresh; } displayMode; + + struct + { + bool software; + } + gpuStatus; }; }; \ No newline at end of file diff --git a/idd/LGIdd/CD3D11Device.cpp b/idd/LGIdd/CD3D11Device.cpp index 33fb26aa..a179845f 100644 --- a/idd/LGIdd/CD3D11Device.cpp +++ b/idd/LGIdd/CD3D11Device.cpp @@ -30,6 +30,13 @@ HRESULT CD3D11Device::Init() hr = m_factory->EnumAdapterByLuid(m_adapterLuid, IID_PPV_ARGS(&m_adapter)); if (FAILED(hr)) return hr; + + DXGI_ADAPTER_DESC1 desc = {}; + hr = m_adapter->GetDesc1(&desc); + if (FAILED(hr)) + return hr; + + m_isSoftware = (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) != 0; // only 11.1 supports DX12 interoperabillity static const D3D_FEATURE_LEVEL featureLevels[] = diff --git a/idd/LGIdd/CD3D11Device.h b/idd/LGIdd/CD3D11Device.h index 7a275c6c..e8020f4f 100644 --- a/idd/LGIdd/CD3D11Device.h +++ b/idd/LGIdd/CD3D11Device.h @@ -36,6 +36,7 @@ private: ComPtr m_adapter; ComPtr m_device; ComPtr m_context; + bool m_isSoftware; public: CD3D11Device(LUID adapterLuid) : @@ -51,4 +52,6 @@ public: ComPtr GetDevice() { return m_device; } ComPtr GetContext() { return m_context; } + + bool IsSoftware() { return m_isSoftware; } }; \ No newline at end of file diff --git a/idd/LGIdd/CIndirectMonitorContext.cpp b/idd/LGIdd/CIndirectMonitorContext.cpp index 864e828c..785f7bec 100644 --- a/idd/LGIdd/CIndirectMonitorContext.cpp +++ b/idd/LGIdd/CIndirectMonitorContext.cpp @@ -21,6 +21,7 @@ #include "CIndirectMonitorContext.h" #include "CPlatformInfo.h" #include "CDebug.h" +#include "CPipeServer.h" CIndirectMonitorContext::CIndirectMonitorContext(_In_ IDDCX_MONITOR monitor, CIndirectDeviceContext * device) : m_monitor(monitor), @@ -70,6 +71,7 @@ reInit: } m_swapChain.reset(new CSwapChainProcessor(m_monitor, m_devContext, swapChain, m_dx11Device, m_dx12Device, newFrameEvent)); + g_pipe.SetGPUStatus(m_dx11Device->IsSoftware()); } void CIndirectMonitorContext::UnassignSwapChain() diff --git a/idd/LGIdd/CPipeServer.cpp b/idd/LGIdd/CPipeServer.cpp index e71ad500..99e1e921 100644 --- a/idd/LGIdd/CPipeServer.cpp +++ b/idd/LGIdd/CPipeServer.cpp @@ -174,4 +174,16 @@ void CPipeServer::SetDisplayMode(uint32_t width, uint32_t height, uint32_t refre msg.displayMode.height = height; msg.displayMode.refresh = refresh; WriteMsg(msg); +} + +void CPipeServer::SetGPUStatus(bool software) +{ + if (!m_connected) + return; + + LGPipeMsg msg; + msg.size = sizeof(msg); + msg.type = LGPipeMsg::GPUSTATUS; + msg.gpuStatus.software = software; + WriteMsg(msg); } \ No newline at end of file diff --git a/idd/LGIdd/CPipeServer.h b/idd/LGIdd/CPipeServer.h index f2fe5a63..5a8d320a 100644 --- a/idd/LGIdd/CPipeServer.h +++ b/idd/LGIdd/CPipeServer.h @@ -55,6 +55,7 @@ class CPipeServer void SetCursorPos(uint32_t x, uint32_t y); void SetDisplayMode(uint32_t width, uint32_t height, uint32_t refresh); + void SetGPUStatus(bool software); }; extern CPipeServer g_pipe; \ No newline at end of file diff --git a/idd/LGIddHelper/CPipeClient.cpp b/idd/LGIddHelper/CPipeClient.cpp index 2108f029..4a2aa8c6 100644 --- a/idd/LGIddHelper/CPipeClient.cpp +++ b/idd/LGIddHelper/CPipeClient.cpp @@ -264,6 +264,10 @@ void CPipeClient::Thread() HandleSetDisplayMode(msg); break; + case LGPipeMsg::GPUSTATUS: + HandleGPUStatus(msg); + break; + default: DEBUG_ERROR("Unknown message type %d", msg.type); break; @@ -300,3 +304,8 @@ void CPipeClient::HandleSetDisplayMode(const LGPipeMsg& msg) if (result != DISP_CHANGE_SUCCESSFUL) DEBUG_ERROR("ChangeDisplaySettingsEx Failed (0x%08x)", result); } + +void CPipeClient::HandleGPUStatus(const LGPipeMsg& msg) +{ + // TODO: implement me +} diff --git a/idd/LGIddHelper/CPipeClient.h b/idd/LGIddHelper/CPipeClient.h index 33f72872..c6e53552 100644 --- a/idd/LGIddHelper/CPipeClient.h +++ b/idd/LGIddHelper/CPipeClient.h @@ -49,6 +49,7 @@ private: void HandleSetCursorPos(const LGPipeMsg& msg); void HandleSetDisplayMode(const LGPipeMsg& msg); + void HandleGPUStatus(const LGPipeMsg& msg); public: ~CPipeClient() { DeInit(); }