[idd] ipc/helper: notify the helper if a software renderer is in use

This commit is contained in:
Geoffrey McRae
2026-06-03 22:25:07 +10:00
parent b3701992c1
commit b77b36aff0
12 changed files with 63 additions and 161 deletions

View File

@@ -71,7 +71,6 @@ 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()

View File

@@ -114,6 +114,11 @@ void CPipeServer::Thread()
DEBUG_TRACE("Client connected");
m_connected = true;
for (const auto& msg : m_queue)
WriteMsg(msg);
m_queue.clear();
while (m_running && m_connected)
{
//TODO: Read messages from the client
@@ -129,8 +134,14 @@ void CPipeServer::Thread()
DEBUG_TRACE("Pipe thread shutdown");
}
void CPipeServer::WriteMsg(LGPipeMsg & msg)
void CPipeServer::WriteMsg(const LGPipeMsg & msg)
{
if (!m_connected)
{
m_queue.push_back(msg);
return;
}
DWORD written;
if (!WriteFile(m_pipe.Get(), &msg, sizeof(msg), &written, NULL))
{
@@ -151,6 +162,7 @@ void CPipeServer::WriteMsg(LGPipeMsg & msg)
void CPipeServer::SetCursorPos(uint32_t x, uint32_t y)
{
// do not send cursor messages if we are not connected or they will end up queued
if (!m_connected)
return;
@@ -164,9 +176,6 @@ void CPipeServer::SetCursorPos(uint32_t x, uint32_t y)
void CPipeServer::SetDisplayMode(uint32_t width, uint32_t height, uint32_t refresh)
{
if (!m_connected)
return;
LGPipeMsg msg;
msg.size = sizeof(msg);
msg.type = LGPipeMsg::SETDISPLAYMODE;
@@ -178,9 +187,6 @@ void CPipeServer::SetDisplayMode(uint32_t width, uint32_t height, uint32_t refre
void CPipeServer::SetGPUStatus(bool software)
{
if (!m_connected)
return;
LGPipeMsg msg;
msg.size = sizeof(msg);
msg.type = LGPipeMsg::GPUSTATUS;

View File

@@ -24,6 +24,7 @@
#include <wdf.h>
#include <stdint.h>
#include <wrl.h>
#include <vector>
#include "PipeMsg.h"
@@ -36,6 +37,7 @@ class CPipeServer
private:
HandleT<HANDLENullTraits> m_pipe;
HandleT<HANDLENullTraits> m_thread;
std::vector<LGPipeMsg> m_queue;
bool m_running = false;
bool m_connected = false;
@@ -45,7 +47,7 @@ class CPipeServer
static DWORD WINAPI _pipeThread(LPVOID lpParam) { ((CPipeServer*)lpParam)->Thread(); return 0; }
void Thread();
void WriteMsg(LGPipeMsg & msg);
void WriteMsg(const LGPipeMsg & msg);
public:
~CPipeServer() { DeInit(); }

View File

@@ -22,6 +22,7 @@
#include <avrt.h>
#include "CDebug.h"
#include "CPipeServer.h"
CSwapChainProcessor::CSwapChainProcessor(IDDCX_MONITOR monitor, CIndirectDeviceContext* devContext, IDDCX_SWAPCHAIN hSwapChain,
std::shared_ptr<CD3D11Device> dx11Device, std::shared_ptr<CD3D12Device> dx12Device, HANDLE newFrameEvent) :
@@ -130,6 +131,10 @@ void CSwapChainProcessor::SwapChainThreadCore()
m_lastShapeId = 0;
m_thread[1].Attach(CreateThread(nullptr, 0, _CursorThread, this, 0, nullptr));
// postpone sending this to ensure we dont spam messages if we end up in a
// restart loop while waiting for a valid configuration
g_pipe.SetGPUStatus(m_dx11Device->IsSoftware());
UINT lastFrameNumber = 0;
for (;;)
{