Skip to content

Commit

Permalink
renderer: rename/correct GetProcessorSize, processor is not exposed a…
Browse files Browse the repository at this point in the history
…nymore
  • Loading branch information
FernetMenta committed Sep 19, 2014
1 parent 0d687ed commit bb1a5d1
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 30 deletions.
2 changes: 1 addition & 1 deletion xbmc/cores/VideoRenderers/BaseRenderer.h
Expand Up @@ -89,7 +89,7 @@ class CBaseRenderer
/**
* Returns number of references a single buffer can retain when rendering a single frame
*/
virtual unsigned int GetProcessorSize() { return 0; }
virtual unsigned int GetOptimalBufferSize() { return 0; }
virtual unsigned int GetMaxBufferSize() { return 0; }
virtual void SetBufferSize(int numBuffers) { }
virtual void ReleaseBuffer(int idx) { }
Expand Down
14 changes: 5 additions & 9 deletions xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
Expand Up @@ -3496,16 +3496,12 @@ void CLinuxRendererGL::UnBindPbo(YUVBUFFER& buff)
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
}

unsigned int CLinuxRendererGL::GetProcessorSize()
{
if(m_format == RENDER_FMT_VDPAU
|| m_format == RENDER_FMT_VDPAU_420
|| m_format == RENDER_FMT_VAAPI
|| m_format == RENDER_FMT_VAAPINV12
|| m_format == RENDER_FMT_CVBREF)
return 1;
unsigned int CLinuxRendererGL::GetOptimalBufferSize()
{
if(m_format == RENDER_FMT_CVBREF)
return 2;
else
return 0;
return 3;
}

#ifdef HAVE_LIBVDPAU
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoRenderers/LinuxRendererGL.h
Expand Up @@ -136,7 +136,7 @@ class CLinuxRendererGL : public CBaseRenderer
virtual void ReleaseBuffer(int idx);
virtual void SetBufferSize(int numBuffers) { m_NumYV12Buffers = numBuffers; }
virtual unsigned int GetMaxBufferSize() { return NUM_BUFFERS; }
virtual unsigned int GetProcessorSize();
virtual unsigned int GetOptimalBufferSize();

#ifdef HAVE_LIBVDPAU
virtual void AddProcessor(VDPAU::CVdpauRenderPicture* vdpau, int index);
Expand Down
10 changes: 2 additions & 8 deletions xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp
Expand Up @@ -2893,15 +2893,9 @@ EINTERLACEMETHOD CLinuxRendererGLES::AutoInterlaceMethod()
#endif
}

unsigned int CLinuxRendererGLES::GetProcessorSize()
unsigned int CLinuxRendererGLES::GetOptimalBufferSize()
{
if(m_format == RENDER_FMT_OMXEGL
|| m_format == RENDER_FMT_CVBREF
|| m_format == RENDER_FMT_EGLIMG
|| m_format == RENDER_FMT_MEDIACODEC)
return 1;
else
return 0;
return 2;
}

#ifdef HAVE_LIBOPENMAX
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoRenderers/LinuxRendererGLES.h
Expand Up @@ -143,7 +143,7 @@ class CLinuxRendererGLES : public CBaseRenderer
virtual void ReleaseBuffer(int idx);
virtual void SetBufferSize(int numBuffers) { m_NumYV12Buffers = numBuffers; }
virtual unsigned int GetMaxBufferSize() { return NUM_BUFFERS; }
virtual unsigned int GetProcessorSize();
virtual unsigned int GetOptimalBufferSize();

virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255);

Expand Down
14 changes: 9 additions & 5 deletions xbmc/cores/VideoRenderers/RenderManager.cpp
Expand Up @@ -261,14 +261,14 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi
lock2.Enter();
m_format = format;

int processor = m_pRenderer->GetProcessorSize();
m_QueueSize = std::min(buffers, processor);
int renderbuffers = m_pRenderer->GetOptimalBufferSize();
m_QueueSize = std::min(buffers, renderbuffers);
m_QueueSize = std::min(m_QueueSize, (int)m_pRenderer->GetMaxBufferSize());
m_QueueSize = std::min(m_QueueSize, NUM_BUFFERS);
if(m_QueueSize < 2)
{
m_QueueSize = 2;
CLog::Log(LOGWARNING, "CXBMCRenderManager::Configure - queue size too small (%d, %d, %d)", m_QueueSize, processor, buffers);
CLog::Log(LOGWARNING, "CXBMCRenderManager::Configure - queue size too small (%d, %d, %d)", m_QueueSize, renderbuffers, buffers);
}

m_pRenderer->SetBufferSize(m_QueueSize);
Expand Down Expand Up @@ -855,10 +855,14 @@ void CXBMCRenderManager::UpdateResolution()
}


unsigned int CXBMCRenderManager::GetProcessorSize()
unsigned int CXBMCRenderManager::GetOptimalBufferSize()
{
CSharedLock lock(m_sharedSection);
return std::max(4, NUM_BUFFERS);
if (!m_pRenderer)
{
CLog::Log(LOGERROR, "%s - renderer is NULL", __FUNCTION__);
}
return m_pRenderer->GetMaxBufferSize();
}

// Supported pixel formats, can be called before configure
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoRenderers/RenderManager.h
Expand Up @@ -153,7 +153,7 @@ class CXBMCRenderManager
CLinuxRenderer *m_pRenderer;
#endif

unsigned int GetProcessorSize();
unsigned int GetOptimalBufferSize();

// Supported pixel formats, can be called before configure
std::vector<ERenderFormat> SupportedFormats();
Expand Down
4 changes: 2 additions & 2 deletions xbmc/cores/VideoRenderers/WinRenderer.cpp
Expand Up @@ -1311,12 +1311,12 @@ EINTERLACEMETHOD CWinRenderer::AutoInterlaceMethod()
return VS_INTERLACEMETHOD_DEINTERLACE_HALF;
}

unsigned int CWinRenderer::GetProcessorSize()
unsigned int CWinRenderer::GetOptimalBufferSize()
{
if (m_format == RENDER_FMT_DXVA && m_processor)
return m_processor->Size();
else
return 0;
return 2;
}

void CWinRenderer::ReleaseBuffer(int idx)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoRenderers/WinRenderer.h
Expand Up @@ -168,7 +168,7 @@ class CWinRenderer : public CBaseRenderer

void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255);

virtual unsigned int GetProcessorSize();
virtual unsigned int GetOptimalBufferSize();
virtual void SetBufferSize(int numBuffers) { m_neededBuffers = numBuffers; }
virtual unsigned int GetMaxBufferSize() { return NUM_BUFFERS; }
virtual void ReleaseBuffer(int idx);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
Expand Up @@ -186,7 +186,7 @@ bool CDVDPlayerVideo::OpenStream( CDVDStreamInfo &hint )
unsigned int surfaces = 0;
std::vector<ERenderFormat> formats;
#ifdef HAS_VIDEO_PLAYBACK
surfaces = g_renderManager.GetProcessorSize();
surfaces = g_renderManager.GetOptimalBufferSize();
formats = g_renderManager.SupportedFormats();
#endif

Expand Down

0 comments on commit bb1a5d1

Please sign in to comment.