diff --git a/packages/mediacenter/xbmc/patches/xbmc-999.91-PR5202.patch b/packages/mediacenter/xbmc/patches/xbmc-999.91-PR5202.patch index c27c655cc3..c3612f7abe 100644 --- a/packages/mediacenter/xbmc/patches/xbmc-999.91-PR5202.patch +++ b/packages/mediacenter/xbmc/patches/xbmc-999.91-PR5202.patch @@ -1,31 +1,29 @@ -From 13b9c7491eca92e94ee52dd8c0dbecfdd34436b6 Mon Sep 17 00:00:00 2001 +From 1f7bf1d1451027f0ae9277cdaaea0c1ab6650864 Mon Sep 17 00:00:00 2001 From: "Chris \"Koying\" Browet" Date: Thu, 7 Aug 2014 13:46:49 +0200 -Subject: [PATCH 1/3] ADD: Freescale i.MX6 h/w codec +Subject: [PATCH 1/2] ADD: Freescale i.MX6 h/w codec --- configure.in | 13 +- - xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 256 ++++ - xbmc/cores/VideoRenderers/LinuxRendererGLES.h | 11 +- + xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 244 +++++ + xbmc/cores/VideoRenderers/LinuxRendererGLES.h | 14 +- xbmc/cores/VideoRenderers/RenderFormats.h | 1 + xbmc/cores/VideoRenderers/RenderManager.cpp | 4 + - xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 18 +- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 6 + - .../dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 1477 ++++++++++++++++++++ - .../dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 216 +++ - .../dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h | 38 + + xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 16 +- + .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 8 + + .../dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 1083 ++++++++++++++++++++ + .../dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 151 +++ xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 3 + xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + - 12 files changed, 2041 insertions(+), 3 deletions(-) + 11 files changed, 1535 insertions(+), 3 deletions(-) create mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp create mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h - create mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h diff --git a/configure.in b/configure.in -index fb02f14..c8a9ce2 100644 +index 725a271..e364551 100644 --- a/configure.in +++ b/configure.in -@@ -515,7 +515,7 @@ AC_ARG_ENABLE([gtest], +@@ -542,7 +542,7 @@ AC_ARG_ENABLE([gtest], AC_ARG_ENABLE([codec], [AS_HELP_STRING([--enable-codec], @@ -34,7 +32,7 @@ index fb02f14..c8a9ce2 100644 [add_codecs=$enableval], [add_codecs=no]) -@@ -1943,6 +1943,17 @@ for codecs in `echo $add_codecs | sed 's/,/ /g'`; do +@@ -1901,6 +1901,17 @@ for codecs in `echo $add_codecs | sed 's/,/ /g'`; do *libstagefright*) XB_ADD_CODEC([LIBSTAGEFRIGHT], [libstagefright], [$codecs]) ;; @@ -48,12 +46,12 @@ index fb02f14..c8a9ce2 100644 + CXXFLAGS="$CXXFLAGS -DEGL_API_FB" + CFLAGS="$CFLAGS -DEGL_API_FB" + fi -+ ;; ++ ;; *) esac done diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -index 72eb725..9e32a69 100644 +index 72eb725..8db4ea1 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp @@ -79,6 +79,17 @@ static PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR; @@ -74,15 +72,17 @@ index 72eb725..9e32a69 100644 #if defined(TARGET_ANDROID) #include "DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h" #endif -@@ -103,6 +114,7 @@ CLinuxRendererGLES::YUVBUFFER::YUVBUFFER() +@@ -103,6 +114,9 @@ CLinuxRendererGLES::YUVBUFFER::YUVBUFFER() #if defined(TARGET_ANDROID) mediacodec = NULL; #endif -+ codecinfo = NULL; ++#ifdef HAS_IMXVPU ++ IMXBuffer = NULL; ++#endif } CLinuxRendererGLES::YUVBUFFER::~YUVBUFFER() -@@ -153,6 +165,12 @@ CLinuxRendererGLES::CLinuxRendererGLES() +@@ -153,6 +167,12 @@ CLinuxRendererGLES::CLinuxRendererGLES() if (!glEGLImageTargetTexture2DOES) glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) CEGLWrapper::GetProcAddress("glEGLImageTargetTexture2DOES"); #endif @@ -95,7 +95,7 @@ index 72eb725..9e32a69 100644 } CLinuxRendererGLES::~CLinuxRendererGLES() -@@ -279,6 +297,10 @@ int CLinuxRendererGLES::GetImage(YV12Image *image, int source, bool readonly) +@@ -279,6 +299,10 @@ int CLinuxRendererGLES::GetImage(YV12Image *image, int source, bool readonly) { return source; } @@ -106,7 +106,7 @@ index 72eb725..9e32a69 100644 #ifdef HAVE_VIDEOTOOLBOXDECODER if (m_renderMethod & RENDER_CVREF ) -@@ -604,6 +626,9 @@ unsigned int CLinuxRendererGLES::PreInit() +@@ -604,6 +628,9 @@ unsigned int CLinuxRendererGLES::PreInit() #if defined(TARGET_ANDROID) m_formats.push_back(RENDER_FMT_MEDIACODEC); #endif @@ -116,7 +116,7 @@ index 72eb725..9e32a69 100644 // setup the background colour m_clearColour = (float)(g_advancedSettings.m_videoBlackBarColour & 0xff) / 0xff; -@@ -711,6 +736,12 @@ void CLinuxRendererGLES::LoadShaders(int field) +@@ -711,6 +738,12 @@ void CLinuxRendererGLES::LoadShaders(int field) m_renderMethod = RENDER_MEDIACODEC; break; } @@ -129,7 +129,7 @@ index 72eb725..9e32a69 100644 else if (m_format == RENDER_FMT_BYPASS) { CLog::Log(LOGNOTICE, "GL: Using BYPASS render method"); -@@ -803,6 +834,12 @@ void CLinuxRendererGLES::LoadShaders(int field) +@@ -803,6 +836,12 @@ void CLinuxRendererGLES::LoadShaders(int field) m_textureCreate = &CLinuxRendererGLES::CreateNV12Texture; m_textureDelete = &CLinuxRendererGLES::DeleteNV12Texture; } @@ -142,7 +142,24 @@ index 72eb725..9e32a69 100644 else { // default to YV12 texture handlers -@@ -954,6 +991,10 @@ void CLinuxRendererGLES::Render(DWORD flags, int index) +@@ -893,6 +932,16 @@ void CLinuxRendererGLES::ReleaseBuffer(int idx) + } + } + #endif ++#ifdef HAS_IMXVPU ++ if (m_renderMethod & RENDER_IMXMAP) ++ { ++ if (buf.IMXBuffer) ++ { ++ SAFE_RELEASE(buf.IMXBuffer); ++ buf.IMXBuffer = NULL; ++ } ++ } ++#endif + } + + void CLinuxRendererGLES::Render(DWORD flags, int index) +@@ -954,6 +1003,10 @@ void CLinuxRendererGLES::Render(DWORD flags, int index) { RenderSurfaceTexture(index, m_currentField); } @@ -153,7 +170,7 @@ index 72eb725..9e32a69 100644 else { RenderSoftware(index, m_currentField); -@@ -1580,6 +1621,85 @@ void CLinuxRendererGLES::RenderCoreVideoRef(int index, int field) +@@ -1580,6 +1633,85 @@ void CLinuxRendererGLES::RenderCoreVideoRef(int index, int field) #endif } @@ -165,13 +182,13 @@ index 72eb725..9e32a69 100644 +#endif + + YUVPLANE &plane = m_buffers[index].fields[field][0]; -+ CDVDVideoCodecBuffer* codecinfo = m_buffers[index].codecinfo; ++ CDVDVideoCodecIMXBuffer *buffer = m_buffers[index].IMXBuffer; + -+ if(codecinfo == NULL) return; ++ if(buffer == NULL) return; + + CDVDVideoCodecIMX::Enter(); + -+ if(!codecinfo->IsValid()) ++ if(!buffer->IsValid()) + { + CDVDVideoCodecIMX::Leave(); + return; @@ -239,7 +256,7 @@ index 72eb725..9e32a69 100644 bool CLinuxRendererGLES::RenderCapture(CRenderCapture* capture) { if (!m_bValidated) -@@ -2510,6 +2630,114 @@ void CLinuxRendererGLES::SetTextureFilter(GLenum method) +@@ -2510,6 +2642,96 @@ void CLinuxRendererGLES::SetTextureFilter(GLenum method) } } @@ -250,65 +267,45 @@ index 72eb725..9e32a69 100644 +{ +#ifdef HAS_IMXVPU + YUVBUFFER& buf = m_buffers[index]; -+ CDVDVideoCodecBuffer* codecinfo = buf.codecinfo; ++ CDVDVideoCodecIMXBuffer* IMXBuffer = buf.IMXBuffer; + -+ if(codecinfo) ++ if(IMXBuffer) + { + CDVDVideoCodecIMX::Enter(); + -+ if(!codecinfo->IsValid()) ++ if(!IMXBuffer->IsValid()) + { + CDVDVideoCodecIMX::Leave(); + return; + } + + YUVPLANE &plane = m_buffers[index].fields[0][0]; -+ CDVDVideoCodecIPUBuffers *deinterlacer = (CDVDVideoCodecIPUBuffers*)codecinfo->data[2]; -+ -+ if (deinterlacer) -+ { -+ EDEINTERLACEMODE deinterlacemode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; -+ -+ if (deinterlacemode != VS_DEINTERLACEMODE_OFF) -+ { -+ CDVDVideoCodecBuffer *deint; -+ EINTERLACEMETHOD interlacemethod = CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod; -+ deint = deinterlacer->Process(codecinfo, (VpuFieldType)(int)codecinfo->data[3], -+ interlacemethod == VS_INTERLACEMETHOD_DEINTERLACE); -+ if (deint) -+ { -+ SAFE_RELEASE(buf.codecinfo); -+ buf.codecinfo = deint; -+ buf.codecinfo->Lock(); -+ codecinfo = buf.codecinfo; -+ } -+ } -+ } + + glActiveTexture(GL_TEXTURE0); + glBindTexture(m_textureTarget, plane.id); + + GLuint physical = ~0U; -+ GLvoid *virt = (GLvoid*)codecinfo->data[0]; -+ glTexDirectVIVMap(m_textureTarget, codecinfo->iWidth, codecinfo->iHeight, GL_VIV_NV12, ++ GLvoid *virt = (GLvoid*)IMXBuffer->m_VirtAddr; ++ glTexDirectVIVMap(m_textureTarget, IMXBuffer->m_iWidth, IMXBuffer->m_iHeight, GL_VIV_NV12, + (GLvoid **)&virt, &physical); + glTexDirectInvalidateVIV(m_textureTarget); + + glBindTexture(m_textureTarget, 0); + + plane.flipindex = m_buffers[index].flipindex; -+ plane.texwidth = codecinfo->iWidth; -+ plane.texheight = codecinfo->iHeight; ++ plane.texwidth = IMXBuffer->m_iWidth; ++ plane.texheight = IMXBuffer->m_iHeight; + + CalculateTextureSourceRects(index, 1); + + CDVDVideoCodecIMX::Leave(); + } -+ +#endif +} ++ +void CLinuxRendererGLES::DeleteIMXMAPTexture(int index) +{ ++#ifdef HAS_IMXVPU + YUVBUFFER &buf = m_buffers[index]; + YUVPLANE &plane = buf.fields[0][0]; + @@ -316,8 +313,10 @@ index 72eb725..9e32a69 100644 + glDeleteTextures(1, &plane.id); + plane.id = 0; + -+ SAFE_RELEASE(buf.codecinfo); ++ SAFE_RELEASE(buf.IMXBuffer); ++#endif +} ++ +bool CLinuxRendererGLES::CreateIMXMAPTexture(int index) +{ + YV12Image &im = m_buffers[index].image; @@ -354,77 +353,60 @@ index 72eb725..9e32a69 100644 bool CLinuxRendererGLES::Supports(ERENDERFEATURE feature) { // Player controls render, let it dictate available render features -@@ -2576,9 +2804,14 @@ bool CLinuxRendererGLES::Supports(EDEINTERLACEMODE mode) +@@ -2576,6 +2798,9 @@ bool CLinuxRendererGLES::Supports(EDEINTERLACEMODE mode) if(m_renderMethod & RENDER_CVREF) return false; -+#ifdef HAS_IMXVPU -+ if(mode == VS_DEINTERLACEMODE_AUTO) -+ return true; -+#else ++ if(m_renderMethod & RENDER_IMXMAP) ++ return false; ++ if(mode == VS_DEINTERLACEMODE_AUTO || mode == VS_DEINTERLACEMODE_FORCE) return true; -+#endif +@@ -2604,6 +2829,9 @@ bool CLinuxRendererGLES::Supports(EINTERLACEMETHOD method) + if(m_renderMethod & RENDER_CVREF) + return false; - return false; - } -@@ -2607,6 +2840,15 @@ bool CLinuxRendererGLES::Supports(EINTERLACEMETHOD method) ++ if(m_renderMethod & RENDER_IMXMAP) ++ return false; ++ if(method == VS_INTERLACEMETHOD_AUTO) return true; -+ if(m_renderMethod & RENDER_IMXMAP) -+ { -+ if(method == VS_INTERLACEMETHOD_DEINTERLACE -+ || method == VS_INTERLACEMETHOD_DEINTERLACE_HALF) -+ return true; -+ else -+ return false; -+ } -+ - #if defined(__i386__) || defined(__x86_64__) - if(method == VS_INTERLACEMETHOD_DEINTERLACE - || method == VS_INTERLACEMETHOD_DEINTERLACE_HALF -@@ -2655,6 +2897,9 @@ EINTERLACEMETHOD CLinuxRendererGLES::AutoInterlaceMethod() +@@ -2655,6 +2883,9 @@ EINTERLACEMETHOD CLinuxRendererGLES::AutoInterlaceMethod() if(m_renderMethod & RENDER_CVREF) return VS_INTERLACEMETHOD_NONE; + if(m_renderMethod & RENDER_IMXMAP) -+ return VS_INTERLACEMETHOD_DEINTERLACE_HALF; ++ return VS_INTERLACEMETHOD_NONE; + #if defined(__i386__) || defined(__x86_64__) return VS_INTERLACEMETHOD_DEINTERLACE_HALF; #else -@@ -2739,5 +2984,16 @@ void CLinuxRendererGLES::AddProcessor(CDVDMediaCodecInfo *mediacodec, int index) +@@ -2739,5 +2970,18 @@ void CLinuxRendererGLES::AddProcessor(CDVDMediaCodecInfo *mediacodec, int index) } #endif -+void CLinuxRendererGLES::AddProcessor(CDVDVideoCodecBuffer *codecinfo, int index) ++#ifdef HAS_IMXVPU ++void CLinuxRendererGLES::AddProcessor(CDVDVideoCodecIMXBuffer *buffer, int index) +{ + YUVBUFFER &buf = m_buffers[index]; + -+ SAFE_RELEASE(buf.codecinfo); -+ buf.codecinfo = codecinfo; ++ SAFE_RELEASE(buf.IMXBuffer); ++ buf.IMXBuffer = buffer; + -+ if (codecinfo) -+ codecinfo->Lock(); ++ if (buffer) ++ buffer->Lock(); +} ++#endif + #endif diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -index 642cded..54f0c18 100644 +index 642cded..1e89ecf 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -@@ -33,6 +33,7 @@ - #include "guilib/GraphicContext.h" - #include "BaseRenderer.h" - #include "xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h" -+#include "xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h" - - class CRenderCapture; - -@@ -89,7 +90,8 @@ enum RenderMethod +@@ -89,7 +89,8 @@ enum RenderMethod RENDER_CVREF = 0x080, RENDER_BYPASS = 0x100, RENDER_EGLIMG = 0x200, @@ -434,15 +416,17 @@ index 642cded..54f0c18 100644 }; enum RenderQuality -@@ -170,6 +172,7 @@ class CLinuxRendererGLES : public CBaseRenderer +@@ -170,6 +171,9 @@ class CLinuxRendererGLES : public CBaseRenderer // mediaCodec virtual void AddProcessor(CDVDMediaCodecInfo *mediacodec, int index); #endif -+ virtual void AddProcessor(CDVDVideoCodecBuffer *codecinfo, int index); ++#ifdef HAS_IMXVPU ++ virtual void AddProcessor(CDVDVideoCodecIMXBuffer *codecinfo, int index); ++#endif protected: virtual void Render(DWORD flags, int index); -@@ -209,6 +212,10 @@ class CLinuxRendererGLES : public CBaseRenderer +@@ -209,6 +213,10 @@ class CLinuxRendererGLES : public CBaseRenderer void DeleteSurfaceTexture(int index); bool CreateSurfaceTexture(int index); @@ -453,7 +437,7 @@ index 642cded..54f0c18 100644 void CalculateTextureSourceRects(int source, int num_planes); // renderers -@@ -219,6 +226,7 @@ class CLinuxRendererGLES : public CBaseRenderer +@@ -219,6 +227,7 @@ class CLinuxRendererGLES : public CBaseRenderer void RenderEglImage(int index, int field); // Android OES texture void RenderCoreVideoRef(int index, int field); // CoreVideo reference void RenderSurfaceTexture(int index, int field);// MediaCodec rendering using SurfaceTexture @@ -461,11 +445,13 @@ index 642cded..54f0c18 100644 CFrameBufferObject m_fbo; -@@ -285,6 +293,7 @@ class CLinuxRendererGLES : public CBaseRenderer +@@ -285,6 +294,9 @@ class CLinuxRendererGLES : public CBaseRenderer // mediacodec CDVDMediaCodecInfo *mediacodec; #endif -+ CDVDVideoCodecBuffer *codecinfo; ++#ifdef HAS_IMXVPU ++ CDVDVideoCodecIMXBuffer *IMXBuffer; ++#endif }; typedef YUVBUFFER YUVBUFFERS[NUM_BUFFERS]; @@ -482,7 +468,7 @@ index f15e80d..a8b8bd0 100644 #endif diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index b6fb1a3..6598e00 100644 +index b6fb1a3..101d1c7 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -932,6 +932,10 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) @@ -491,13 +477,13 @@ index b6fb1a3..6598e00 100644 #endif +#ifdef HAS_IMXVPU + else if(pic.format == RENDER_FMT_IMXMAP) -+ m_pRenderer->AddProcessor(pic.codecinfo, index); ++ m_pRenderer->AddProcessor(pic.IMXBuffer, index); +#endif m_pRenderer->ReleaseImage(index, false); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index 32d58d4..048bd92 100644 +index 181d755..f8a5635 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp @@ -36,6 +36,9 @@ @@ -508,9 +494,9 @@ index 32d58d4..048bd92 100644 +#include "Video/DVDVideoCodecIMX.h" +#endif #include "Video/DVDVideoCodecStageFright.h" - #if defined(HAVE_LIBCRYSTALHD) - #include "Video/DVDVideoCodecCrystalHD.h" -@@ -189,7 +192,11 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne + #if defined(HAS_LIBAMCODEC) + #include "utils/AMLUtils.h" +@@ -181,7 +184,11 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne #elif defined(TARGET_POSIX) && !defined(TARGET_DARWIN) hwSupport += "VAAPI:no "; #endif @@ -519,45 +505,52 @@ index 32d58d4..048bd92 100644 + hwSupport += "iMXVPU:yes "; +#else + hwSupport += "iMXVPU:no "; -+#endif ++#endif CLog::Log(LOGDEBUG, "CDVDFactoryCodec: compiled in hardware support: %s", hwSupport.c_str()); if (hint.stills && (hint.codec == AV_CODEC_ID_MPEG2VIDEO || hint.codec == AV_CODEC_ID_MPEG1VIDEO)) -@@ -206,6 +213,15 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne +@@ -198,6 +205,13 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne } #endif -+/*#endif*/ -+ +#if defined(HAS_IMXVPU) + if (!hint.software) + { + if ( (pCodec = OpenCodec(new CDVDVideoCodecIMX(), hint, options)) ) return pCodec; + } +#endif -+ ++ #if defined(TARGET_DARWIN_OSX) if (!hint.software && CSettings::Get().GetBool("videoplayer.usevda")) { diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index 741017d..c25eb38 100644 +index 741017d..e73b917 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -25,6 +25,7 @@ - #include +@@ -26,6 +26,8 @@ #include #include "cores/VideoRenderers/RenderFormats.h" -+#include "DVDVideoCodecInfo.h" ++ ++ extern "C" { #include "libavcodec/avcodec.h" -@@ -95,6 +96,11 @@ struct DVDVideoPicture + } +@@ -53,6 +55,7 @@ class COpenMaxVideo; + struct OpenMaxVideoBuffer; + class CDVDVideoCodecStageFright; + class CDVDMediaCodecInfo; ++class CDVDVideoCodecIMXBuffer; + typedef void* EGLImageKHR; + + +@@ -95,6 +98,11 @@ struct DVDVideoPicture struct { CDVDMediaCodecInfo *mediacodec; }; -+ ++ + struct { -+ CDVDVideoCodecBuffer *codecinfo; ++ CDVDVideoCodecIMXBuffer *IMXBuffer; + }; + }; @@ -565,10 +558,10 @@ index 741017d..c25eb38 100644 unsigned int iFlags; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp new file mode 100644 -index 0000000..f8b2915 +index 0000000..adbb27e --- /dev/null +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -0,0 +1,1477 @@ +@@ -0,0 +1,1083 @@ +/* + * Copyright (C) 2010-2013 Team XBMC + * http://www.xbmc.org @@ -597,8 +590,6 @@ index 0000000..f8b2915 +#include +#include +#include -+#include -+#include +#include "threads/SingleLock.h" +#include "utils/log.h" +#include "DVDClock.h" @@ -609,12 +600,6 @@ index 0000000..f8b2915 +#define _4CC(c1,c2,c3,c4) (((uint32_t)(c4)<<24)|((uint32_t)(c3)<<16)|((uint32_t)(c2)<<8)|(uint32_t)(c1)) +#define Align(ptr,align) (((unsigned int)ptr + (align) - 1)/(align)*(align)) + -+// Helpers to extract physical and virtual addresses from CDVDVideoCodecBuffer pointers -+#define GET_PHYS_ADDR(buf) (buf)->data[1] -+#define GET_VIRT_ADDR(buf) (buf)->data[0] -+#define GET_DEINTERLACER(buf) (buf)->data[2] -+#define GET_FIELDTYPE(buf) (buf)->data[3] -+ +// Experiments show that we need at least one more (+1) VPU buffer than the min value returned by the VPU +const int CDVDVideoCodecIMX::m_extraVpuBuffers = 6; +const int CDVDVideoCodecIMX::m_maxVpuDecodeLoops = 5; @@ -902,20 +887,6 @@ index 0000000..f8b2915 +#endif + } + -+ if (m_initInfo.nInterlace) -+ { -+ CLog::Log(LOGNOTICE, "IMX: Enable hardware deinterlacing\n"); -+ if (!m_deinterlacer.Init(m_initInfo.nPicWidth, m_initInfo.nPicHeight, GetAllowedReferences()+1, nAlign)) -+ { -+ CLog::Log(LOGWARNING, "IMX: Failed to initialize IPU buffers: deinterlacing disabled\n"); -+ } -+ else -+ { -+ for (int i=0; iReleaseFramebuffer(&m_vpuHandle); + + m_frameCounter = 0; -+ m_deinterlacer.Reset(); + m_bytesToBeConsumed = 0; + m_previousPts = DVD_NOPTS_VALUE; + @@ -1450,7 +1419,7 @@ index 0000000..f8b2915 +{ + if (pDvdVideoPicture) + { -+ SAFE_RELEASE(pDvdVideoPicture->codecinfo); ++ SAFE_RELEASE(pDvdVideoPicture->IMXBuffer); + } + + return true; @@ -1502,8 +1471,8 @@ index 0000000..f8b2915 + CLog::Log(LOGDEBUG, "+ %02d dts %f pts %f (VPU)\n", idx, pDvdVideoPicture->dts, pDvdVideoPicture->pts); +#endif + -+ pDvdVideoPicture->codecinfo = buffer; -+ pDvdVideoPicture->codecinfo->Lock(); ++ pDvdVideoPicture->IMXBuffer = buffer; ++ pDvdVideoPicture->IMXBuffer->Lock(); + + // Save last buffer + if (m_lastBuffer) @@ -1560,7 +1529,6 @@ index 0000000..f8b2915 + , m_pts(DVD_NOPTS_VALUE) + , m_previousBuffer(NULL) +{ -+ GET_DEINTERLACER(this) = NULL; +} + +void CDVDVideoCodecIMXBuffer::Lock() @@ -1626,11 +1594,10 @@ index 0000000..f8b2915 + if (m_previousBuffer) + m_previousBuffer->Lock(); + -+ iWidth = frameInfo->pExtInfo->nFrmWidth; -+ iHeight = frameInfo->pExtInfo->nFrmHeight; -+ GET_VIRT_ADDR(this) = m_frameBuffer->pbufVirtY; -+ GET_PHYS_ADDR(this) = m_frameBuffer->pbufY; -+ GET_FIELDTYPE(this) = (uint8_t*)frameInfo->eFieldType; ++ m_iWidth = frameInfo->pExtInfo->nFrmWidth; ++ m_iHeight = frameInfo->pExtInfo->nFrmHeight; ++ m_VirtAddr = m_frameBuffer->pbufVirtY; ++ m_phyAddr = m_frameBuffer->pbufY; +} + +VpuDecRetCode CDVDVideoCodecIMXBuffer::ReleaseFramebuffer(VpuDecHandle *handle) @@ -1678,380 +1645,12 @@ index 0000000..f8b2915 + CLog::Log(LOGDEBUG, "~ %02d (VPU)\n", m_idx); +#endif +} -+ -+#ifdef TRACE_FRAMES -+CDVDVideoCodecIPUBuffer::CDVDVideoCodecIPUBuffer(int idx) -+ : m_refs(1) -+ , m_idx(idx) -+#else -+CDVDVideoCodecIPUBuffer::CDVDVideoCodecIPUBuffer() -+ : m_refs(1) -+#endif -+ , m_source(NULL) -+ , m_pPhyAddr(NULL) -+ , m_pVirtAddr(NULL) -+ , m_nSize(0) -+{ -+} -+ -+CDVDVideoCodecIPUBuffer::~CDVDVideoCodecIPUBuffer() -+{ -+ assert(m_refs == 0); -+#ifdef TRACE_FRAMES -+ CLog::Log(LOGDEBUG, "~ %02d (IPU)\n", m_idx); -+#endif -+} -+ -+void CDVDVideoCodecIPUBuffer::Lock() -+{ -+#ifdef TRACE_FRAMES -+ long count = AtomicIncrement(&m_refs); -+ CLog::Log(LOGDEBUG, "R+ %02d - ref : %d (IPU)\n", m_idx, count); -+#else -+ AtomicIncrement(&m_refs); -+#endif -+ -+} -+ -+long CDVDVideoCodecIPUBuffer::Release() -+{ -+ long count = AtomicDecrement(&m_refs); -+#ifdef TRACE_FRAMES -+ CLog::Log(LOGDEBUG, "R- %02d - ref : %d (IPU)\n", m_idx, count); -+#endif -+ if (count == 1) -+ { -+ ReleaseFrameBuffer(); -+ } -+ else if (count == 0) -+ { -+ delete this; -+ } -+ -+ return count; -+} -+ -+bool CDVDVideoCodecIPUBuffer::IsValid() -+{ -+ return m_source && m_source->IsValid() && m_pPhyAddr; -+} -+ -+bool CDVDVideoCodecIPUBuffer::Process(int fd, CDVDVideoCodecIMXBuffer *buffer, -+ VpuFieldType fieldType, int fieldFmt, -+ bool lowMotion) -+{ -+ CDVDVideoCodecIMXBuffer *previousBuffer; -+ struct ipu_task task; -+ memset(&task, 0, sizeof(task)); -+ task.priority = IPU_TASK_PRIORITY_HIGH; -+ -+ if (lowMotion) -+ previousBuffer = buffer->GetPreviousBuffer(); -+ else -+ previousBuffer = NULL; -+ -+ SAFE_RELEASE(m_source); -+ -+ iWidth = buffer->iWidth; -+ iHeight = buffer->iHeight; -+ -+ // Input is the VPU decoded frame -+ task.input.width = iWidth; -+ task.input.height = iHeight; -+ task.input.format = IPU_PIX_FMT_NV12; -+ -+ // Output is our IPU buffer -+ task.output.width = iWidth; -+ task.output.height = iHeight; -+ task.output.format = IPU_PIX_FMT_NV12; -+ task.output.paddr = (int)GET_PHYS_ADDR(this); -+ -+ // Fill current and next buffer address -+ if (lowMotion && previousBuffer && previousBuffer->IsValid()) -+ { -+ task.input.paddr = (int)GET_PHYS_ADDR(previousBuffer); -+ task.input.paddr_n = (int)GET_PHYS_ADDR(buffer); -+ task.input.deinterlace.motion = LOW_MOTION; -+ } -+ else -+ { -+ task.input.paddr = (int)GET_PHYS_ADDR(buffer); -+ task.input.deinterlace.motion = HIGH_MOTION; -+ } -+ -+ task.input.deinterlace.enable = 1; -+ task.input.deinterlace.field_fmt = fieldFmt; -+ -+ switch (fieldType) -+ { -+ case VPU_FIELD_TOP: -+ case VPU_FIELD_TB: -+ task.input.deinterlace.field_fmt |= IPU_DEINTERLACE_FIELD_TOP; -+ break; -+ case VPU_FIELD_BOTTOM: -+ case VPU_FIELD_BT: -+ task.input.deinterlace.field_fmt |= IPU_DEINTERLACE_FIELD_BOTTOM; -+ break; -+ default: -+ break; -+ } -+ -+#ifdef IMX_PROFILE -+ unsigned int time = XbmcThreads::SystemClockMillis(); -+#endif -+ int ret = ioctl(fd, IPU_QUEUE_TASK, &task); -+#ifdef IMX_PROFILE -+ CLog::Log(LOGDEBUG, "DEINT: tm:%d\n", XbmcThreads::SystemClockMillis() - time); -+#endif -+ if (ret < 0) -+ { -+ CLog::Log(LOGERROR, "IPU task failed: %s\n", strerror(errno)); -+ return false; -+ } -+ -+ buffer->Lock(); -+ -+ // Remember the source buffer. This is actually not necessary since the output -+ // buffer is the one that is used by the renderer. But keep it bound for now -+ // since this state is used in IsValid which then needs to become a flag in -+ // this class. -+ m_source = buffer; -+ m_source->Lock(); -+ -+ buffer->Release(); -+ -+ return true; -+} -+ -+void CDVDVideoCodecIPUBuffer::ReleaseFrameBuffer() -+{ -+#ifdef TRACE_FRAMES -+ CLog::Log(LOGDEBUG, "- %02d (IPU)\n", m_idx); -+#endif -+ CSingleLock lock(CDVDVideoCodecIMX::m_codecBufferLock); -+ SAFE_RELEASE(m_source); -+} -+ -+bool CDVDVideoCodecIPUBuffer::Allocate(int fd, int width, int height, int nAlign) -+{ -+ m_iWidth = Align(width,FRAME_ALIGN); -+ m_iHeight = Align(height,(2*FRAME_ALIGN)); -+ // NV12 == 12 bpp -+ m_nSize = m_iWidth*m_iHeight*12/8; -+ m_pPhyAddr = m_nSize; -+ -+ GET_PHYS_ADDR(this) = GET_VIRT_ADDR(this) = NULL; -+ -+ int r = ioctl(fd, IPU_ALLOC, &m_pPhyAddr); -+ if (r < 0) -+ { -+ m_pPhyAddr = 0; -+ CLog::Log(LOGERROR, "ioctl IPU_ALLOC fail: disable deinterlacing: %s\n", strerror(errno)); -+ return false; -+ } -+ -+ CLog::Log(LOGNOTICE, "IPU: alloc %d bytes for frame of %dx%d at 0x%x\n", -+ m_nSize, m_iWidth, m_iHeight, m_pPhyAddr); -+ -+ m_pVirtAddr = (uint8_t*)mmap(0, m_nSize, PROT_READ | PROT_WRITE, MAP_SHARED, -+ fd, m_pPhyAddr); -+ if (!m_pVirtAddr) -+ { -+ CLog::Log(LOGERROR, "IPU mmap failed: disable deinterlacing: %s\n", strerror(errno)); -+ return false; -+ } -+ -+ if (nAlign>1) -+ { -+ GET_PHYS_ADDR(this) = (uint8_t*)Align(m_pPhyAddr, nAlign); -+ GET_VIRT_ADDR(this) = (uint8_t*)Align(m_pVirtAddr, nAlign); -+ } -+ else -+ { -+ GET_PHYS_ADDR(this) = (uint8_t*)m_pPhyAddr; -+ GET_VIRT_ADDR(this) = (uint8_t*)m_pVirtAddr; -+ } -+ -+ GET_DEINTERLACER(this) = NULL; -+ -+ return true; -+} -+ -+bool CDVDVideoCodecIPUBuffer::Free(int fd) -+{ -+ CSingleLock lock(CDVDVideoCodecIMX::m_codecBufferLock); -+ bool ret = true; -+ -+ // Unmap virtual memory -+ if (m_pVirtAddr != NULL) -+ { -+ if(munmap(m_pVirtAddr, m_nSize)) -+ { -+ CLog::Log(LOGERROR, "IPU unmap failed: %s\n", strerror(errno)); -+ ret = false; -+ } -+ -+ m_pVirtAddr = NULL; -+ } -+ -+ // Free IPU memory -+ if (m_pPhyAddr) -+ { -+ if (ioctl(fd, IPU_FREE, &m_pPhyAddr)) -+ { -+ CLog::Log(LOGERROR, "IPU free buffer 0x%x failed: %s\n", -+ m_pPhyAddr, strerror(errno)); -+ ret = false; -+ } -+ -+ m_pPhyAddr = 0; -+ } -+ -+ GET_PHYS_ADDR(this) = GET_VIRT_ADDR(this) = NULL; -+ SAFE_RELEASE(m_source); -+ -+ return ret; -+} -+ -+CDVDVideoCodecIPUBuffers::CDVDVideoCodecIPUBuffers() -+ : m_ipuHandle(0) -+ , m_bufferNum(0) -+ , m_buffers(NULL) -+ , m_currentFieldFmt(0) -+{ -+} -+ -+CDVDVideoCodecIPUBuffers::~CDVDVideoCodecIPUBuffers() -+{ -+ Close(); -+} -+ -+bool CDVDVideoCodecIPUBuffers::Init(int width, int height, int numBuffers, int nAlign) -+{ -+ if (numBuffers<=0) -+ { -+ CLog::Log(LOGERROR, "IPU Init: invalid number of buffers: %d\n", numBuffers); -+ return false; -+ } -+ -+ m_ipuHandle = open("/dev/mxc_ipu", O_RDWR, 0); -+ if (m_ipuHandle<=0) -+ { -+ CLog::Log(LOGWARNING, "Failed to initialize IPU: deinterlacing disabled: %s\n", -+ strerror(errno)); -+ m_ipuHandle = 0; -+ return false; -+ } -+ -+ m_bufferNum = numBuffers; -+ m_buffers = new CDVDVideoCodecIPUBuffer*[m_bufferNum]; -+ m_currentFieldFmt = 0; -+ -+ for (int i=0; i < m_bufferNum; i++) -+ { -+#ifdef TRACE_FRAMES -+ m_buffers[i] = new CDVDVideoCodecIPUBuffer(i); -+#else -+ m_buffers[i] = new CDVDVideoCodecIPUBuffer; -+#endif -+ if (!m_buffers[i]->Allocate(m_ipuHandle, width, height, nAlign)) -+ { -+ Close(); -+ return false; -+ } -+ } -+ -+ return true; -+} -+ -+bool CDVDVideoCodecIPUBuffers::Reset() -+{ -+ for (int i=0; i < m_bufferNum; i++) -+ m_buffers[i]->ReleaseFrameBuffer(); -+ m_currentFieldFmt = 0; -+} -+ -+bool CDVDVideoCodecIPUBuffers::Close() -+{ -+ bool ret = true; -+ -+ if (m_ipuHandle) -+ { -+ for (int i=0; i < m_bufferNum; i++) -+ { -+ if (m_buffers[i] == NULL ) continue; -+ if (!m_buffers[i]->Free(m_ipuHandle)) -+ ret = false; -+ } -+ -+ // Close IPU device -+ if (close(m_ipuHandle)) -+ { -+ CLog::Log(LOGERROR, "IPU failed to close interface: %s\n", strerror(errno)); -+ ret = false; -+ } -+ -+ m_ipuHandle = 0; -+ } -+ -+ if (m_buffers) -+ { -+ for (int i=0; i < m_bufferNum; i++) -+ SAFE_RELEASE(m_buffers[i]); -+ -+ delete m_buffers; -+ m_buffers = NULL; -+ } -+ -+ m_bufferNum = 0; -+ return true; -+} -+ -+CDVDVideoCodecIPUBuffer * -+CDVDVideoCodecIPUBuffers::Process(CDVDVideoCodecBuffer *sourceBuffer, -+ VpuFieldType fieldType, bool lowMotion) -+{ -+ CDVDVideoCodecIPUBuffer *target = NULL; -+ bool ret = true; -+ -+ if (!m_bufferNum) -+ return NULL; -+ -+ for (int i=0; i < m_bufferNum; i++ ) -+ { -+ if (!m_buffers[i]->Rendered()) continue; -+ -+ // IPU process: -+ // SRC: Current VPU physical buffer address + last VPU buffer address -+ // DST: IPU buffer[i] -+ ret = m_buffers[i]->Process(m_ipuHandle, (CDVDVideoCodecIMXBuffer*)sourceBuffer, -+ fieldType, m_currentFieldFmt, -+ lowMotion); -+ if (ret) -+ { -+#ifdef TRACE_FRAMES -+ CLog::Log(LOGDEBUG, "+ %02d (IPU)\n", i); -+#endif -+ target = m_buffers[i]; -+ } -+ break; -+ } -+ -+ // Buffers are there but there is no free one, this is an error! -+ // Rendering will continue with unprocessed frames ... -+ if (ret && target==NULL) -+ { -+ CLog::Log(LOGERROR, "Deinterlacing: did not find free buffer, forward unprocessed frame\n"); -+ } -+ -+ return target; -+} diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h new file mode 100644 -index 0000000..bd712d9 +index 0000000..6533683 --- /dev/null +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h -@@ -0,0 +1,216 @@ +@@ -0,0 +1,151 @@ +#pragma once +/* + * Copyright (C) 2010-2013 Team XBMC @@ -2076,7 +1675,6 @@ index 0000000..bd712d9 +#include +#include "DVDVideoCodec.h" +#include "DVDStreamInfo.h" -+#include "DVDVideoCodecInfo.h" +#include "threads/CriticalSection.h" +#include "utils/BitstreamConverter.h" + @@ -2103,9 +1701,7 @@ index 0000000..bd712d9 + VpuMemDesc* phyMem; +}; + -+class CDVDVideoCodecIPUBuffer; -+ -+class CDVDVideoCodecIMXBuffer : public CDVDVideoCodecBuffer ++class CDVDVideoCodecIMXBuffer +{ +public: +#ifdef TRACE_FRAMES @@ -2127,6 +1723,11 @@ index 0000000..bd712d9 + double GetPts(void) const; + CDVDVideoCodecIMXBuffer *GetPreviousBuffer() const; + ++ uint32_t m_iWidth; ++ uint32_t m_iHeight; ++ uint8_t *m_phyAddr; ++ uint8_t *m_VirtAddr; ++ +private: + // private because we are reference counted + virtual ~CDVDVideoCodecIMXBuffer(); @@ -2143,72 +1744,6 @@ index 0000000..bd712d9 + // previous buffer +}; + -+// Shared buffer that holds an IPU allocated memory block and serves as target -+// for IPU operations such as deinterlacing, rotation or color conversion. -+class CDVDVideoCodecIPUBuffer : public CDVDVideoCodecBuffer -+{ -+public: -+#ifdef TRACE_FRAMES -+ CDVDVideoCodecIPUBuffer(int idx); -+#else -+ CDVDVideoCodecIPUBuffer(); -+#endif -+ -+ // reference counting -+ virtual void Lock(); -+ virtual long Release(); -+ virtual bool IsValid(); -+ -+ // Returns whether the buffer is ready to be used -+ bool Rendered() const { return m_source == NULL; } -+ bool Process(int fd, CDVDVideoCodecIMXBuffer *buffer, -+ VpuFieldType fieldType, int fieldFmt, -+ bool lowMotion); -+ void ReleaseFrameBuffer(); -+ -+ bool Allocate(int fd, int width, int height, int nAlign); -+ bool Free(int fd); -+ -+private: -+ virtual ~CDVDVideoCodecIPUBuffer(); -+ -+private: -+#ifdef TRACE_FRAMES -+ int m_idx; -+#endif -+ long m_refs; -+ CDVDVideoCodecBuffer *m_source; -+ int m_pPhyAddr; -+ uint8_t *m_pVirtAddr; -+ int m_iWidth; -+ int m_iHeight; -+ int m_nSize; -+}; -+ -+// Collection class that manages a pool of IPU buffers that are used for -+// deinterlacing. In future they can also serve rotation or color conversion -+// buffers. -+class CDVDVideoCodecIPUBuffers -+{ -+ public: -+ CDVDVideoCodecIPUBuffers(); -+ ~CDVDVideoCodecIPUBuffers(); -+ -+ bool Init(int width, int height, int numBuffers, int nAlign); -+ bool Reset(); -+ bool Close(); -+ -+ CDVDVideoCodecIPUBuffer *Process(CDVDVideoCodecBuffer *sourceBuffer, -+ VpuFieldType fieldType, bool lowMotion); -+ -+ private: -+ int m_ipuHandle; -+ int m_bufferNum; -+ CDVDVideoCodecIPUBuffer **m_buffers; -+ int m_currentFieldFmt; -+}; -+ -+ +class CDVDVideoCodecIMX : public CDVDVideoCodec +{ + friend class CDVDVideoCodecIMXBuffer; @@ -2242,7 +1777,7 @@ index 0000000..bd712d9 + + static const int m_extraVpuBuffers; // Number of additional buffers for VPU + static const int m_maxVpuDecodeLoops; // Maximum iterations in VPU decoding loop -+ static CCriticalSection m_codecBufferLock; // Lock to protect buffers handled ++ static CCriticalSection m_codecBufferLock; // Lock to protect buffers handled + // by both decoding and rendering threads + + CDVDStreamInfo m_hints; // Hints from demuxer at stream opening @@ -2254,7 +1789,6 @@ index 0000000..bd712d9 + bool m_dropState; // Current drop state + int m_vpuFrameBufferNum; // Total number of allocated frame buffers + VpuFrameBuffer *m_vpuFrameBuffers; // Table of VPU frame buffers description -+ CDVDVideoCodecIPUBuffers m_deinterlacer; // Pool of buffers used for deinterlacing + CDVDVideoCodecIMXBuffer **m_outputBuffers; // Table of VPU output buffers + CDVDVideoCodecIMXBuffer *m_lastBuffer; // Keep track of previous VPU output buffer (needed by deinterlacing motion engin) + VpuMemDesc *m_extraMem; // Table of allocated extra Memory @@ -2268,69 +1802,25 @@ index 0000000..bd712d9 + bool m_frameReported; // State whether the frame consumed event will be reported by libfslvpu + double m_dts; // Current dts +}; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h -new file mode 100644 -index 0000000..6096bf4 ---- /dev/null -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h -@@ -0,0 +1,38 @@ -+/* -+ * Copyright (C) 2010-2013 Team XBMC -+ * http://xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#ifndef DVDVIDEOCODECINFO_H -+#define DVDVIDEOCODECINFO_H -+ -+class CDVDVideoCodecBuffer -+{ -+public: -+ // reference counting -+ virtual void Lock() = 0; -+ virtual long Release() = 0; -+ virtual bool IsValid() = 0; -+ -+ uint32_t iWidth; -+ uint32_t iHeight; -+ uint8_t* data[4]; // [4] = alpha channel, currently not used -+ int iLineSize[4]; // [4] = alpha channel, currently not used -+}; -+ -+#endif // DVDVIDEOCODECINFO_H diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -index 8a97889..d019a91 100644 +index 9c13da8..50dc8b7 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -@@ -24,6 +24,9 @@ SRCS += OpenMax.cpp +@@ -20,6 +20,9 @@ SRCS += OpenMax.cpp SRCS += OpenMaxVideo.cpp SRCS += DVDVideoCodecOpenMax.cpp endif +ifeq (@USE_IMXVPU@,1) -+SRCS += DVDVideoCodecIMX.cpp ++SRCS += DVDVideoCodecIMX.cpp +endif ifeq (@USE_LIBAMCODEC@,1) SRCS += AMLCodec.cpp SRCS += DVDVideoCodecAmlogic.cpp diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index be532ec..7812523 100644 +index ac78f18..619e25e 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -996,6 +996,7 @@ static std::string GetRenderFormatName(ERenderFormat format) +@@ -994,6 +994,7 @@ static std::string GetRenderFormatName(ERenderFormat format) case RENDER_FMT_EGLIMG: return "EGLIMG"; case RENDER_FMT_BYPASS: return "BYPASS"; case RENDER_FMT_MEDIACODEC:return "MEDIACODEC"; @@ -2342,47 +1832,26 @@ index be532ec..7812523 100644 2.0.4 -From 01f64d4b6ecce932cbc0f632651e0a24d94e9fc1 Mon Sep 17 00:00:00 2001 +From fba4372a70547e34afe098034caac432b247b002 Mon Sep 17 00:00:00 2001 From: "Chris \"Koying\" Browet" Date: Thu, 7 Aug 2014 13:51:15 +0200 -Subject: [PATCH 2/3] ADD: [imx] native framebuffer support +Subject: [PATCH 2/2] ADD: [imx] native framebuffer support --- - configure.in | 9 + - xbmc/windowing/egl/EGLNativeTypeIMX.cpp | 321 ++++++++++++++++++++++++++++++++ - xbmc/windowing/egl/EGLNativeTypeIMX.h | 60 ++++++ - xbmc/windowing/egl/EGLWrapper.cpp | 11 +- - xbmc/windowing/egl/Makefile.in | 4 + - 5 files changed, 402 insertions(+), 3 deletions(-) + xbmc/windowing/egl/EGLNativeTypeIMX.cpp | 336 ++++++++++++++++++++++++++++++++ + xbmc/windowing/egl/EGLNativeTypeIMX.h | 59 ++++++ + xbmc/windowing/egl/EGLWrapper.cpp | 7 +- + xbmc/windowing/egl/Makefile.in | 1 + + 4 files changed, 400 insertions(+), 3 deletions(-) create mode 100644 xbmc/windowing/egl/EGLNativeTypeIMX.cpp create mode 100644 xbmc/windowing/egl/EGLNativeTypeIMX.h -diff --git a/configure.in b/configure.in -index c8a9ce2..a505582 100644 ---- a/configure.in -+++ b/configure.in -@@ -985,6 +985,15 @@ else - AC_MSG_RESULT($wayland_disabled) - fi - -+# i.MX6 -+AC_MSG_CHECKING([for i.MX framebuffer support]) -+AC_CHECK_HEADER([linux/mxcfb.h], have_imxfb=yes,have_imxfb=no) -+AC_MSG_RESULT($have_imxfb) -+if test "x$have_imxfb" = "xyes"; then -+ AC_DEFINE([HAS_IMXFB], [1], [Whether i.MX framebuffer support is enabled.]) -+ AC_SUBST([USE_IMXFB], 1) -+fi -+ - # Checks for platforms libraries. - if test "$use_gles" = "yes"; then - use_gl="no" diff --git a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp new file mode 100644 -index 0000000..577452b +index 0000000..04cadc8 --- /dev/null +++ b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp -@@ -0,0 +1,321 @@ +@@ -0,0 +1,336 @@ +/* + * Copyright (C) 2011-2013 Team XBMC + * http://www.xbmc.org @@ -2403,7 +1872,6 @@ index 0000000..577452b + * + */ + -+#include +#include "system.h" +#include + @@ -2508,17 +1976,25 @@ index 0000000..577452b + // Force double-buffering + CEnvironment::setenv("FB_MULTI_BUFFER", "2", 0); + ++#ifdef HAS_IMXVPU + // EGL will be rendered on fb0 + m_display = fbGetDisplayByIndex(0); + m_nativeDisplay = &m_display; + return true; ++#else ++ return false; ++#endif +} + +bool CEGLNativeTypeIMX::CreateNativeWindow() +{ ++#ifdef HAS_IMXVPU + m_window = fbCreateWindow(m_display, 0, 0, 0, 0); + m_nativeWindow = &m_window; + return true; ++#else ++ return false; ++#endif +} + +bool CEGLNativeTypeIMX::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const @@ -2543,18 +2019,26 @@ index 0000000..577452b + +bool CEGLNativeTypeIMX::DestroyNativeDisplay() +{ ++#ifdef HAS_IMXVPU + if (m_display) + fbDestroyDisplay(m_display); + m_display = NULL; + return true; ++#else ++ return false; ++#endif +} + +bool CEGLNativeTypeIMX::DestroyNativeWindow() +{ ++#ifdef HAS_IMXVPU + if (m_window) + fbDestroyWindow(m_window); + m_window = NULL; + return true; ++#else ++ return false; ++#endif +} + +bool CEGLNativeTypeIMX::GetNativeResolution(RESOLUTION_INFO *res) const @@ -2706,10 +2190,10 @@ index 0000000..577452b + diff --git a/xbmc/windowing/egl/EGLNativeTypeIMX.h b/xbmc/windowing/egl/EGLNativeTypeIMX.h new file mode 100644 -index 0000000..df7b3b7 +index 0000000..c95dcfb --- /dev/null +++ b/xbmc/windowing/egl/EGLNativeTypeIMX.h -@@ -0,0 +1,60 @@ +@@ -0,0 +1,59 @@ +#pragma once + +/* @@ -2733,7 +2217,6 @@ index 0000000..df7b3b7 + */ +#include +#include "EGLNativeType.h" -+#include "EGL/eglvivante.h" + +class CEGLNativeTypeIMX : public CEGLNativeType +{ @@ -2771,10 +2254,10 @@ index 0000000..df7b3b7 + EGLNativeWindowType m_window; +}; diff --git a/xbmc/windowing/egl/EGLWrapper.cpp b/xbmc/windowing/egl/EGLWrapper.cpp -index 045cdfc..4d74be5 100644 +index 045cdfc..e19ce63 100644 --- a/xbmc/windowing/egl/EGLWrapper.cpp +++ b/xbmc/windowing/egl/EGLWrapper.cpp -@@ -17,16 +17,17 @@ +@@ -17,16 +17,15 @@ * . * */ @@ -2788,1122 +2271,23 @@ index 045cdfc..4d74be5 100644 #include "EGLNativeTypeAmlogic.h" #include "EGLNativeTypeRaspberryPI.h" #include "EGLNativeTypeWayland.h" -+#ifdef HAS_IMXVPU +#include "EGLNativeTypeIMX.h" -+#endif #include "EGLWrapper.h" #define CheckError() m_result = eglGetError(); if(m_result != EGL_SUCCESS) CLog::Log(LOGERROR, "EGL error in %s: %x",__FUNCTION__, m_result); -@@ -83,7 +84,11 @@ bool CEGLWrapper::Initialize(const std::string &implementation) +@@ -83,7 +82,9 @@ bool CEGLWrapper::Initialize(const std::string &implementation) if ((nativeGuess = CreateEGLNativeType(implementation)) || (nativeGuess = CreateEGLNativeType(implementation)) || (nativeGuess = CreateEGLNativeType(implementation)) || - (nativeGuess = CreateEGLNativeType(implementation))) -+ (nativeGuess = CreateEGLNativeType(implementation)) -+#ifdef HAS_IMXFB -+ || (nativeGuess = CreateEGLNativeType(implementation)) -+#endif ++ (nativeGuess = CreateEGLNativeType(implementation)) || ++ (nativeGuess = CreateEGLNativeType(implementation)) + ) { m_nativeTypes = nativeGuess; diff --git a/xbmc/windowing/egl/Makefile.in b/xbmc/windowing/egl/Makefile.in -index f800b7f..ec84c1d 100644 ---- a/xbmc/windowing/egl/Makefile.in -+++ b/xbmc/windowing/egl/Makefile.in -@@ -24,6 +24,10 @@ SRCS+= wayland/Callback.cpp \ - wayland/XBMCSurface.cpp - endif - -+ifeq (@USE_IMXFB@,1) -+SRCS+= EGLNativeTypeIMX.cpp -+endif -+ - LIB = windowing_egl.a - - include ../../../Makefile.include --- -2.0.4 - - -From 7ed99d4098b471232c19742475bf52bb92e806f2 Mon Sep 17 00:00:00 2001 -From: wolfgar -Date: Thu, 21 Aug 2014 01:55:00 +0200 -Subject: [PATCH 3/3] Cleanup after first reviewing : * Remove imx - deinterlacing support : It will be reworked and submited later as a new PR - with dedicated methods for imx deinterlacing * class CDVDVideoCodecBuffer - removed and specific CDVDVideoCodecIMXBuffer used * Renaming of codecinfo - to IMXBuffer * Useless includes removed * Remove the IMXFB define as - linux/mxcfb.h is no longer used - ---- - configure.in | 9 - - xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 96 +++-- - xbmc/cores/VideoRenderers/LinuxRendererGLES.h | 9 +- - xbmc/cores/VideoRenderers/RenderManager.cpp | 2 +- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 6 +- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 408 +-------------------- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 77 +--- - .../dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h | 38 -- - xbmc/windowing/egl/EGLNativeTypeIMX.cpp | 17 +- - xbmc/windowing/egl/EGLNativeTypeIMX.h | 1 - - xbmc/windowing/egl/EGLWrapper.cpp | 8 +- - xbmc/windowing/egl/Makefile.in | 5 +- - 12 files changed, 85 insertions(+), 591 deletions(-) - delete mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h - -diff --git a/configure.in b/configure.in -index a505582..c8a9ce2 100644 ---- a/configure.in -+++ b/configure.in -@@ -985,15 +985,6 @@ else - AC_MSG_RESULT($wayland_disabled) - fi - --# i.MX6 --AC_MSG_CHECKING([for i.MX framebuffer support]) --AC_CHECK_HEADER([linux/mxcfb.h], have_imxfb=yes,have_imxfb=no) --AC_MSG_RESULT($have_imxfb) --if test "x$have_imxfb" = "xyes"; then -- AC_DEFINE([HAS_IMXFB], [1], [Whether i.MX framebuffer support is enabled.]) -- AC_SUBST([USE_IMXFB], 1) --fi -- - # Checks for platforms libraries. - if test "$use_gles" = "yes"; then - use_gl="no" -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -index 9e32a69..8db4ea1 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp -@@ -114,7 +114,9 @@ CLinuxRendererGLES::YUVBUFFER::YUVBUFFER() - #if defined(TARGET_ANDROID) - mediacodec = NULL; - #endif -- codecinfo = NULL; -+#ifdef HAS_IMXVPU -+ IMXBuffer = NULL; -+#endif - } - - CLinuxRendererGLES::YUVBUFFER::~YUVBUFFER() -@@ -930,6 +932,16 @@ void CLinuxRendererGLES::ReleaseBuffer(int idx) - } - } - #endif -+#ifdef HAS_IMXVPU -+ if (m_renderMethod & RENDER_IMXMAP) -+ { -+ if (buf.IMXBuffer) -+ { -+ SAFE_RELEASE(buf.IMXBuffer); -+ buf.IMXBuffer = NULL; -+ } -+ } -+#endif - } - - void CLinuxRendererGLES::Render(DWORD flags, int index) -@@ -1629,13 +1641,13 @@ void CLinuxRendererGLES::RenderIMXMAPTexture(int index, int field) - #endif - - YUVPLANE &plane = m_buffers[index].fields[field][0]; -- CDVDVideoCodecBuffer* codecinfo = m_buffers[index].codecinfo; -+ CDVDVideoCodecIMXBuffer *buffer = m_buffers[index].IMXBuffer; - -- if(codecinfo == NULL) return; -+ if(buffer == NULL) return; - - CDVDVideoCodecIMX::Enter(); - -- if(!codecinfo->IsValid()) -+ if(!buffer->IsValid()) - { - CDVDVideoCodecIMX::Leave(); - return; -@@ -2637,65 +2649,45 @@ void CLinuxRendererGLES::UploadIMXMAPTexture(int index) - { - #ifdef HAS_IMXVPU - YUVBUFFER& buf = m_buffers[index]; -- CDVDVideoCodecBuffer* codecinfo = buf.codecinfo; -+ CDVDVideoCodecIMXBuffer* IMXBuffer = buf.IMXBuffer; - -- if(codecinfo) -+ if(IMXBuffer) - { - CDVDVideoCodecIMX::Enter(); - -- if(!codecinfo->IsValid()) -+ if(!IMXBuffer->IsValid()) - { - CDVDVideoCodecIMX::Leave(); - return; - } - - YUVPLANE &plane = m_buffers[index].fields[0][0]; -- CDVDVideoCodecIPUBuffers *deinterlacer = (CDVDVideoCodecIPUBuffers*)codecinfo->data[2]; -- -- if (deinterlacer) -- { -- EDEINTERLACEMODE deinterlacemode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; -- -- if (deinterlacemode != VS_DEINTERLACEMODE_OFF) -- { -- CDVDVideoCodecBuffer *deint; -- EINTERLACEMETHOD interlacemethod = CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod; -- deint = deinterlacer->Process(codecinfo, (VpuFieldType)(int)codecinfo->data[3], -- interlacemethod == VS_INTERLACEMETHOD_DEINTERLACE); -- if (deint) -- { -- SAFE_RELEASE(buf.codecinfo); -- buf.codecinfo = deint; -- buf.codecinfo->Lock(); -- codecinfo = buf.codecinfo; -- } -- } -- } - - glActiveTexture(GL_TEXTURE0); - glBindTexture(m_textureTarget, plane.id); - - GLuint physical = ~0U; -- GLvoid *virt = (GLvoid*)codecinfo->data[0]; -- glTexDirectVIVMap(m_textureTarget, codecinfo->iWidth, codecinfo->iHeight, GL_VIV_NV12, -+ GLvoid *virt = (GLvoid*)IMXBuffer->m_VirtAddr; -+ glTexDirectVIVMap(m_textureTarget, IMXBuffer->m_iWidth, IMXBuffer->m_iHeight, GL_VIV_NV12, - (GLvoid **)&virt, &physical); - glTexDirectInvalidateVIV(m_textureTarget); - - glBindTexture(m_textureTarget, 0); - - plane.flipindex = m_buffers[index].flipindex; -- plane.texwidth = codecinfo->iWidth; -- plane.texheight = codecinfo->iHeight; -+ plane.texwidth = IMXBuffer->m_iWidth; -+ plane.texheight = IMXBuffer->m_iHeight; - - CalculateTextureSourceRects(index, 1); - - CDVDVideoCodecIMX::Leave(); - } -- - #endif - } -+ - void CLinuxRendererGLES::DeleteIMXMAPTexture(int index) - { -+#ifdef HAS_IMXVPU - YUVBUFFER &buf = m_buffers[index]; - YUVPLANE &plane = buf.fields[0][0]; - -@@ -2703,8 +2695,10 @@ void CLinuxRendererGLES::DeleteIMXMAPTexture(int index) - glDeleteTextures(1, &plane.id); - plane.id = 0; - -- SAFE_RELEASE(buf.codecinfo); -+ SAFE_RELEASE(buf.IMXBuffer); -+#endif - } -+ - bool CLinuxRendererGLES::CreateIMXMAPTexture(int index) - { - YV12Image &im = m_buffers[index].image; -@@ -2804,14 +2798,12 @@ bool CLinuxRendererGLES::Supports(EDEINTERLACEMODE mode) - if(m_renderMethod & RENDER_CVREF) - return false; - --#ifdef HAS_IMXVPU -- if(mode == VS_DEINTERLACEMODE_AUTO) -- return true; --#else -+ if(m_renderMethod & RENDER_IMXMAP) -+ return false; -+ - if(mode == VS_DEINTERLACEMODE_AUTO - || mode == VS_DEINTERLACEMODE_FORCE) - return true; --#endif - - return false; - } -@@ -2837,18 +2829,12 @@ bool CLinuxRendererGLES::Supports(EINTERLACEMETHOD method) - if(m_renderMethod & RENDER_CVREF) - return false; - -+ if(m_renderMethod & RENDER_IMXMAP) -+ return false; -+ - if(method == VS_INTERLACEMETHOD_AUTO) - return true; - -- if(m_renderMethod & RENDER_IMXMAP) -- { -- if(method == VS_INTERLACEMETHOD_DEINTERLACE -- || method == VS_INTERLACEMETHOD_DEINTERLACE_HALF) -- return true; -- else -- return false; -- } -- - #if defined(__i386__) || defined(__x86_64__) - if(method == VS_INTERLACEMETHOD_DEINTERLACE - || method == VS_INTERLACEMETHOD_DEINTERLACE_HALF -@@ -2898,7 +2884,7 @@ EINTERLACEMETHOD CLinuxRendererGLES::AutoInterlaceMethod() - return VS_INTERLACEMETHOD_NONE; - - if(m_renderMethod & RENDER_IMXMAP) -- return VS_INTERLACEMETHOD_DEINTERLACE_HALF; -+ return VS_INTERLACEMETHOD_NONE; - - #if defined(__i386__) || defined(__x86_64__) - return VS_INTERLACEMETHOD_DEINTERLACE_HALF; -@@ -2984,16 +2970,18 @@ void CLinuxRendererGLES::AddProcessor(CDVDMediaCodecInfo *mediacodec, int index) - } - #endif - --void CLinuxRendererGLES::AddProcessor(CDVDVideoCodecBuffer *codecinfo, int index) -+#ifdef HAS_IMXVPU -+void CLinuxRendererGLES::AddProcessor(CDVDVideoCodecIMXBuffer *buffer, int index) - { - YUVBUFFER &buf = m_buffers[index]; - -- SAFE_RELEASE(buf.codecinfo); -- buf.codecinfo = codecinfo; -+ SAFE_RELEASE(buf.IMXBuffer); -+ buf.IMXBuffer = buffer; - -- if (codecinfo) -- codecinfo->Lock(); -+ if (buffer) -+ buffer->Lock(); - } -+#endif - - #endif - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -index 54f0c18..1e89ecf 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h -@@ -33,7 +33,6 @@ - #include "guilib/GraphicContext.h" - #include "BaseRenderer.h" - #include "xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h" --#include "xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h" - - class CRenderCapture; - -@@ -172,7 +171,9 @@ class CLinuxRendererGLES : public CBaseRenderer - // mediaCodec - virtual void AddProcessor(CDVDMediaCodecInfo *mediacodec, int index); - #endif -- virtual void AddProcessor(CDVDVideoCodecBuffer *codecinfo, int index); -+#ifdef HAS_IMXVPU -+ virtual void AddProcessor(CDVDVideoCodecIMXBuffer *codecinfo, int index); -+#endif - - protected: - virtual void Render(DWORD flags, int index); -@@ -293,7 +294,9 @@ class CLinuxRendererGLES : public CBaseRenderer - // mediacodec - CDVDMediaCodecInfo *mediacodec; - #endif -- CDVDVideoCodecBuffer *codecinfo; -+#ifdef HAS_IMXVPU -+ CDVDVideoCodecIMXBuffer *IMXBuffer; -+#endif - }; - - typedef YUVBUFFER YUVBUFFERS[NUM_BUFFERS]; -diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 6598e00..101d1c7 100644 ---- a/xbmc/cores/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -934,7 +934,7 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) - #endif - #ifdef HAS_IMXVPU - else if(pic.format == RENDER_FMT_IMXMAP) -- m_pRenderer->AddProcessor(pic.codecinfo, index); -+ m_pRenderer->AddProcessor(pic.IMXBuffer, index); - #endif - - m_pRenderer->ReleaseImage(index, false); -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index c25eb38..7e3f0eb 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -25,7 +25,8 @@ - #include - #include - #include "cores/VideoRenderers/RenderFormats.h" --#include "DVDVideoCodecInfo.h" -+ -+ - - extern "C" { - #include "libavcodec/avcodec.h" -@@ -54,6 +55,7 @@ class COpenMaxVideo; - struct OpenMaxVideoBuffer; - class CDVDVideoCodecStageFright; - class CDVDMediaCodecInfo; -+class CDVDVideoCodecIMXBuffer; - typedef void* EGLImageKHR; - - -@@ -98,7 +100,7 @@ struct DVDVideoPicture - }; - - struct { -- CDVDVideoCodecBuffer *codecinfo; -+ CDVDVideoCodecIMXBuffer *IMXBuffer; - }; - - }; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index f8b2915..adbb27e 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -26,8 +26,6 @@ - #include - #include - #include --#include --#include - #include "threads/SingleLock.h" - #include "utils/log.h" - #include "DVDClock.h" -@@ -38,12 +36,6 @@ - #define _4CC(c1,c2,c3,c4) (((uint32_t)(c4)<<24)|((uint32_t)(c3)<<16)|((uint32_t)(c2)<<8)|(uint32_t)(c1)) - #define Align(ptr,align) (((unsigned int)ptr + (align) - 1)/(align)*(align)) - --// Helpers to extract physical and virtual addresses from CDVDVideoCodecBuffer pointers --#define GET_PHYS_ADDR(buf) (buf)->data[1] --#define GET_VIRT_ADDR(buf) (buf)->data[0] --#define GET_DEINTERLACER(buf) (buf)->data[2] --#define GET_FIELDTYPE(buf) (buf)->data[3] -- - // Experiments show that we need at least one more (+1) VPU buffer than the min value returned by the VPU - const int CDVDVideoCodecIMX::m_extraVpuBuffers = 6; - const int CDVDVideoCodecIMX::m_maxVpuDecodeLoops = 5; -@@ -331,20 +323,6 @@ bool CDVDVideoCodecIMX::VpuAllocFrameBuffers(void) - #endif - } - -- if (m_initInfo.nInterlace) -- { -- CLog::Log(LOGNOTICE, "IMX: Enable hardware deinterlacing\n"); -- if (!m_deinterlacer.Init(m_initInfo.nPicWidth, m_initInfo.nPicHeight, GetAllowedReferences()+1, nAlign)) -- { -- CLog::Log(LOGWARNING, "IMX: Failed to initialize IPU buffers: deinterlacing disabled\n"); -- } -- else -- { -- for (int i=0; iReleaseFramebuffer(&m_vpuHandle); - - m_frameCounter = 0; -- m_deinterlacer.Reset(); - m_bytesToBeConsumed = 0; - m_previousPts = DVD_NOPTS_VALUE; - -@@ -879,7 +855,7 @@ bool CDVDVideoCodecIMX::ClearPicture(DVDVideoPicture* pDvdVideoPicture) - { - if (pDvdVideoPicture) - { -- SAFE_RELEASE(pDvdVideoPicture->codecinfo); -+ SAFE_RELEASE(pDvdVideoPicture->IMXBuffer); - } - - return true; -@@ -931,8 +907,8 @@ bool CDVDVideoCodecIMX::GetPicture(DVDVideoPicture* pDvdVideoPicture) - CLog::Log(LOGDEBUG, "+ %02d dts %f pts %f (VPU)\n", idx, pDvdVideoPicture->dts, pDvdVideoPicture->pts); - #endif - -- pDvdVideoPicture->codecinfo = buffer; -- pDvdVideoPicture->codecinfo->Lock(); -+ pDvdVideoPicture->IMXBuffer = buffer; -+ pDvdVideoPicture->IMXBuffer->Lock(); - - // Save last buffer - if (m_lastBuffer) -@@ -989,7 +965,6 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer() - , m_pts(DVD_NOPTS_VALUE) - , m_previousBuffer(NULL) - { -- GET_DEINTERLACER(this) = NULL; - } - - void CDVDVideoCodecIMXBuffer::Lock() -@@ -1055,11 +1030,10 @@ void CDVDVideoCodecIMXBuffer::Queue(VpuDecOutFrameInfo *frameInfo, - if (m_previousBuffer) - m_previousBuffer->Lock(); - -- iWidth = frameInfo->pExtInfo->nFrmWidth; -- iHeight = frameInfo->pExtInfo->nFrmHeight; -- GET_VIRT_ADDR(this) = m_frameBuffer->pbufVirtY; -- GET_PHYS_ADDR(this) = m_frameBuffer->pbufY; -- GET_FIELDTYPE(this) = (uint8_t*)frameInfo->eFieldType; -+ m_iWidth = frameInfo->pExtInfo->nFrmWidth; -+ m_iHeight = frameInfo->pExtInfo->nFrmHeight; -+ m_VirtAddr = m_frameBuffer->pbufVirtY; -+ m_phyAddr = m_frameBuffer->pbufY; - } - - VpuDecRetCode CDVDVideoCodecIMXBuffer::ReleaseFramebuffer(VpuDecHandle *handle) -@@ -1107,371 +1081,3 @@ CDVDVideoCodecIMXBuffer::~CDVDVideoCodecIMXBuffer() - CLog::Log(LOGDEBUG, "~ %02d (VPU)\n", m_idx); - #endif - } -- --#ifdef TRACE_FRAMES --CDVDVideoCodecIPUBuffer::CDVDVideoCodecIPUBuffer(int idx) -- : m_refs(1) -- , m_idx(idx) --#else --CDVDVideoCodecIPUBuffer::CDVDVideoCodecIPUBuffer() -- : m_refs(1) --#endif -- , m_source(NULL) -- , m_pPhyAddr(NULL) -- , m_pVirtAddr(NULL) -- , m_nSize(0) --{ --} -- --CDVDVideoCodecIPUBuffer::~CDVDVideoCodecIPUBuffer() --{ -- assert(m_refs == 0); --#ifdef TRACE_FRAMES -- CLog::Log(LOGDEBUG, "~ %02d (IPU)\n", m_idx); --#endif --} -- --void CDVDVideoCodecIPUBuffer::Lock() --{ --#ifdef TRACE_FRAMES -- long count = AtomicIncrement(&m_refs); -- CLog::Log(LOGDEBUG, "R+ %02d - ref : %d (IPU)\n", m_idx, count); --#else -- AtomicIncrement(&m_refs); --#endif -- --} -- --long CDVDVideoCodecIPUBuffer::Release() --{ -- long count = AtomicDecrement(&m_refs); --#ifdef TRACE_FRAMES -- CLog::Log(LOGDEBUG, "R- %02d - ref : %d (IPU)\n", m_idx, count); --#endif -- if (count == 1) -- { -- ReleaseFrameBuffer(); -- } -- else if (count == 0) -- { -- delete this; -- } -- -- return count; --} -- --bool CDVDVideoCodecIPUBuffer::IsValid() --{ -- return m_source && m_source->IsValid() && m_pPhyAddr; --} -- --bool CDVDVideoCodecIPUBuffer::Process(int fd, CDVDVideoCodecIMXBuffer *buffer, -- VpuFieldType fieldType, int fieldFmt, -- bool lowMotion) --{ -- CDVDVideoCodecIMXBuffer *previousBuffer; -- struct ipu_task task; -- memset(&task, 0, sizeof(task)); -- task.priority = IPU_TASK_PRIORITY_HIGH; -- -- if (lowMotion) -- previousBuffer = buffer->GetPreviousBuffer(); -- else -- previousBuffer = NULL; -- -- SAFE_RELEASE(m_source); -- -- iWidth = buffer->iWidth; -- iHeight = buffer->iHeight; -- -- // Input is the VPU decoded frame -- task.input.width = iWidth; -- task.input.height = iHeight; -- task.input.format = IPU_PIX_FMT_NV12; -- -- // Output is our IPU buffer -- task.output.width = iWidth; -- task.output.height = iHeight; -- task.output.format = IPU_PIX_FMT_NV12; -- task.output.paddr = (int)GET_PHYS_ADDR(this); -- -- // Fill current and next buffer address -- if (lowMotion && previousBuffer && previousBuffer->IsValid()) -- { -- task.input.paddr = (int)GET_PHYS_ADDR(previousBuffer); -- task.input.paddr_n = (int)GET_PHYS_ADDR(buffer); -- task.input.deinterlace.motion = LOW_MOTION; -- } -- else -- { -- task.input.paddr = (int)GET_PHYS_ADDR(buffer); -- task.input.deinterlace.motion = HIGH_MOTION; -- } -- -- task.input.deinterlace.enable = 1; -- task.input.deinterlace.field_fmt = fieldFmt; -- -- switch (fieldType) -- { -- case VPU_FIELD_TOP: -- case VPU_FIELD_TB: -- task.input.deinterlace.field_fmt |= IPU_DEINTERLACE_FIELD_TOP; -- break; -- case VPU_FIELD_BOTTOM: -- case VPU_FIELD_BT: -- task.input.deinterlace.field_fmt |= IPU_DEINTERLACE_FIELD_BOTTOM; -- break; -- default: -- break; -- } -- --#ifdef IMX_PROFILE -- unsigned int time = XbmcThreads::SystemClockMillis(); --#endif -- int ret = ioctl(fd, IPU_QUEUE_TASK, &task); --#ifdef IMX_PROFILE -- CLog::Log(LOGDEBUG, "DEINT: tm:%d\n", XbmcThreads::SystemClockMillis() - time); --#endif -- if (ret < 0) -- { -- CLog::Log(LOGERROR, "IPU task failed: %s\n", strerror(errno)); -- return false; -- } -- -- buffer->Lock(); -- -- // Remember the source buffer. This is actually not necessary since the output -- // buffer is the one that is used by the renderer. But keep it bound for now -- // since this state is used in IsValid which then needs to become a flag in -- // this class. -- m_source = buffer; -- m_source->Lock(); -- -- buffer->Release(); -- -- return true; --} -- --void CDVDVideoCodecIPUBuffer::ReleaseFrameBuffer() --{ --#ifdef TRACE_FRAMES -- CLog::Log(LOGDEBUG, "- %02d (IPU)\n", m_idx); --#endif -- CSingleLock lock(CDVDVideoCodecIMX::m_codecBufferLock); -- SAFE_RELEASE(m_source); --} -- --bool CDVDVideoCodecIPUBuffer::Allocate(int fd, int width, int height, int nAlign) --{ -- m_iWidth = Align(width,FRAME_ALIGN); -- m_iHeight = Align(height,(2*FRAME_ALIGN)); -- // NV12 == 12 bpp -- m_nSize = m_iWidth*m_iHeight*12/8; -- m_pPhyAddr = m_nSize; -- -- GET_PHYS_ADDR(this) = GET_VIRT_ADDR(this) = NULL; -- -- int r = ioctl(fd, IPU_ALLOC, &m_pPhyAddr); -- if (r < 0) -- { -- m_pPhyAddr = 0; -- CLog::Log(LOGERROR, "ioctl IPU_ALLOC fail: disable deinterlacing: %s\n", strerror(errno)); -- return false; -- } -- -- CLog::Log(LOGNOTICE, "IPU: alloc %d bytes for frame of %dx%d at 0x%x\n", -- m_nSize, m_iWidth, m_iHeight, m_pPhyAddr); -- -- m_pVirtAddr = (uint8_t*)mmap(0, m_nSize, PROT_READ | PROT_WRITE, MAP_SHARED, -- fd, m_pPhyAddr); -- if (!m_pVirtAddr) -- { -- CLog::Log(LOGERROR, "IPU mmap failed: disable deinterlacing: %s\n", strerror(errno)); -- return false; -- } -- -- if (nAlign>1) -- { -- GET_PHYS_ADDR(this) = (uint8_t*)Align(m_pPhyAddr, nAlign); -- GET_VIRT_ADDR(this) = (uint8_t*)Align(m_pVirtAddr, nAlign); -- } -- else -- { -- GET_PHYS_ADDR(this) = (uint8_t*)m_pPhyAddr; -- GET_VIRT_ADDR(this) = (uint8_t*)m_pVirtAddr; -- } -- -- GET_DEINTERLACER(this) = NULL; -- -- return true; --} -- --bool CDVDVideoCodecIPUBuffer::Free(int fd) --{ -- CSingleLock lock(CDVDVideoCodecIMX::m_codecBufferLock); -- bool ret = true; -- -- // Unmap virtual memory -- if (m_pVirtAddr != NULL) -- { -- if(munmap(m_pVirtAddr, m_nSize)) -- { -- CLog::Log(LOGERROR, "IPU unmap failed: %s\n", strerror(errno)); -- ret = false; -- } -- -- m_pVirtAddr = NULL; -- } -- -- // Free IPU memory -- if (m_pPhyAddr) -- { -- if (ioctl(fd, IPU_FREE, &m_pPhyAddr)) -- { -- CLog::Log(LOGERROR, "IPU free buffer 0x%x failed: %s\n", -- m_pPhyAddr, strerror(errno)); -- ret = false; -- } -- -- m_pPhyAddr = 0; -- } -- -- GET_PHYS_ADDR(this) = GET_VIRT_ADDR(this) = NULL; -- SAFE_RELEASE(m_source); -- -- return ret; --} -- --CDVDVideoCodecIPUBuffers::CDVDVideoCodecIPUBuffers() -- : m_ipuHandle(0) -- , m_bufferNum(0) -- , m_buffers(NULL) -- , m_currentFieldFmt(0) --{ --} -- --CDVDVideoCodecIPUBuffers::~CDVDVideoCodecIPUBuffers() --{ -- Close(); --} -- --bool CDVDVideoCodecIPUBuffers::Init(int width, int height, int numBuffers, int nAlign) --{ -- if (numBuffers<=0) -- { -- CLog::Log(LOGERROR, "IPU Init: invalid number of buffers: %d\n", numBuffers); -- return false; -- } -- -- m_ipuHandle = open("/dev/mxc_ipu", O_RDWR, 0); -- if (m_ipuHandle<=0) -- { -- CLog::Log(LOGWARNING, "Failed to initialize IPU: deinterlacing disabled: %s\n", -- strerror(errno)); -- m_ipuHandle = 0; -- return false; -- } -- -- m_bufferNum = numBuffers; -- m_buffers = new CDVDVideoCodecIPUBuffer*[m_bufferNum]; -- m_currentFieldFmt = 0; -- -- for (int i=0; i < m_bufferNum; i++) -- { --#ifdef TRACE_FRAMES -- m_buffers[i] = new CDVDVideoCodecIPUBuffer(i); --#else -- m_buffers[i] = new CDVDVideoCodecIPUBuffer; --#endif -- if (!m_buffers[i]->Allocate(m_ipuHandle, width, height, nAlign)) -- { -- Close(); -- return false; -- } -- } -- -- return true; --} -- --bool CDVDVideoCodecIPUBuffers::Reset() --{ -- for (int i=0; i < m_bufferNum; i++) -- m_buffers[i]->ReleaseFrameBuffer(); -- m_currentFieldFmt = 0; --} -- --bool CDVDVideoCodecIPUBuffers::Close() --{ -- bool ret = true; -- -- if (m_ipuHandle) -- { -- for (int i=0; i < m_bufferNum; i++) -- { -- if (m_buffers[i] == NULL ) continue; -- if (!m_buffers[i]->Free(m_ipuHandle)) -- ret = false; -- } -- -- // Close IPU device -- if (close(m_ipuHandle)) -- { -- CLog::Log(LOGERROR, "IPU failed to close interface: %s\n", strerror(errno)); -- ret = false; -- } -- -- m_ipuHandle = 0; -- } -- -- if (m_buffers) -- { -- for (int i=0; i < m_bufferNum; i++) -- SAFE_RELEASE(m_buffers[i]); -- -- delete m_buffers; -- m_buffers = NULL; -- } -- -- m_bufferNum = 0; -- return true; --} -- --CDVDVideoCodecIPUBuffer * --CDVDVideoCodecIPUBuffers::Process(CDVDVideoCodecBuffer *sourceBuffer, -- VpuFieldType fieldType, bool lowMotion) --{ -- CDVDVideoCodecIPUBuffer *target = NULL; -- bool ret = true; -- -- if (!m_bufferNum) -- return NULL; -- -- for (int i=0; i < m_bufferNum; i++ ) -- { -- if (!m_buffers[i]->Rendered()) continue; -- -- // IPU process: -- // SRC: Current VPU physical buffer address + last VPU buffer address -- // DST: IPU buffer[i] -- ret = m_buffers[i]->Process(m_ipuHandle, (CDVDVideoCodecIMXBuffer*)sourceBuffer, -- fieldType, m_currentFieldFmt, -- lowMotion); -- if (ret) -- { --#ifdef TRACE_FRAMES -- CLog::Log(LOGDEBUG, "+ %02d (IPU)\n", i); --#endif -- target = m_buffers[i]; -- } -- break; -- } -- -- // Buffers are there but there is no free one, this is an error! -- // Rendering will continue with unprocessed frames ... -- if (ret && target==NULL) -- { -- CLog::Log(LOGERROR, "Deinterlacing: did not find free buffer, forward unprocessed frame\n"); -- } -- -- return target; --} -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h -index bd712d9..12c5331 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h -@@ -22,7 +22,6 @@ - #include - #include "DVDVideoCodec.h" - #include "DVDStreamInfo.h" --#include "DVDVideoCodecInfo.h" - #include "threads/CriticalSection.h" - #include "utils/BitstreamConverter.h" - -@@ -49,9 +48,7 @@ class CDecMemInfo - VpuMemDesc* phyMem; - }; - --class CDVDVideoCodecIPUBuffer; -- --class CDVDVideoCodecIMXBuffer : public CDVDVideoCodecBuffer -+class CDVDVideoCodecIMXBuffer - { - public: - #ifdef TRACE_FRAMES -@@ -73,6 +70,11 @@ class CDVDVideoCodecIMXBuffer : public CDVDVideoCodecBuffer - double GetPts(void) const; - CDVDVideoCodecIMXBuffer *GetPreviousBuffer() const; - -+ uint32_t m_iWidth; -+ uint32_t m_iHeight; -+ uint8_t *m_phyAddr; -+ uint8_t *m_VirtAddr; -+ - private: - // private because we are reference counted - virtual ~CDVDVideoCodecIMXBuffer(); -@@ -89,72 +91,6 @@ class CDVDVideoCodecIMXBuffer : public CDVDVideoCodecBuffer - // previous buffer - }; - --// Shared buffer that holds an IPU allocated memory block and serves as target --// for IPU operations such as deinterlacing, rotation or color conversion. --class CDVDVideoCodecIPUBuffer : public CDVDVideoCodecBuffer --{ --public: --#ifdef TRACE_FRAMES -- CDVDVideoCodecIPUBuffer(int idx); --#else -- CDVDVideoCodecIPUBuffer(); --#endif -- -- // reference counting -- virtual void Lock(); -- virtual long Release(); -- virtual bool IsValid(); -- -- // Returns whether the buffer is ready to be used -- bool Rendered() const { return m_source == NULL; } -- bool Process(int fd, CDVDVideoCodecIMXBuffer *buffer, -- VpuFieldType fieldType, int fieldFmt, -- bool lowMotion); -- void ReleaseFrameBuffer(); -- -- bool Allocate(int fd, int width, int height, int nAlign); -- bool Free(int fd); -- --private: -- virtual ~CDVDVideoCodecIPUBuffer(); -- --private: --#ifdef TRACE_FRAMES -- int m_idx; --#endif -- long m_refs; -- CDVDVideoCodecBuffer *m_source; -- int m_pPhyAddr; -- uint8_t *m_pVirtAddr; -- int m_iWidth; -- int m_iHeight; -- int m_nSize; --}; -- --// Collection class that manages a pool of IPU buffers that are used for --// deinterlacing. In future they can also serve rotation or color conversion --// buffers. --class CDVDVideoCodecIPUBuffers --{ -- public: -- CDVDVideoCodecIPUBuffers(); -- ~CDVDVideoCodecIPUBuffers(); -- -- bool Init(int width, int height, int numBuffers, int nAlign); -- bool Reset(); -- bool Close(); -- -- CDVDVideoCodecIPUBuffer *Process(CDVDVideoCodecBuffer *sourceBuffer, -- VpuFieldType fieldType, bool lowMotion); -- -- private: -- int m_ipuHandle; -- int m_bufferNum; -- CDVDVideoCodecIPUBuffer **m_buffers; -- int m_currentFieldFmt; --}; -- -- - class CDVDVideoCodecIMX : public CDVDVideoCodec - { - friend class CDVDVideoCodecIMXBuffer; -@@ -200,7 +136,6 @@ class CDVDVideoCodecIMX : public CDVDVideoCodec - bool m_dropState; // Current drop state - int m_vpuFrameBufferNum; // Total number of allocated frame buffers - VpuFrameBuffer *m_vpuFrameBuffers; // Table of VPU frame buffers description -- CDVDVideoCodecIPUBuffers m_deinterlacer; // Pool of buffers used for deinterlacing - CDVDVideoCodecIMXBuffer **m_outputBuffers; // Table of VPU output buffers - CDVDVideoCodecIMXBuffer *m_lastBuffer; // Keep track of previous VPU output buffer (needed by deinterlacing motion engin) - VpuMemDesc *m_extraMem; // Table of allocated extra Memory -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h -deleted file mode 100644 -index 6096bf4..0000000 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecInfo.h -+++ /dev/null -@@ -1,38 +0,0 @@ --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * This Program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2, or (at your option) -- * any later version. -- * -- * This Program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#ifndef DVDVIDEOCODECINFO_H --#define DVDVIDEOCODECINFO_H -- --class CDVDVideoCodecBuffer --{ --public: -- // reference counting -- virtual void Lock() = 0; -- virtual long Release() = 0; -- virtual bool IsValid() = 0; -- -- uint32_t iWidth; -- uint32_t iHeight; -- uint8_t* data[4]; // [4] = alpha channel, currently not used -- int iLineSize[4]; // [4] = alpha channel, currently not used --}; -- --#endif // DVDVIDEOCODECINFO_H -diff --git a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp -index 577452b..04cadc8 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp -@@ -18,7 +18,6 @@ - * - */ - --#include - #include "system.h" - #include - -@@ -123,17 +122,25 @@ bool CEGLNativeTypeIMX::CreateNativeDisplay() - // Force double-buffering - CEnvironment::setenv("FB_MULTI_BUFFER", "2", 0); - -+#ifdef HAS_IMXVPU - // EGL will be rendered on fb0 - m_display = fbGetDisplayByIndex(0); - m_nativeDisplay = &m_display; - return true; -+#else -+ return false; -+#endif - } - - bool CEGLNativeTypeIMX::CreateNativeWindow() - { -+#ifdef HAS_IMXVPU - m_window = fbCreateWindow(m_display, 0, 0, 0, 0); - m_nativeWindow = &m_window; - return true; -+#else -+ return false; -+#endif - } - - bool CEGLNativeTypeIMX::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const -@@ -158,18 +165,26 @@ bool CEGLNativeTypeIMX::GetNativeWindow(XBNativeWindowType **nativeWindow) const - - bool CEGLNativeTypeIMX::DestroyNativeDisplay() - { -+#ifdef HAS_IMXVPU - if (m_display) - fbDestroyDisplay(m_display); - m_display = NULL; - return true; -+#else -+ return false; -+#endif - } - - bool CEGLNativeTypeIMX::DestroyNativeWindow() - { -+#ifdef HAS_IMXVPU - if (m_window) - fbDestroyWindow(m_window); - m_window = NULL; - return true; -+#else -+ return false; -+#endif - } - - bool CEGLNativeTypeIMX::GetNativeResolution(RESOLUTION_INFO *res) const -diff --git a/xbmc/windowing/egl/EGLNativeTypeIMX.h b/xbmc/windowing/egl/EGLNativeTypeIMX.h -index df7b3b7..c95dcfb 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeIMX.h -+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.h -@@ -21,7 +21,6 @@ - */ - #include - #include "EGLNativeType.h" --#include "EGL/eglvivante.h" - - class CEGLNativeTypeIMX : public CEGLNativeType - { -diff --git a/xbmc/windowing/egl/EGLWrapper.cpp b/xbmc/windowing/egl/EGLWrapper.cpp -index 4d74be5..e19ce63 100644 ---- a/xbmc/windowing/egl/EGLWrapper.cpp -+++ b/xbmc/windowing/egl/EGLWrapper.cpp -@@ -25,9 +25,7 @@ - #include "EGLNativeTypeAmlogic.h" - #include "EGLNativeTypeRaspberryPI.h" - #include "EGLNativeTypeWayland.h" --#ifdef HAS_IMXVPU - #include "EGLNativeTypeIMX.h" --#endif - #include "EGLWrapper.h" - - #define CheckError() m_result = eglGetError(); if(m_result != EGL_SUCCESS) CLog::Log(LOGERROR, "EGL error in %s: %x",__FUNCTION__, m_result); -@@ -84,10 +82,8 @@ bool CEGLWrapper::Initialize(const std::string &implementation) - if ((nativeGuess = CreateEGLNativeType(implementation)) || - (nativeGuess = CreateEGLNativeType(implementation)) || - (nativeGuess = CreateEGLNativeType(implementation)) || -- (nativeGuess = CreateEGLNativeType(implementation)) --#ifdef HAS_IMXFB -- || (nativeGuess = CreateEGLNativeType(implementation)) --#endif -+ (nativeGuess = CreateEGLNativeType(implementation)) || -+ (nativeGuess = CreateEGLNativeType(implementation)) - ) - { - m_nativeTypes = nativeGuess; -diff --git a/xbmc/windowing/egl/Makefile.in b/xbmc/windowing/egl/Makefile.in -index ec84c1d..f59f9cb 100644 +index f800b7f..f59f9cb 100644 --- a/xbmc/windowing/egl/Makefile.in +++ b/xbmc/windowing/egl/Makefile.in @@ -5,6 +5,7 @@ SRCS+= EGLNativeTypeAmlogic.cpp @@ -3914,17 +2298,6 @@ index ec84c1d..f59f9cb 100644 SRCS+= EGLWrapper.cpp # Wayland specific detail -@@ -24,10 +25,6 @@ SRCS+= wayland/Callback.cpp \ - wayland/XBMCSurface.cpp - endif - --ifeq (@USE_IMXFB@,1) --SRCS+= EGLNativeTypeIMX.cpp --endif -- - LIB = windowing_egl.a - - include ../../../Makefile.include -- 2.0.4