xbmc: add patches to prefer yv12 output from crystalhd codec when running nouveau driver, remove old implementation - thanks much davilla

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-08-22 06:26:16 +02:00
parent e296c68d17
commit b83cc3c266
3 changed files with 200 additions and 12 deletions

View File

@ -0,0 +1,111 @@
diff -Naur xbmc-10.1-Dharma/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp.rej xbmc-10.1-Dharma.patch1/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp.rej
--- xbmc-10.1-Dharma/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp.rej 1970-01-01 01:00:00.000000000 +0100
+++ xbmc-10.1-Dharma.patch1/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp.rej 2011-08-22 05:09:40.801478536 +0200
@@ -0,0 +1,38 @@
+--- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
++++ xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
+@@ -20,6 +20,7 @@
+ */
+
+ #include "system.h"
++#include "windowing/WindowingFactory.h"
+ #include "settings/AdvancedSettings.h"
+ #include "settings/GUISettings.h"
+ #include "settings/Settings.h"
+@@ -829,16 +830,17 @@
+
+ if(pSource->format == DVDVideoPicture::FMT_YUV420P)
+ {
+-#ifdef _LINUX
+- // for now use cpu for ssa overlays as it currently allocates and
+- // frees textures for each frame this causes a hugh memory leak
+- // on some mesa intel drivers
+-
+- if(m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SPU)
+- || m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_IMAGE)
+- || m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SSA) )
+- render = OVERLAY_BUF;
+-#endif
++ if(g_Windowing.GetRenderQuirks() & RENDER_QUIRKS_MAJORMEMLEAK_OVERLAYRENDERER)
++ {
++ // for now use cpu for ssa overlays as it currently allocates and
++ // frees textures for each frame this causes a hugh memory leak
++ // on some mesa intel drivers
++
++ if(m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SPU)
++ || m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_IMAGE)
++ || m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SSA) )
++ render = OVERLAY_BUF;
++ }
+
+ if(render == OVERLAY_BUF)
+ {
diff -Naur xbmc-10.1-Dharma/xbmc/RenderSystem.cpp xbmc-10.1-Dharma.patch1/xbmc/RenderSystem.cpp
--- xbmc-10.1-Dharma/xbmc/RenderSystem.cpp 2011-03-08 02:49:14.000000000 +0100
+++ xbmc-10.1-Dharma.patch1/xbmc/RenderSystem.cpp 2011-08-22 05:10:30.353131282 +0200
@@ -29,6 +29,7 @@
m_RenderVersionMajor = 0;
m_RenderVersionMinor = 0;
m_renderCaps = 0;
+ m_renderQuirks = 0;
m_minDXTPitch = 0;
}
diff -Naur xbmc-10.1-Dharma/xbmc/RenderSystemGL.cpp xbmc-10.1-Dharma.patch1/xbmc/RenderSystemGL.cpp
--- xbmc-10.1-Dharma/xbmc/RenderSystemGL.cpp 2011-03-08 02:49:14.000000000 +0100
+++ xbmc-10.1-Dharma.patch1/xbmc/RenderSystemGL.cpp 2011-08-22 05:10:58.079496562 +0200
@@ -65,8 +65,22 @@
}
}
#endif
- if (m_RenderVendor.Equals("Tungsten Graphics, Inc."))
+ if (m_RenderVendor.Equals("Tungsten Graphics, Inc.")
+ || m_RenderVendor.Equals("Tungsten Graphics, Inc"))
{
+ unsigned major, minor, micro;
+ if(sscanf(m_RenderVersion.c_str(), "%*s Mesa %u.%u.%u", &major, &minor, &micro) == 3)
+ {
+
+ if((major < 7)
+ || (major == 7 && minor < 7)
+ || (major == 7 && minor == 7 && micro < 1))
+ m_renderQuirks |= RENDER_QUIRKS_MAJORMEMLEAK_OVERLAYRENDERER;
+
+ }
+ else
+ CLog::Log(LOGNOTICE, "CRenderSystemGL::CheckOpenGLQuirks - unable to parse mesa version string");
+
if(m_RenderRenderer.Find("Poulsbo") >= 0)
m_renderCaps &= ~RENDER_CAPS_DXT_NPOT;
}
diff -Naur xbmc-10.1-Dharma/xbmc/RenderSystem.h xbmc-10.1-Dharma.patch1/xbmc/RenderSystem.h
--- xbmc-10.1-Dharma/xbmc/RenderSystem.h 2011-03-08 02:49:14.000000000 +0100
+++ xbmc-10.1-Dharma.patch1/xbmc/RenderSystem.h 2011-08-22 05:10:38.495238548 +0200
@@ -52,6 +52,11 @@
RENDER_CAPS_DXT_NPOT = (1 << 2)
};
+enum
+{
+ RENDER_QUIRKS_MAJORMEMLEAK_OVERLAYRENDERER = 1 << 0,
+};
+
class CRenderSystemBase
{
public:
@@ -94,6 +99,7 @@
bool SupportsNPOT(bool dxt) const;
unsigned int GetMaxTextureSize() const { return m_maxTextureSize; }
unsigned int GetMinDXTPitch() const { return m_minDXTPitch; }
+ unsigned int GetRenderQuirks() const { return m_renderQuirks; }
protected:
bool m_bRenderCreated;
@@ -108,6 +114,7 @@
int m_RenderVersionMinor;
int m_RenderVersionMajor;
unsigned int m_renderCaps;
+ unsigned int m_renderQuirks;
};
#endif // RENDER_SYSTEM_H

