Skip to content
Permalink
Browse files

rendering: Always call Flip but don't sleep when playing video

This allows delay after refresh rate change to continue when video is playing with no gui overlay
  • Loading branch information
popcornmix committed Jun 11, 2016
1 parent 160c68b commit 005bc83fd6018f86c6f53985b48c0d5655f4506b
@@ -1892,10 +1892,7 @@ void CApplication::Render()
g_infoManager.UpdateFPS();
}

// TODO: find better solution
// if video is rendered to a separate layer, we should not block this thread
if (!m_pPlayer->IsRenderingVideoLayer() || hasRendered)
g_graphicsContext.Flip(hasRendered);
g_graphicsContext.Flip(hasRendered, m_pPlayer->IsRenderingVideoLayer());

CTimeUtils::UpdateFrameTime(hasRendered);
}
@@ -976,12 +976,12 @@ void CGraphicContext::SetMediaDir(const std::string &strMediaDir)
m_strMediaDir = strMediaDir;
}

void CGraphicContext::Flip(bool rendered)
void CGraphicContext::Flip(bool rendered, bool videoLayer)
{
if (IsFullScreenVideo())
g_Windowing.FinishPipeline();

g_Windowing.PresentRender(rendered);
g_Windowing.PresentRender(rendered, videoLayer);

if(m_stereoMode != m_nextStereoMode)
{
@@ -130,7 +130,7 @@ class CGraphicContext : public CCriticalSection,
void SetRenderingResolution(const RESOLUTION_INFO &res, bool needsScaling); ///< Sets scaling up for rendering
void SetScalingResolution(const RESOLUTION_INFO &res, bool needsScaling); ///< Sets scaling up for skin loading etc.
float GetScalingPixelRatio() const;
void Flip(bool rendered);
void Flip(bool rendered, bool videoLayer);
void InvertFinalCoords(float &x, float &y) const;
inline float ScaleFinalXCoord(float x, float y) const XBMC_FORCE_INLINE { return m_finalTransform.matrix.TransformXCoord(x, y, 0); }
inline float ScaleFinalYCoord(float x, float y) const XBMC_FORCE_INLINE { return m_finalTransform.matrix.TransformYCoord(x, y, 0); }
@@ -102,7 +102,7 @@ class CRenderSystemBase

virtual bool BeginRender() = 0;
virtual bool EndRender() = 0;
virtual void PresentRender(bool rendered) = 0;
virtual void PresentRender(bool rendered, bool videoLayer) = 0;
virtual bool ClearBuffers(color_t color) = 0;
virtual bool IsExtSupported(const char* extension) = 0;

@@ -290,7 +290,7 @@ bool CRenderSystemGL::IsExtSupported(const char* extension)
return m_RenderExtensions.find(name) != std::string::npos;
}

void CRenderSystemGL::PresentRender(bool rendered)
void CRenderSystemGL::PresentRender(bool rendered, bool videoLayer)
{
SetVSync(true);

@@ -39,7 +39,7 @@ class CRenderSystemGL : public CRenderSystemBase

bool BeginRender() override;
bool EndRender() override;
void PresentRender(bool rendered) override;
void PresentRender(bool rendered, bool videoLayer) override;
bool ClearBuffers(color_t color) override;
bool IsExtSupported(const char* extension) override;

@@ -274,7 +274,7 @@ static int64_t abs64(int64_t a)
return a;
}

void CRenderSystemGLES::PresentRender(bool rendered)
void CRenderSystemGLES::PresentRender(bool rendered, bool videoLayer)
{
SetVSync(true);

@@ -283,7 +283,8 @@ void CRenderSystemGLES::PresentRender(bool rendered)

PresentRenderImpl(rendered);

if (!rendered)
// if video is rendered to a separate layer, we should not block this thread
if (!rendered && !videoLayer)
Sleep(40);
}

@@ -56,7 +56,7 @@ class CRenderSystemGLES : public CRenderSystemBase

bool BeginRender() override;
bool EndRender() override;
void PresentRender(bool rendered) override;
void PresentRender(bool rendered, bool videoLayer) override;
bool ClearBuffers(color_t color) override;
bool IsExtSupported(const char* extension) override;

@@ -72,6 +72,6 @@ void CSplash::Show()

//show it on screen
g_Windowing.EndRender();
g_graphicsContext.Flip(true);
g_graphicsContext.Flip(true, false);
g_graphicsContext.Unlock();
}
@@ -42,7 +42,7 @@ class CWinSystemWin32DX : public CWinSystemWin32, public CRenderSystemDX
virtual bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays);
virtual bool WindowedMode() { return CRenderSystemDX::m_useWindowedDX; }
virtual void NotifyAppFocusChange(bool bGaining);
virtual void PresentRender(bool rendererd);
virtual void PresentRender(bool rendererd, bool videoLayer);

std::string GetClipboardText(void);

0 comments on commit 005bc83

Please sign in to comment.
You can’t perform that action at this time.