aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Fedchin <afedchin@users.noreply.github.com>2018-03-20 12:37:39 +0300
committerGitHub <noreply@github.com>2018-03-20 12:37:39 +0300
commitec3627e03bb12e0ea40764b08812bd048b7e47fc (patch)
tree0366f29a4be9f49c4496b45cbc869f1af75cf6b8
parent2c8eac2e8b4b6611cc038f2dc1ae0af578cdceee (diff)
parent5fa203c72d661aa963dcfe9a6401f8f0edd9424c (diff)
Merge pull request #13674 from afedchin/win32-refresh-fix
[win32] fixes for display mode switching issues
-rw-r--r--xbmc/rendering/dx/DeviceResources.cpp14
-rw-r--r--xbmc/windowing/windows/WinSystemWin32.cpp2
-rw-r--r--xbmc/windowing/windows/WinSystemWin32.h2
-rw-r--r--xbmc/windowing/windows/WinSystemWin32DX.cpp9
-rw-r--r--xbmc/windowing/windows/WinSystemWin32DX.h1
5 files changed, 24 insertions, 4 deletions
diff --git a/xbmc/rendering/dx/DeviceResources.cpp b/xbmc/rendering/dx/DeviceResources.cpp
index 1b493f26d7..ebc9525533 100644
--- a/xbmc/rendering/dx/DeviceResources.cpp
+++ b/xbmc/rendering/dx/DeviceResources.cpp
@@ -230,7 +230,7 @@ bool DX::DeviceResources::SetFullScreen(bool fullscreen, RESOLUTION_INFO& res)
// some drivers unable to create stereo swapchain if mode does not match @23.976
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_HARDWAREBASED)
{
- CLog::Log(LOGDEBUG, __FUNCTION__": changing display mode to %dx%d@%0.3fs", res.iWidth, res.iHeight, res.fRefreshRate,
+ CLog::Log(LOGDEBUG, __FUNCTION__": changing display mode to %dx%d@%0.3f", res.iWidth, res.iHeight, res.fRefreshRate,
res.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
int refresh = static_cast<int>(res.fRefreshRate);
@@ -245,6 +245,18 @@ bool DX::DeviceResources::SetFullScreen(bool fullscreen, RESOLUTION_INFO& res)
currentMode.RefreshRate.Numerator *= 2;
currentMode.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST; // guessing;
}
+ // sometimes the OS silently brings Kodi out of full screen mode
+ // in this case switching a resolution has no any effect and
+ // we have to enter into full screen mode before switching
+ if (!bFullScreen)
+ {
+ ComPtr<IDXGIOutput> pOutput;
+ GetOutput(pOutput.GetAddressOf());
+
+ CLog::LogF(LOGDEBUG, "fixup fullscreen mode before switching resolution");
+ recreate |= SUCCEEDED(m_swapChain->SetFullscreenState(true, pOutput.Get()));
+ m_swapChain->GetFullscreenState(&bFullScreen, nullptr);
+ }
recreate |= SUCCEEDED(m_swapChain->ResizeTarget(&currentMode));
}
}
diff --git a/xbmc/windowing/windows/WinSystemWin32.cpp b/xbmc/windowing/windows/WinSystemWin32.cpp
index b73e9d1754..b325546d1e 100644
--- a/xbmc/windowing/windows/WinSystemWin32.cpp
+++ b/xbmc/windowing/windows/WinSystemWin32.cpp
@@ -695,9 +695,7 @@ bool CWinSystemWin32::ChangeResolution(const RESOLUTION_INFO& res, bool forceCha
bool bResChanged = false;
// Windows 8 refresh rate workaround for 24.0, 48.0 and 60.0 Hz
- // using this on Win10 Fall Creators Update causes black screen issue on refresh mode change
if ( CSysInfo::IsWindowsVersionAtLeast(CSysInfo::WindowsVersionWin8)
- && !CSysInfo::IsWindowsVersionAtLeast(CSysInfo::WindowsVersionWin10_FCU)
&& (res.fRefreshRate == 24.0 || res.fRefreshRate == 48.0 || res.fRefreshRate == 60.0))
{
CLog::LogF(LOGDEBUG, "Using Windows 8+ workaround for refresh rate %d Hz",
diff --git a/xbmc/windowing/windows/WinSystemWin32.h b/xbmc/windowing/windows/WinSystemWin32.h
index 3d738fb358..072594b05f 100644
--- a/xbmc/windowing/windows/WinSystemWin32.h
+++ b/xbmc/windowing/windows/WinSystemWin32.h
@@ -228,7 +228,7 @@ protected:
virtual void Register(IDispResource *resource);
virtual void Unregister(IDispResource *resource);
- bool ChangeResolution(const RESOLUTION_INFO& res, bool forceChange = false);
+ virtual bool ChangeResolution(const RESOLUTION_INFO& res, bool forceChange = false);
virtual bool UpdateResolutionsInternal();
virtual bool CreateBlankWindows();
virtual bool BlankNonActiveMonitors(bool bBlank);
diff --git a/xbmc/windowing/windows/WinSystemWin32DX.cpp b/xbmc/windowing/windows/WinSystemWin32DX.cpp
index 59a447f144..e6d1ede941 100644
--- a/xbmc/windowing/windows/WinSystemWin32DX.cpp
+++ b/xbmc/windowing/windows/WinSystemWin32DX.cpp
@@ -180,6 +180,15 @@ void CWinSystemWin32DX::OnScreenChange(int screen)
}
}
+bool CWinSystemWin32DX::ChangeResolution(const RESOLUTION_INFO &res, bool forceChange)
+{
+ bool changed = CWinSystemWin32::ChangeResolution(res, forceChange);
+ // this is a try to fix FCU issue after changing resolution
+ if (m_deviceResources && changed)
+ m_deviceResources->ResizeBuffers();
+ return changed;
+}
+
void CWinSystemWin32DX::OnResize(int width, int height)
{
if (!m_IsAlteringWindow)
diff --git a/xbmc/windowing/windows/WinSystemWin32DX.h b/xbmc/windowing/windows/WinSystemWin32DX.h
index 6a908d553b..86d214051f 100644
--- a/xbmc/windowing/windows/WinSystemWin32DX.h
+++ b/xbmc/windowing/windows/WinSystemWin32DX.h
@@ -85,6 +85,7 @@ protected:
void ResizeDeviceBuffers() override;
bool IsStereoEnabled() override;
void OnScreenChange(int screen) override;
+ bool ChangeResolution(const RESOLUTION_INFO& res, bool forceChange = false) override;
HMODULE m_hDriverModule;
TRACED_HOOK_HANDLE m_hHook;