View File

@ -0,0 +1,89 @@
diff -Naur xbmc-10.1-Dharma.patch1/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp xbmc-10.1-Dharma.patch2/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp
--- xbmc-10.1-Dharma.patch1/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp 2011-08-22 05:07:59.915149830 +0200
+++ xbmc-10.1-Dharma.patch2/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp 2011-08-22 05:19:43.825427880 +0200
@@ -39,6 +39,7 @@
#include "utils/fastmemcpy.h"
#include "Codecs/DllSwScale.h"
#include "utils/TimeUtils.h"
+#include "xbmc/WindowingFactory.h"
namespace BCM
{
@@ -233,6 +234,7 @@
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;
@@ -335,6 +337,12 @@
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()
@@ -773,15 +781,20 @@
if (!pBuffer)
{
// No free pre-allocated buffers so make one
-#ifdef _WIN32
- // 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 -Naur xbmc-10.1-Dharma.patch1/xbmc/RenderSystemGL.cpp xbmc-10.1-Dharma.patch2/xbmc/RenderSystemGL.cpp
--- xbmc-10.1-Dharma.patch1/xbmc/RenderSystemGL.cpp 2011-08-22 05:10:58.079496562 +0200
+++ xbmc-10.1-Dharma.patch2/xbmc/RenderSystemGL.cpp 2011-08-22 05:20:56.265383606 +0200
@@ -65,6 +65,9 @@
}
}
#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"))
{
diff -Naur xbmc-10.1-Dharma.patch1/xbmc/RenderSystem.h xbmc-10.1-Dharma.patch2/xbmc/RenderSystem.h
--- xbmc-10.1-Dharma.patch1/xbmc/RenderSystem.h 2011-08-22 05:10:38.495238548 +0200
+++ xbmc-10.1-Dharma.patch2/xbmc/RenderSystem.h 2011-08-22 05:19:43.847428169 +0200
@@ -57,6 +57,11 @@
RENDER_QUIRKS_MAJORMEMLEAK_OVERLAYRENDERER = 1 << 0,
};
+enum
+{
+ RENDER_QUIRKS_YV12_PREFERED = 1 << 1,
+};
+
class CRenderSystemBase
{
public:

View File

@ -1,12 +0,0 @@
diff -Naur xbmc-Dharma-10.1-c8405db/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp xbmc-Dharma-10.1-c8405db.patch/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp
--- xbmc-Dharma-10.1-c8405db/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp 2011-02-15 13:30:12.000000000 +0100
+++ xbmc-Dharma-10.1-c8405db.patch/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp 2011-02-15 14:08:59.000292217 +0100
@@ -773,7 +773,7 @@
if (!pBuffer)
{
// No free pre-allocated buffers so make one
-#ifdef _WIN32
+#if 1
// force Windows to use YV12 until DX renderer gets NV12 or YUY2 capability.
pBuffer = new CPictureBuffer(DVDVideoPicture::FMT_YUV420P, m_width, m_height);
#else