diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp index 9ddd71851a387..ec1d6a888db6e 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp @@ -37,6 +37,7 @@ #include "utils/fastmemcpy.h" #include "DllSwScale.h" #include "utils/TimeUtils.h" +#include "windowing/WindowingFactory.h" namespace BCM { @@ -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; @@ -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() @@ -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); diff --git a/xbmc/rendering/RenderSystem.h b/xbmc/rendering/RenderSystem.h index dad0c5c8abdae..1a8f94e4f577d 100644 --- a/xbmc/rendering/RenderSystem.h +++ b/xbmc/rendering/RenderSystem.h @@ -57,6 +57,7 @@ enum enum { RENDER_QUIRKS_MAJORMEMLEAK_OVERLAYRENDERER = 1 << 0, + RENDER_QUIRKS_YV12_PREFERED = 1 << 1, }; class CRenderSystemBase diff --git a/xbmc/rendering/gl/RenderSystemGL.cpp b/xbmc/rendering/gl/RenderSystemGL.cpp index 66274d6c6557c..ae1b3dd68da2b 100644 --- a/xbmc/rendering/gl/RenderSystemGL.cpp +++ b/xbmc/rendering/gl/RenderSystemGL.cpp @@ -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")) {