mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-06-04 22:04: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
|
||||
{
|
||||
SETCURSORPOS,
|
||||
SETDISPLAYMODE
|
||||
SETDISPLAYMODE,
|
||||
GPUSTATUS
|
||||
}
|
||||
type;
|
||||
union
|
||||
@@ -49,5 +50,11 @@ struct LGPipeMsg
|
||||
uint32_t refresh;
|
||||
}
|
||||
displayMode;
|
||||
|
||||
struct
|
||||
{
|
||||
bool software;
|
||||
}
|
||||
gpuStatus;
|
||||
};
|
||||
};
|
||||
@@ -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[] =
|
||||
|
||||
@@ -36,6 +36,7 @@ private:
|
||||
ComPtr<IDXGIAdapter1 > m_adapter;
|
||||
ComPtr<ID3D11Device5 > m_device;
|
||||
ComPtr<ID3D11DeviceContext4> m_context;
|
||||
bool m_isSoftware;
|
||||
|
||||
public:
|
||||
CD3D11Device(LUID adapterLuid) :
|
||||
@@ -51,4 +52,6 @@ public:
|
||||
ComPtr<ID3D11Device5> GetDevice() { return m_device; }
|
||||
|
||||
ComPtr<ID3D11DeviceContext4> GetContext() { return m_context; }
|
||||
|
||||
bool IsSoftware() { return m_isSoftware; }
|
||||
};
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ private:
|
||||
|
||||
void HandleSetCursorPos(const LGPipeMsg& msg);
|
||||
void HandleSetDisplayMode(const LGPipeMsg& msg);
|
||||
void HandleGPUStatus(const LGPipeMsg& msg);
|
||||
|
||||
public:
|
||||
~CPipeClient() { DeInit(); }
|
||||
|
||||
Reference in New Issue
Block a user