mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-06-07 15:24:27 +00:00
[idd] ipc: implement reporting of GPU software status
This commit is contained in:
committed by
Geoffrey McRae
parent
cb70643fa4
commit
803aea0d21
@@ -30,7 +30,8 @@ struct LGPipeMsg
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SETCURSORPOS,
|
SETCURSORPOS,
|
||||||
SETDISPLAYMODE
|
SETDISPLAYMODE,
|
||||||
|
GPUSTATUS
|
||||||
}
|
}
|
||||||
type;
|
type;
|
||||||
union
|
union
|
||||||
@@ -49,5 +50,11 @@ struct LGPipeMsg
|
|||||||
uint32_t refresh;
|
uint32_t refresh;
|
||||||
}
|
}
|
||||||
displayMode;
|
displayMode;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool software;
|
||||||
|
}
|
||||||
|
gpuStatus;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -30,6 +30,13 @@ HRESULT CD3D11Device::Init()
|
|||||||
hr = m_factory->EnumAdapterByLuid(m_adapterLuid, IID_PPV_ARGS(&m_adapter));
|
hr = m_factory->EnumAdapterByLuid(m_adapterLuid, IID_PPV_ARGS(&m_adapter));
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return 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
|
// only 11.1 supports DX12 interoperabillity
|
||||||
static const D3D_FEATURE_LEVEL featureLevels[] =
|
static const D3D_FEATURE_LEVEL featureLevels[] =
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ private:
|
|||||||
ComPtr<IDXGIAdapter1 > m_adapter;
|
ComPtr<IDXGIAdapter1 > m_adapter;
|
||||||
ComPtr<ID3D11Device5 > m_device;
|
ComPtr<ID3D11Device5 > m_device;
|
||||||
ComPtr<ID3D11DeviceContext4> m_context;
|
ComPtr<ID3D11DeviceContext4> m_context;
|
||||||
|
bool m_isSoftware;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CD3D11Device(LUID adapterLuid) :
|
CD3D11Device(LUID adapterLuid) :
|
||||||
@@ -51,4 +52,6 @@ public:
|
|||||||
ComPtr<ID3D11Device5> GetDevice() { return m_device; }
|
ComPtr<ID3D11Device5> GetDevice() { return m_device; }
|
||||||
|
|
||||||
ComPtr<ID3D11DeviceContext4> GetContext() { return m_context; }
|
ComPtr<ID3D11DeviceContext4> GetContext() { return m_context; }
|
||||||
|
|
||||||
|
bool IsSoftware() { return m_isSoftware; }
|
||||||
};
|
};
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "CIndirectMonitorContext.h"
|
#include "CIndirectMonitorContext.h"
|
||||||
#include "CPlatformInfo.h"
|
#include "CPlatformInfo.h"
|
||||||
#include "CDebug.h"
|
#include "CDebug.h"
|
||||||
|
#include "CPipeServer.h"
|
||||||
|
|
||||||
CIndirectMonitorContext::CIndirectMonitorContext(_In_ IDDCX_MONITOR monitor, CIndirectDeviceContext * device) :
|
CIndirectMonitorContext::CIndirectMonitorContext(_In_ IDDCX_MONITOR monitor, CIndirectDeviceContext * device) :
|
||||||
m_monitor(monitor),
|
m_monitor(monitor),
|
||||||
@@ -70,6 +71,7 @@ reInit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_swapChain.reset(new CSwapChainProcessor(m_monitor, m_devContext, swapChain, m_dx11Device, m_dx12Device, newFrameEvent));
|
m_swapChain.reset(new CSwapChainProcessor(m_monitor, m_devContext, swapChain, m_dx11Device, m_dx12Device, newFrameEvent));
|
||||||
|
g_pipe.SetGPUStatus(m_dx11Device->IsSoftware());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIndirectMonitorContext::UnassignSwapChain()
|
void CIndirectMonitorContext::UnassignSwapChain()
|
||||||
|
|||||||
@@ -174,4 +174,16 @@ void CPipeServer::SetDisplayMode(uint32_t width, uint32_t height, uint32_t refre
|
|||||||
msg.displayMode.height = height;
|
msg.displayMode.height = height;
|
||||||
msg.displayMode.refresh = refresh;
|
msg.displayMode.refresh = refresh;
|
||||||
WriteMsg(msg);
|
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);
|
||||||
}
|
}
|
||||||
@@ -55,6 +55,7 @@ class CPipeServer
|
|||||||
|
|
||||||
void SetCursorPos(uint32_t x, uint32_t y);
|
void SetCursorPos(uint32_t x, uint32_t y);
|
||||||
void SetDisplayMode(uint32_t width, uint32_t height, uint32_t refresh);
|
void SetDisplayMode(uint32_t width, uint32_t height, uint32_t refresh);
|
||||||
|
void SetGPUStatus(bool software);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CPipeServer g_pipe;
|
extern CPipeServer g_pipe;
|
||||||
@@ -264,6 +264,10 @@ void CPipeClient::Thread()
|
|||||||
HandleSetDisplayMode(msg);
|
HandleSetDisplayMode(msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LGPipeMsg::GPUSTATUS:
|
||||||
|
HandleGPUStatus(msg);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG_ERROR("Unknown message type %d", msg.type);
|
DEBUG_ERROR("Unknown message type %d", msg.type);
|
||||||
break;
|
break;
|
||||||
@@ -300,3 +304,8 @@ void CPipeClient::HandleSetDisplayMode(const LGPipeMsg& msg)
|
|||||||
if (result != DISP_CHANGE_SUCCESSFUL)
|
if (result != DISP_CHANGE_SUCCESSFUL)
|
||||||
DEBUG_ERROR("ChangeDisplaySettingsEx Failed (0x%08x)", result);
|
DEBUG_ERROR("ChangeDisplaySettingsEx Failed (0x%08x)", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPipeClient::HandleGPUStatus(const LGPipeMsg& msg)
|
||||||
|
{
|
||||||
|
// TODO: implement me
|
||||||
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ private:
|
|||||||
|
|
||||||
void HandleSetCursorPos(const LGPipeMsg& msg);
|
void HandleSetCursorPos(const LGPipeMsg& msg);
|
||||||
void HandleSetDisplayMode(const LGPipeMsg& msg);
|
void HandleSetDisplayMode(const LGPipeMsg& msg);
|
||||||
|
void HandleGPUStatus(const LGPipeMsg& msg);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~CPipeClient() { DeInit(); }
|
~CPipeClient() { DeInit(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user