diff --git a/packages/mediacenter/xbmc/patches/xbmc-10.1-Dharma-332-fix_VAAPI_ticket_10928-0.1.patch b/packages/mediacenter/xbmc/patches/xbmc-10.1-Dharma-332-fix_VAAPI_ticket_10928-0.1.patch new file mode 100644 index 0000000000..22c3737778 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/xbmc-10.1-Dharma-332-fix_VAAPI_ticket_10928-0.1.patch @@ -0,0 +1,72 @@ +From 76b51cce5dd64d6f33348cd36eddce95d571f783 Mon Sep 17 00:00:00 2001 +From: Yuriy Romanenko +Date: Thu, 24 Feb 2011 12:03:53 +0200 +Subject: [PATCH] linux: VAAPI fix from bug #10928 + http://trac.xbmc.org/ticket/10928 + +Signed-off-by: Joakim Plate +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 20 ++++++++++++++------ + 1 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +index 0aac8fe..b03ea5c 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +@@ -149,10 +149,10 @@ int CDecoder::GetBuffer(AVCodecContext *avctx, AVFrame *pic) + { + VASurfaceID surface = GetSurfaceID(pic); + CSurface* wrapper = NULL; ++ std::list::iterator it = m_surfaces_free.begin(); + if(surface) + { + /* reget call */ +- std::list::iterator it = m_surfaces_free.begin(); + for(; it != m_surfaces_free.end(); it++) + { + if((*it)->m_id == surface) +@@ -171,20 +171,28 @@ int CDecoder::GetBuffer(AVCodecContext *avctx, AVFrame *pic) + } + else + { +- if(m_surfaces_free.empty()) ++ // To avoid stutter, we scan the free surface pool (provided by decoder) for surfaces ++ // that are 100% not in use by renderer. The pointers to these surfaces have a use_count of 1. ++ for (; it != m_surfaces_free.end() && it->use_count() > 1; it++) {} ++ ++ // If we have zero free surface from decoder OR all free surfaces are in use by renderer, we allocate a new surface ++ if (it == m_surfaces_free.end()) + { ++ if (!m_surfaces_free.empty()) CLog::Log(LOGERROR, "VAAPI - renderer still using all freed up surfaces by decoder"); + CLog::Log(LOGERROR, "VAAPI - unable to find free surface, trying to allocate a new one"); + if(!EnsureSurfaces(avctx, m_surfaces_count+1) || m_surfaces_free.empty()) + { + CLog::Log(LOGERROR, "VAAPI - unable to find free surface"); + return -1; + } ++ // Set itarator position to the newly allocated surface (end-1) ++ it = m_surfaces_free.end(); it--; + } + /* getbuffer call */ +- wrapper = m_surfaces_free.front().get(); ++ wrapper = it->get(); + surface = wrapper->m_id; +- m_surfaces_used.push_back(m_surfaces_free.front()); +- m_surfaces_free.pop_front(); ++ m_surfaces_used.push_back(*it); ++ m_surfaces_free.erase(it); + } + + pic->type = FF_BUFFER_TYPE_USER; +@@ -349,7 +357,7 @@ bool CDecoder::EnsureContext(AVCodecContext *avctx) + else + m_refs = 2; + } +- return EnsureSurfaces(avctx, m_refs + 1 + 1); ++ return EnsureSurfaces(avctx, m_refs + 3); + } + + bool CDecoder::EnsureSurfaces(AVCodecContext *avctx, unsigned n_surfaces_count) +-- +1.7.5.4 + diff --git a/packages/mediacenter/xbmc/patches/xbmc-10.1-Dharma-333-fix_NULL_conversion_warnings_in_VAAPI-0.1.patch b/packages/mediacenter/xbmc/patches/xbmc-10.1-Dharma-333-fix_NULL_conversion_warnings_in_VAAPI-0.1.patch new file mode 100644 index 0000000000..84465aad02 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/xbmc-10.1-Dharma-333-fix_NULL_conversion_warnings_in_VAAPI-0.1.patch @@ -0,0 +1,50 @@ +From acef66ba6f0bf1db31906c7c7c4f7c83cfee44c1 Mon Sep 17 00:00:00 2001 +From: Kyle Hill +Date: Sat, 14 May 2011 17:23:45 -0500 +Subject: [PATCH] Fix NULL -> 0 conversion warnings in VAAPI.cpp + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 10 +++++----- + 1 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +index b03ea5c..d9d2bd2 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +@@ -115,8 +115,8 @@ CDecoder::CDecoder() + { + m_refs = 0; + m_surfaces_count = 0; +- m_config = NULL; +- m_context = NULL; ++ m_config = 0; ++ m_context = 0; + m_hwaccel = (vaapi_context*)calloc(1, sizeof(vaapi_context)); + } + +@@ -212,11 +212,11 @@ void CDecoder::Close() + { + if(m_context) + WARN(vaDestroyContext(m_display->get(), m_context)) +- m_context = NULL; ++ m_context = 0; + + if(m_config) + WARN(vaDestroyConfig(m_display->get(), m_config)) +- m_config = NULL; ++ m_config = 0; + + m_surfaces_free.clear(); + m_surfaces_used.clear(); +@@ -384,7 +384,7 @@ bool CDecoder::EnsureSurfaces(AVCodecContext *avctx, unsigned n_surfaces_count) + + if(m_context) + WARN(vaDestroyContext(m_display->get(), m_context)) +- m_context = NULL; ++ m_context = 0; + + CHECK(vaCreateContext(m_display->get() + , m_config +-- +1.7.5.4 +