Skip to content

Commit

Permalink
[chd] fixed, prefer yv12 output from crystalhd codec when running nou…
Browse files Browse the repository at this point in the history
…veau driver, it has slow NV12 or YUY2 capability
  • Loading branch information
davilla committed Aug 22, 2011
1 parent 236bd8f commit dee97a5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
28 changes: 20 additions & 8 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp
Expand Up @@ -37,6 +37,7 @@
#include "utils/fastmemcpy.h"
#include "DllSwScale.h"
#include "utils/TimeUtils.h"
#include "windowing/WindowingFactory.h"

namespace BCM
{
Expand Down Expand Up @@ -231,6 +232,7 @@ class CMPCOutputThread : public CThread
int m_width;
int m_height;
uint64_t m_timestamp;
bool m_output_YV12;
uint64_t m_PictureNumber;
uint8_t m_color_space;
unsigned int m_color_range;
Expand Down Expand Up @@ -333,6 +335,12 @@ CMPCOutputThread::CMPCOutputThread(void *device, DllLibCrystalHD *dll, bool has_
m_sw_scale_ctx = NULL;
m_dllSwScale = new DllSwScale;
m_dllSwScale->Load();


if (g_Windowing.GetRenderQuirks() & RENDER_QUIRKS_YV12_PREFERED)
m_output_YV12 = true;
else
m_output_YV12 = false;
}

CMPCOutputThread::~CMPCOutputThread()
Expand Down Expand Up @@ -771,15 +779,19 @@ bool CMPCOutputThread::GetDecoderOutput(void)
if (!pBuffer)
{
// No free pre-allocated buffers so make one
#if 0
// force Windows to use YV12 until DX renderer gets NV12 or YUY2 capability.
pBuffer = new CPictureBuffer(DVDVideoPicture::FMT_YUV420P, m_width, m_height);
#else
if (m_color_space == BCM::MODE422_YUY2)
pBuffer = new CPictureBuffer(DVDVideoPicture::FMT_YUY2, m_width, m_height);
if (m_output_YV12)
{
// output YV12, nouveau driver has slow NV12, YUY2 capability.
pBuffer = new CPictureBuffer(DVDVideoPicture::FMT_YUV420P, m_width, m_height);
}
else
pBuffer = new CPictureBuffer(DVDVideoPicture::FMT_NV12, m_width, m_height);
#endif
{
if (m_color_space == BCM::MODE422_YUY2)
pBuffer = new CPictureBuffer(DVDVideoPicture::FMT_YUY2, m_width, m_height);
else
pBuffer = new CPictureBuffer(DVDVideoPicture::FMT_NV12, m_width, m_height);
}

CLog::Log(LOGDEBUG, "%s: Added a new Buffer, ReadyListCount: %d", __MODULE_NAME__, m_ReadyList.Count());
while (!m_bStop && m_ReadyList.Count() > 10)
Sleep(1);
Expand Down
1 change: 1 addition & 0 deletions xbmc/rendering/RenderSystem.h
Expand Up @@ -57,6 +57,7 @@ enum
enum
{
RENDER_QUIRKS_MAJORMEMLEAK_OVERLAYRENDERER = 1 << 0,
RENDER_QUIRKS_YV12_PREFERED = 1 << 1,
};

class CRenderSystemBase
Expand Down
3 changes: 3 additions & 0 deletions xbmc/rendering/gl/RenderSystemGL.cpp
Expand Up @@ -66,6 +66,9 @@ void CRenderSystemGL::CheckOpenGLQuirks()
}
}
#endif
if (m_RenderVendor.ToLower() == "nouveau")
m_renderQuirks |= RENDER_QUIRKS_YV12_PREFERED;

if (m_RenderVendor.Equals("Tungsten Graphics, Inc.")
|| m_RenderVendor.Equals("Tungsten Graphics, Inc"))
{
Expand Down

0 comments on commit dee97a5

Please sign in to comment.