diff options
author | Anton Fedchin <anightik@gmail.com> | 2016-03-15 18:26:44 +0300 |
---|---|---|
committer | Anton Fedchin <afedchin@ruswizards.com> | 2016-03-21 13:25:52 +0300 |
commit | 19e529a759f41e4aa1261d86aaa9d90bb96d55c6 (patch) | |
tree | dd01254f9ac8c9a60879cf224a221b1a48e49af5 | |
parent | 4d4209cd907ec4aa2bc7d18ecb61844c36deda46 (diff) |
[RenderSystemDX] use two buffers in FSEX.
-rw-r--r-- | xbmc/rendering/dx/RenderSystemDX.cpp | 31 | ||||
-rw-r--r-- | xbmc/rendering/dx/RenderSystemDX.h | 1 |
2 files changed, 20 insertions, 12 deletions
diff --git a/xbmc/rendering/dx/RenderSystemDX.cpp b/xbmc/rendering/dx/RenderSystemDX.cpp index 7dbc8e35b9..c324e90f96 100644 --- a/xbmc/rendering/dx/RenderSystemDX.cpp +++ b/xbmc/rendering/dx/RenderSystemDX.cpp @@ -390,10 +390,11 @@ void CRenderSystemDX::SetFullScreenInternal() if (FAILED(hr)) CLog::Log(LOGERROR, "%s - Failed to switch output mode: %s", __FUNCTION__, GetErrorDescription(hr).c_str()); } - - // wait until switching screen state is done DXWait(m_pD3DDev, m_pImdContext); } + // in windowed mode DWM uses triple buffering in any case. + // for FSEM we use double buffering + SetMaximumFrameLatency(2 - m_useWindowedDX); } bool CRenderSystemDX::IsFormatSupport(DXGI_FORMAT format, unsigned int usage) @@ -619,16 +620,9 @@ bool CRenderSystemDX::CreateDevice() pMultiThreading->Release(); } - IDXGIDevice1* pDXGIDevice = NULL; - if (SUCCEEDED(m_pD3DDev->QueryInterface(__uuidof(IDXGIDevice1), reinterpret_cast<void**>(&pDXGIDevice)))) - { - // Not sure the following actually does something but this exists in dx9 implementation - pDXGIDevice->SetGPUThreadPriority(7); - // Ensure that DXGI does not queue more than one frame at a time. This both reduces - // latency and ensures that the application will only render after each VSync - pDXGIDevice->SetMaximumFrameLatency(1); - SAFE_RELEASE(pDXGIDevice); - } + // in windowed mode DWM uses triple buffering in any case. + // for FSEM we use double buffering + SetMaximumFrameLatency(2 - m_useWindowedDX); #ifdef _DEBUG if (SUCCEEDED(m_pD3DDev->QueryInterface(__uuidof(ID3D11Debug), reinterpret_cast<void**>(&m_d3dDebug)))) @@ -1729,4 +1723,17 @@ void CRenderSystemDX::FinishCommandList(bool bExecute /*= true*/) SAFE_RELEASE(pCommandList); } +void CRenderSystemDX::SetMaximumFrameLatency(uint32_t latency) +{ + if (!m_pD3DDev) + return; + + IDXGIDevice1* pDXGIDevice = nullptr; + if (SUCCEEDED(m_pD3DDev->QueryInterface(__uuidof(IDXGIDevice1), reinterpret_cast<void**>(&pDXGIDevice)))) + { + pDXGIDevice->SetMaximumFrameLatency(latency); + SAFE_RELEASE(pDXGIDevice); + } +} + #endif diff --git a/xbmc/rendering/dx/RenderSystemDX.h b/xbmc/rendering/dx/RenderSystemDX.h index 5a8a63ece4..5b0e1ad211 100644 --- a/xbmc/rendering/dx/RenderSystemDX.h +++ b/xbmc/rendering/dx/RenderSystemDX.h @@ -138,6 +138,7 @@ protected: void SetFullScreenInternal(); void GetClosestDisplayModeToCurrent(IDXGIOutput* output, DXGI_MODE_DESC* outCurrentDisplayMode, bool useCached = false); void CheckInterlasedStereoView(void); + void SetMaximumFrameLatency(uint32_t latency); virtual void UpdateMonitor() {}; |