diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.cpp b/xbmc/cores/VideoRenderers/BaseRenderer.cpp index 84e6261d2ee82..f82f37f8a0584 100644 --- a/xbmc/cores/VideoRenderers/BaseRenderer.cpp +++ b/xbmc/cores/VideoRenderers/BaseRenderer.cpp @@ -119,7 +119,7 @@ bool CBaseRenderer::FindResolutionFromOverride(float fps, float& weight, bool fa for (size_t j = (int)RES_DESKTOP; j < CDisplaySettings::Get().ResolutionInfoSize(); j++) { - RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)j); + RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)j, g_graphicsContext.GetStereoMode((RESOLUTION)j)); if (info.iScreenWidth == curr.iScreenWidth && info.iScreenHeight == curr.iScreenHeight @@ -179,7 +179,7 @@ void CBaseRenderer::FindResolutionFromFpsMatch(float fps, float& weight) //get the resolution with the refreshrate closest to 60 hertz for (size_t i = (int)RES_DESKTOP; i < CDisplaySettings::Get().ResolutionInfoSize(); i++) { - RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)i); + RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)i, g_graphicsContext.GetStereoMode((RESOLUTION)i)); if (MathUtils::round_int(info.fRefreshRate) == 60 && info.iScreenWidth == curr.iScreenWidth @@ -200,7 +200,7 @@ void CBaseRenderer::FindResolutionFromFpsMatch(float fps, float& weight) CLog::Log(LOGDEBUG, "60 hertz refreshrate not available, choosing highest"); for (size_t i = (int)RES_DESKTOP; i < CDisplaySettings::Get().ResolutionInfoSize(); i++) { - RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)i); + RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)i, g_graphicsContext.GetStereoMode((RESOLUTION)i)); if (info.fRefreshRate > curr.fRefreshRate && info.iScreenWidth == curr.iScreenWidth @@ -234,14 +234,14 @@ RESOLUTION CBaseRenderer::FindClosestResolution(float fps, float multiplier, RES // Find closest refresh rate for (size_t i = (int)RES_DESKTOP; i < CDisplaySettings::Get().ResolutionInfoSize(); i++) { - const RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)i); + const RESOLUTION_INFO info = g_graphicsContext.GetResInfo((RESOLUTION)i, g_graphicsContext.GetStereoMode((RESOLUTION)i)); //discard resolutions that are not the same width and height (and interlaced/3D flags) //or have a too low refreshrate if (info.iScreenWidth != curr.iScreenWidth || info.iScreenHeight != curr.iScreenHeight || info.iScreen != curr.iScreen - || (info.dwFlags & D3DPRESENTFLAG_MODEMASK) != (curr.dwFlags & D3DPRESENTFLAG_MODEMASK) + || (info.dwFlags & D3DPRESENTFLAG_INTERLACED) != (curr.dwFlags & D3DPRESENTFLAG_INTERLACED) || info.fRefreshRate < (fRefreshRate * multiplier / 1.001) - 0.001) continue; diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp index ed7316a7cc40e..f591b9cddbda4 100644 --- a/xbmc/guilib/GraphicContext.cpp +++ b/xbmc/guilib/GraphicContext.cpp @@ -746,32 +746,33 @@ void CGraphicContext::ApplyStateBlock() g_Windowing.ApplyStateBlock(); } -const RESOLUTION_INFO CGraphicContext::GetResInfo(RESOLUTION res) const +RENDER_STEREO_MODE CGraphicContext::GetStereoMode(RESOLUTION res) const { RESOLUTION_INFO info = CDisplaySettings::Get().GetResolutionInfo(res); + return (info.dwFlags & D3DPRESENTFLAG_MODE3DTB) ? RENDER_STEREO_MODE_SPLIT_HORIZONTAL : + (info.dwFlags & D3DPRESENTFLAG_MODE3DSBS) ? RENDER_STEREO_MODE_SPLIT_VERTICAL : RENDER_STEREO_MODE_OFF; +} - if(m_stereoMode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL) +const RESOLUTION_INFO CGraphicContext::GetResInfo(RESOLUTION res, RENDER_STEREO_MODE stereoMode) const +{ + RESOLUTION_INFO info = CDisplaySettings::Get().GetResolutionInfo(res); + + if(stereoMode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL) { - if((info.dwFlags & D3DPRESENTFLAG_MODE3DTB) == 0) - { - info.fPixelRatio /= 2; - info.iBlanking = 0; - info.dwFlags |= D3DPRESENTFLAG_MODE3DTB; - } + info.fPixelRatio /= 2; + info.iBlanking = 0; + info.dwFlags |= D3DPRESENTFLAG_MODE3DTB; info.iHeight = (info.iHeight - info.iBlanking) / 2; info.Overscan.top /= 2; info.Overscan.bottom = (info.Overscan.bottom - info.iBlanking) / 2; info.iSubtitles = (info.iSubtitles - info.iBlanking) / 2; } - if(m_stereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL) + if(stereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL) { - if((info.dwFlags & D3DPRESENTFLAG_MODE3DSBS) == 0) - { - info.fPixelRatio *= 2; - info.iBlanking = 0; - info.dwFlags |= D3DPRESENTFLAG_MODE3DSBS; - } + info.fPixelRatio *= 2; + info.iBlanking = 0; + info.dwFlags |= D3DPRESENTFLAG_MODE3DSBS; info.iWidth = (info.iWidth - info.iBlanking) / 2; info.Overscan.left /= 2; info.Overscan.right = (info.Overscan.right - info.iBlanking) / 2; @@ -795,16 +796,14 @@ void CGraphicContext::SetResInfo(RESOLUTION res, const RESOLUTION_INFO& info) if(info.dwFlags & D3DPRESENTFLAG_MODE3DSBS) { curr.Overscan.right = info.Overscan.right * 2 + info.iBlanking; - if((curr.dwFlags & D3DPRESENTFLAG_MODE3DSBS) == 0) - curr.fPixelRatio /= 2.0; + curr.fPixelRatio /= 2.0; } if(info.dwFlags & D3DPRESENTFLAG_MODE3DTB) { curr.Overscan.bottom = info.Overscan.bottom * 2 + info.iBlanking; curr.iSubtitles = info.iSubtitles * 2 + info.iBlanking; - if((curr.dwFlags & D3DPRESENTFLAG_MODE3DTB) == 0) - curr.fPixelRatio *= 2.0; + curr.fPixelRatio *= 2.0; } } diff --git a/xbmc/guilib/GraphicContext.h b/xbmc/guilib/GraphicContext.h index 8501e58a38630..0c53cae5c4e0d 100644 --- a/xbmc/guilib/GraphicContext.h +++ b/xbmc/guilib/GraphicContext.h @@ -120,11 +120,15 @@ class CGraphicContext : public CCriticalSection, void GetAllowedResolutions(std::vector &res); // output scaling + const RESOLUTION_INFO GetResInfo(RESOLUTION res) const + { + return GetResInfo(res, GetStereoMode()); + } const RESOLUTION_INFO GetResInfo() const { return GetResInfo(m_Resolution); } - const RESOLUTION_INFO GetResInfo(RESOLUTION res) const; + const RESOLUTION_INFO GetResInfo(RESOLUTION res, RENDER_STEREO_MODE stereo_mode) const; void SetResInfo(RESOLUTION res, const RESOLUTION_INFO& info); /* \brief Get UI scaling information from a given resolution to the screen resolution. @@ -161,9 +165,11 @@ class CGraphicContext : public CCriticalSection, void RestoreOrigin(); void SetCameraPosition(const CPoint &camera); void SetStereoView(RENDER_STEREO_VIEW view); - RENDER_STEREO_VIEW GetStereoView() { return m_stereoView; } + RENDER_STEREO_VIEW GetStereoView() const { return m_stereoView; } void SetStereoMode(RENDER_STEREO_MODE mode) { m_nextStereoMode = mode; } - RENDER_STEREO_MODE GetStereoMode() { return m_stereoMode; } + RENDER_STEREO_MODE GetStereoMode() const { return m_stereoMode; } + RENDER_STEREO_MODE GetStereoMode(RESOLUTION res) const; + void RestoreCameraPosition(); /*! \brief Set a region in which to clip all rendering Anything that is rendered after setting a clip region will be clipped so that no part renders diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp index c80114e909a4f..80c05d2cc9f47 100644 --- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp +++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp @@ -499,15 +499,9 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &r m_desktopRes.fPixelRatio = tv_state.display.hdmi.display_options.aspect == 0 ? 1.0f : get_display_aspect_ratio((HDMI_ASPECT_T)tv_state.display.hdmi.display_options.aspect) / ((float)m_desktopRes.iScreenWidth / (float)m_desktopRes.iScreenHeight); // Also add 3D flags if (tv_state.display.hdmi.format_3d == HDMI_3D_FORMAT_SBS_HALF) - { m_desktopRes.dwFlags |= D3DPRESENTFLAG_MODE3DSBS; - m_desktopRes.fPixelRatio *= 2.0; - } else if (tv_state.display.hdmi.format_3d == HDMI_3D_FORMAT_TB_HALF) - { m_desktopRes.dwFlags |= D3DPRESENTFLAG_MODE3DTB; - m_desktopRes.fPixelRatio *= 0.5; - } HDMI_PROPERTY_PARAM_T property; property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE; vc_tv_hdmi_get_property(&property); @@ -650,7 +644,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v RESOLUTION_INFO res2 = res; res2.dwFlags |= D3DPRESENTFLAG_MODE3DSBS; res2.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight); - res2.fPixelRatio *= 2.0f; res2.iSubtitles = (int)(0.965 * res2.iHeight); AddUniqueResolution(res2, resolutions); @@ -666,7 +659,6 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v RESOLUTION_INFO res2 = res; res2.dwFlags |= D3DPRESENTFLAG_MODE3DTB; res2.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight); - res2.fPixelRatio *= 0.5f; res2.iSubtitles = (int)(0.965 * res2.iHeight); AddUniqueResolution(res2, resolutions);