mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 15:11:31 +00:00
[idd] capture: add forced indirect copy
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
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
This commit is contained in:
@@ -71,6 +71,13 @@ Force full direct frame copies
|
|||||||
disabled unless you encounter corruption. Changing it requests a driver
|
disabled unless you encounter corruption. Changing it requests a driver
|
||||||
reload.
|
reload.
|
||||||
|
|
||||||
|
Force indirect copy
|
||||||
|
Disables direct D3D12 access to the shared transport heap and instead
|
||||||
|
copies each frame through a CPU-mapped readback resource. Enable this only
|
||||||
|
to work around a GPU driver that corrupts direct transport writes: it adds
|
||||||
|
a CPU copy and significantly reduces throughput. It takes precedence over
|
||||||
|
the direct-copy preference and requests a driver reload when changed.
|
||||||
|
|
||||||
Unlike mode-list edits, preference checkboxes are saved when clicked.
|
Unlike mode-list edits, preference checkboxes are saved when clicked.
|
||||||
|
|
||||||
Software processing
|
Software processing
|
||||||
|
|||||||
@@ -101,6 +101,11 @@ class CSettings
|
|||||||
return ReadBoolValue(L"ForceFullDirectCopy");
|
return ReadBoolValue(L"ForceFullDirectCopy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ShouldForceIndirectCopy()
|
||||||
|
{
|
||||||
|
return ReadBoolValue(L"ForceIndirectCopy");
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const wchar_t * RegistryKey()
|
static const wchar_t * RegistryKey()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "d3d/CD3D12Device.h"
|
#include "d3d/CD3D12Device.h"
|
||||||
|
#include "config/CSettings.h"
|
||||||
#include "CDebug.h"
|
#include "CDebug.h"
|
||||||
|
|
||||||
bool CD3D12Device::s_directHeapFailed = false;
|
bool CD3D12Device::s_directHeapFailed = false;
|
||||||
@@ -66,8 +67,12 @@ CD3D12Device::InitResult CD3D12Device::Init(
|
|||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
const bool forceIndirectCopy = CSettings::ShouldForceIndirectCopy();
|
||||||
m_computeEnabled = enableCompute;
|
m_computeEnabled = enableCompute;
|
||||||
m_indirectCopy = !directMemory || s_directHeapFailed;
|
m_indirectCopy = !directMemory || s_directHeapFailed || forceIndirectCopy;
|
||||||
|
|
||||||
|
if (forceIndirectCopy)
|
||||||
|
DEBUG_INFO("Forcing indirect transport copies");
|
||||||
|
|
||||||
hr = CreateDXGIFactory2(m_debug ? DXGI_CREATE_FACTORY_DEBUG : 0, IID_PPV_ARGS(&m_factory));
|
hr = CreateDXGIFactory2(m_debug ? DXGI_CREATE_FACTORY_DEBUG : 0, IID_PPV_ARGS(&m_factory));
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ CConfigWindow::CConfigWindow() : m_scale(1)
|
|||||||
m_noGPU = m_settings.getNoGPU();
|
m_noGPU = m_settings.getNoGPU();
|
||||||
m_exclusive = m_settings.getExclusiveMonitor();
|
m_exclusive = m_settings.getExclusiveMonitor();
|
||||||
m_forceFullDirectCopy = m_settings.getForceFullDirectCopy();
|
m_forceFullDirectCopy = m_settings.getForceFullDirectCopy();
|
||||||
|
m_forceIndirectCopy = m_settings.getForceIndirectCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CreateWindowEx(0, MAKEINTATOM(s_atom), L"Looking Glass IDD Configuration",
|
if (!CreateWindowEx(0, MAKEINTATOM(s_atom), L"Looking Glass IDD Configuration",
|
||||||
@@ -96,6 +97,7 @@ void CConfigWindow::updateFont()
|
|||||||
*m_defRefreshLabel, *m_defRefresh, *m_defRefreshHz, *m_modeSave, *m_modeRevert,
|
*m_defRefreshLabel, *m_defRefresh, *m_defRefreshHz, *m_modeSave, *m_modeRevert,
|
||||||
*m_prefGroup, *m_prefNoGPU, *m_prefExclusive,
|
*m_prefGroup, *m_prefNoGPU, *m_prefExclusive,
|
||||||
*m_prefForceFullDirectCopy,
|
*m_prefForceFullDirectCopy,
|
||||||
|
*m_prefForceIndirectCopy,
|
||||||
}))
|
}))
|
||||||
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
|
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
|
||||||
}
|
}
|
||||||
@@ -191,6 +193,8 @@ LRESULT CConfigWindow::onCreate()
|
|||||||
m_prefExclusive.reset(new CCheckbox(L"Make LG the only monitor", 0, m_hwnd));
|
m_prefExclusive.reset(new CCheckbox(L"Make LG the only monitor", 0, m_hwnd));
|
||||||
m_prefForceFullDirectCopy.reset(new CCheckbox(
|
m_prefForceFullDirectCopy.reset(new CCheckbox(
|
||||||
L"Force full direct frame copies", 0, m_hwnd));
|
L"Force full direct frame copies", 0, m_hwnd));
|
||||||
|
m_prefForceIndirectCopy.reset(new CCheckbox(
|
||||||
|
L"Force indirect copy", 0, m_hwnd));
|
||||||
|
|
||||||
if (m_noGPU)
|
if (m_noGPU)
|
||||||
m_prefNoGPU->setChecked(*m_noGPU);
|
m_prefNoGPU->setChecked(*m_noGPU);
|
||||||
@@ -201,6 +205,9 @@ LRESULT CConfigWindow::onCreate()
|
|||||||
if (m_forceFullDirectCopy)
|
if (m_forceFullDirectCopy)
|
||||||
m_prefForceFullDirectCopy->setChecked(*m_forceFullDirectCopy);
|
m_prefForceFullDirectCopy->setChecked(*m_forceFullDirectCopy);
|
||||||
|
|
||||||
|
if (m_forceIndirectCopy)
|
||||||
|
m_prefForceIndirectCopy->setChecked(*m_forceIndirectCopy);
|
||||||
|
|
||||||
LONG width, height;
|
LONG width, height;
|
||||||
getMinimumSize(width, height);
|
getMinimumSize(width, height);
|
||||||
SetWindowPos(m_hwnd, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER);
|
SetWindowPos(m_hwnd, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER);
|
||||||
@@ -240,10 +247,11 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
|
|||||||
pos.pinBottomLeft(*m_modeSave, 20, 20, 132, 24);
|
pos.pinBottomLeft(*m_modeSave, 20, 20, 132, 24);
|
||||||
pos.pinBottomLeft(*m_modeRevert, 154, 20, 50, 24);
|
pos.pinBottomLeft(*m_modeRevert, 154, 20, 50, 24);
|
||||||
|
|
||||||
pos.pinTopLeft(*m_prefGroup, 224, 40, 200, 92);
|
pos.pinTopLeft(*m_prefGroup, 224, 40, 200, 112);
|
||||||
pos.pinTopLeft(*m_prefNoGPU, 236, 64, 176, 20);
|
pos.pinTopLeft(*m_prefNoGPU, 236, 64, 176, 20);
|
||||||
pos.pinTopLeft(*m_prefExclusive, 236, 84, 176, 20);
|
pos.pinTopLeft(*m_prefExclusive, 236, 84, 176, 20);
|
||||||
pos.pinTopLeft(*m_prefForceFullDirectCopy, 236, 104, 188, 20);
|
pos.pinTopLeft(*m_prefForceFullDirectCopy, 236, 104, 188, 20);
|
||||||
|
pos.pinTopLeft(*m_prefForceIndirectCopy, 236, 124, 188, 20);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,6 +376,22 @@ LRESULT CConfigWindow::onCommand(WORD id, WORD code, HWND hwnd)
|
|||||||
m_prefForceFullDirectCopy->setChecked(value);
|
m_prefForceFullDirectCopy->setChecked(value);
|
||||||
sendSettingChange();
|
sendSettingChange();
|
||||||
}
|
}
|
||||||
|
else if (m_prefForceIndirectCopy &&
|
||||||
|
hwnd == *m_prefForceIndirectCopy && code == BN_CLICKED &&
|
||||||
|
m_forceIndirectCopy)
|
||||||
|
{
|
||||||
|
const bool value = !*m_forceIndirectCopy;
|
||||||
|
const LSTATUS result = m_settings.setForceIndirectCopy(value);
|
||||||
|
if (result != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR_HR(result, "Failed to save ForceIndirectCopy");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*m_forceIndirectCopy = value;
|
||||||
|
m_prefForceIndirectCopy->setChecked(value);
|
||||||
|
sendSettingChange();
|
||||||
|
}
|
||||||
else if (m_modeSave && hwnd == *m_modeSave && code == BN_CLICKED)
|
else if (m_modeSave && hwnd == *m_modeSave && code == BN_CLICKED)
|
||||||
{
|
{
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ class CConfigWindow : public CWindow
|
|||||||
std::unique_ptr<CCheckbox> m_prefNoGPU;
|
std::unique_ptr<CCheckbox> m_prefNoGPU;
|
||||||
std::unique_ptr<CCheckbox> m_prefExclusive;
|
std::unique_ptr<CCheckbox> m_prefExclusive;
|
||||||
std::unique_ptr<CCheckbox> m_prefForceFullDirectCopy;
|
std::unique_ptr<CCheckbox> m_prefForceFullDirectCopy;
|
||||||
|
std::unique_ptr<CCheckbox> m_prefForceIndirectCopy;
|
||||||
|
|
||||||
std::function<void()> m_onDestroy;
|
std::function<void()> m_onDestroy;
|
||||||
std::function<void()> m_onSettingChange;
|
std::function<void()> m_onSettingChange;
|
||||||
@@ -77,6 +78,7 @@ class CConfigWindow : public CWindow
|
|||||||
std::optional<bool> m_noGPU;
|
std::optional<bool> m_noGPU;
|
||||||
std::optional<bool> m_exclusive;
|
std::optional<bool> m_exclusive;
|
||||||
std::optional<bool> m_forceFullDirectCopy;
|
std::optional<bool> m_forceFullDirectCopy;
|
||||||
|
std::optional<bool> m_forceIndirectCopy;
|
||||||
|
|
||||||
void getMinimumSize(LONG &width, LONG &height);
|
void getMinimumSize(LONG &width, LONG &height);
|
||||||
void updateFont();
|
void updateFont();
|
||||||
|
|||||||
@@ -290,3 +290,28 @@ LSTATUS CRegistrySettings::setForceFullDirectCopy(bool forceFullCopy)
|
|||||||
return RegSetValueEx(hKey, L"ForceFullDirectCopy", 0, REG_DWORD,
|
return RegSetValueEx(hKey, L"ForceFullDirectCopy", 0, REG_DWORD,
|
||||||
(LPBYTE)&dwValue, sizeof(DWORD));
|
(LPBYTE)&dwValue, sizeof(DWORD));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<bool> CRegistrySettings::getForceIndirectCopy()
|
||||||
|
{
|
||||||
|
DWORD result, cbData = sizeof result;
|
||||||
|
|
||||||
|
LSTATUS status = RegGetValue(hKey, nullptr, L"ForceIndirectCopy",
|
||||||
|
RRF_RT_REG_DWORD, nullptr, &result, &cbData);
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case ERROR_SUCCESS:
|
||||||
|
return !!result;
|
||||||
|
case ERROR_FILE_NOT_FOUND:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
DEBUG_ERROR_HR(status, "RegGetValue(ForceIndirectCopy)");
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LSTATUS CRegistrySettings::setForceIndirectCopy(bool forceIndirectCopy)
|
||||||
|
{
|
||||||
|
DWORD dwValue = forceIndirectCopy;
|
||||||
|
return RegSetValueEx(hKey, L"ForceIndirectCopy", 0, REG_DWORD,
|
||||||
|
(LPBYTE)&dwValue, sizeof(DWORD));
|
||||||
|
}
|
||||||
|
|||||||
@@ -59,4 +59,7 @@ public:
|
|||||||
|
|
||||||
std::optional<bool> getForceFullDirectCopy();
|
std::optional<bool> getForceFullDirectCopy();
|
||||||
LSTATUS setForceFullDirectCopy(bool forceFullCopy);
|
LSTATUS setForceFullDirectCopy(bool forceFullCopy);
|
||||||
|
|
||||||
|
std::optional<bool> getForceIndirectCopy();
|
||||||
|
LSTATUS setForceIndirectCopy(bool forceIndirectCopy);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user