mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-09 08:41:31 +00:00
[idd] adapter: defer render selection until initialization
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 / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
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 / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
This commit is contained in:
@@ -315,8 +315,8 @@ void CIndirectDeviceContext::InitAdapter()
|
|||||||
// Select the render adapter before advertising capabilities. If no hardware
|
// Select the render adapter before advertising capabilities. If no hardware
|
||||||
// adapter is available, this is a software-rendered display and must remain
|
// adapter is available, this is a software-rendered display and must remain
|
||||||
// SDR-only; the software path must never depend on compute processing.
|
// SDR-only; the software path must never depend on compute processing.
|
||||||
bool havePreferredRenderAdapter = false;
|
m_havePreferredRenderAdapter = false;
|
||||||
LUID preferredRenderAdapter = {};
|
m_preferredRenderAdapter = {};
|
||||||
IDXGIFactory1 * factory = NULL;
|
IDXGIFactory1 * factory = NULL;
|
||||||
HRESULT factoryStatus = CreateDXGIFactory1(
|
HRESULT factoryStatus = CreateDXGIFactory1(
|
||||||
__uuidof(IDXGIFactory1), (void **)&factory);
|
__uuidof(IDXGIFactory1), (void **)&factory);
|
||||||
@@ -362,15 +362,15 @@ void CIndirectDeviceContext::InitAdapter()
|
|||||||
|
|
||||||
DEBUG_INFO("Selected render adapter %ls (vendor 0x%04x, device 0x%04x)",
|
DEBUG_INFO("Selected render adapter %ls (vendor 0x%04x, device 0x%04x)",
|
||||||
adapterDesc.Description, adapterDesc.VendorId, adapterDesc.DeviceId);
|
adapterDesc.Description, adapterDesc.VendorId, adapterDesc.DeviceId);
|
||||||
preferredRenderAdapter = adapterDesc.AdapterLuid;
|
m_preferredRenderAdapter = adapterDesc.AdapterLuid;
|
||||||
havePreferredRenderAdapter = true;
|
m_havePreferredRenderAdapter = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory->Release();
|
factory->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_softwareMode = !havePreferredRenderAdapter;
|
m_softwareMode = !m_havePreferredRenderAdapter;
|
||||||
if (m_softwareMode)
|
if (m_softwareMode)
|
||||||
DEBUG_INFO("No hardware render adapter available; using SDR software mode");
|
DEBUG_INFO("No hardware render adapter available; using SDR software mode");
|
||||||
|
|
||||||
@@ -471,21 +471,10 @@ void CIndirectDeviceContext::InitAdapter()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_INFO("IddCxAdapterInitAsync started successfully (adapter %p)",
|
|
||||||
m_adapter);
|
|
||||||
|
|
||||||
// Try to co-exist with the virtual video device by telling IddCx which
|
|
||||||
// hardware adapter we prefer to render on.
|
|
||||||
if (havePreferredRenderAdapter)
|
|
||||||
{
|
|
||||||
IDARG_IN_ADAPTERSETRENDERADAPTER args = {};
|
|
||||||
args.PreferredRenderAdapter = preferredRenderAdapter;
|
|
||||||
IddCxAdapterSetRenderAdapter(m_adapter, &args);
|
|
||||||
DEBUG_INFO("Preferred render adapter set");
|
|
||||||
}
|
|
||||||
|
|
||||||
auto * wrapper = WdfObjectGet_CIndirectDeviceContextWrapper(m_adapter);
|
auto * wrapper = WdfObjectGet_CIndirectDeviceContextWrapper(m_adapter);
|
||||||
wrapper->context = this;
|
wrapper->context = this;
|
||||||
|
DEBUG_INFO("IddCxAdapterInitAsync started successfully (adapter %p)",
|
||||||
|
m_adapter);
|
||||||
DEBUG_INFO("Adapter context attached; waiting for initialization callback");
|
DEBUG_INFO("Adapter context attached; waiting for initialization callback");
|
||||||
|
|
||||||
// Adapter is up; no need to keep retrying.
|
// Adapter is up; no need to keep retrying.
|
||||||
@@ -494,6 +483,22 @@ void CIndirectDeviceContext::InitAdapter()
|
|||||||
DEBUG_INFO("Adapter initialization request complete; returning to IddCx");
|
DEBUG_INFO("Adapter initialization request complete; returning to IddCx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIndirectDeviceContext::FinishAdapterInit(UINT connectorIndex)
|
||||||
|
{
|
||||||
|
// Try to co-exist with the virtual video device by telling IddCx which
|
||||||
|
// hardware adapter we prefer to render on. Do this only after the adapter
|
||||||
|
// has finished initializing, but before adding its monitor.
|
||||||
|
if (m_havePreferredRenderAdapter)
|
||||||
|
{
|
||||||
|
IDARG_IN_ADAPTERSETRENDERADAPTER args = {};
|
||||||
|
args.PreferredRenderAdapter = m_preferredRenderAdapter;
|
||||||
|
IddCxAdapterSetRenderAdapter(m_adapter, &args);
|
||||||
|
DEBUG_INFO("Preferred render adapter set");
|
||||||
|
}
|
||||||
|
|
||||||
|
FinishInit(connectorIndex);
|
||||||
|
}
|
||||||
|
|
||||||
void CIndirectDeviceContext::FinishInit(UINT connectorIndex)
|
void CIndirectDeviceContext::FinishInit(UINT connectorIndex)
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Creating monitor on connector %u", connectorIndex);
|
DEBUG_INFO("Creating monitor on connector %u", connectorIndex);
|
||||||
|
|||||||
@@ -64,14 +64,16 @@ class CIndirectDeviceContext
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
WDFDEVICE m_wdfDevice;
|
WDFDEVICE m_wdfDevice;
|
||||||
IDDCX_ADAPTER m_adapter = nullptr;
|
IDDCX_ADAPTER m_adapter = nullptr;
|
||||||
IDDCX_MONITOR m_monitor = nullptr;
|
IDDCX_MONITOR m_monitor = nullptr;
|
||||||
bool m_replugMonitor = false;
|
LUID m_preferredRenderAdapter = {};
|
||||||
bool m_replugPending = false;
|
bool m_havePreferredRenderAdapter = false;
|
||||||
bool m_monitorDeparted = false;
|
bool m_replugMonitor = false;
|
||||||
bool m_swapChainAssigned = false;
|
bool m_replugPending = false;
|
||||||
bool m_swapChainReady = false;
|
bool m_monitorDeparted = false;
|
||||||
bool m_waitForSwapChainRelease = false;
|
bool m_swapChainAssigned = false;
|
||||||
|
bool m_swapChainReady = false;
|
||||||
|
bool m_waitForSwapChainRelease = false;
|
||||||
|
|
||||||
// Guards the adapter/monitor init handshake and the replug state machine
|
// Guards the adapter/monitor init handshake and the replug state machine
|
||||||
// (monitor/replug/swap-chain state, m_doSetMode, m_setMode). These are
|
// (monitor/replug/swap-chain state, m_doSetMode, m_setMode). These are
|
||||||
@@ -227,6 +229,7 @@ public:
|
|||||||
|
|
||||||
bool PopulateDefaultModes();
|
bool PopulateDefaultModes();
|
||||||
void InitAdapter();
|
void InitAdapter();
|
||||||
|
void FinishAdapterInit(UINT connectorIndex);
|
||||||
void FinishInit(UINT connectorIndex);
|
void FinishInit(UINT connectorIndex);
|
||||||
void ReplugMonitor();
|
void ReplugMonitor();
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ NTSTATUS LGIddAdapterInitFinished(IDDCX_ADAPTER adapter, const IDARG_IN_ADAPTER_
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_INFO("Adapter initialized, creating monitor");
|
DEBUG_INFO("Adapter initialized, creating monitor");
|
||||||
wrapper->context->FinishInit(0);
|
wrapper->context->FinishAdapterInit(0);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user